go-tiled icon indicating copy to clipboard operation
go-tiled copied to clipboard

[Feature] Infinite maps

Open k80w opened this issue 6 years ago • 3 comments

go-tiled currently has no functionality to load infinite maps and will panic when this is attempted:

panic: illegal base64 data at input byte 0

k80w avatar Jun 30 '19 12:06 k80w

Can you provide small sample tmx file for that?

lafriks avatar Jul 17 '19 13:07 lafriks

Can you provide small sample tmx file for that?

Here's a TMX

k80w avatar Jul 21 '19 09:07 k80w

I've taken a look at this issue and looks like the problem is that Tiled uses a different format for infinite maps.

  <data encoding="csv">
   <chunk x="0" y="0" width="16" height="16">
...
   </chunk>
   <chunk x="16" y="0" width="16" height="16">
...
   </chunk>
   <chunk x="32" y="0" width="16" height="16">
..
   </chunk>

We can "easily" parse all the chunks and load everything into layer.Tiles but I'm worried about really big maps. I think there should be a way to get data as chunks.

My initial proposal after 10 minutes of thinking is to add a new type "Chunk" that will store a slice with the tiles of that chunk pointing to the layer.Tiles slice. This way we keep compatibility for simple maps and allow a controlled way of parsing huge maps.

MetalBlueberry avatar Oct 13 '20 17:10 MetalBlueberry