Open Coastcrawler opened 1 year ago
what is a chunked map??
Am I correct in assuming that by "chunked map", you mean infinite maps, which output their tile data in chunks, sized according to the "output chunk width/height" properties? Finite map files do not use chunked storage.
The size reported by the map and layers via the scripting API and stored in map files is not necessarily the physical size they take up - for infinite maps, the layer size is not updated when the layer contents are updated, since the size is intended for use only with finite maps, and is disregarded for infinite maps.
All that said, it is weird that infinite maps output the map size and layer size at all, since it doesn't mean anything in the context of infinite maps, and since the reported size may not match the physical extent of the layers. I think either these properties should be left out of maps, or they should represent the size of the bounding box of the map/layer chunks, to let the parser know the maximum amount of space it may need to allocate.
Yes, a infinite map is meant.
I checked the values in the layers and it shows the no. of tiles of all used chunks. Sure, that may differ from the actual map size, but it is quite good to get the number of chunks in x and y direction.
I checkt the values in the layers and it shows the no. of tiles of all used chunks. Sure, that may differ from the actual map size, but it is quite good to get the number of chunks in x and y direction.
And this value is accurate for you? When I create e.g. a 30x20 infinite map and then paint way outside the 30x20 space, so my effective map size is more like 200x200, the map map and tile layer both still report the size as 30x20 - completely worthless for figuring out the chunks. Here, for example, is a large map with just four tiles placed in it at (-94, -78), (92, -76), (-92, 92), and (92,92):
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="16" tileheight="16" infinite="1" nextlayerid="2" nextobjectid="1">
<tileset firstgid="1" source=":/automap-tiles.tsx"/>
<layer id="1" name="Tile Layer 1" width="30" height="20">
<data encoding="base64" compression="zlib">
<chunk x="-96" y="-80" width="16" height="16">
eJxjYBgcgGWgHTAKRsEIBAAR4AAF
</chunk>
<chunk x="80" y="-80" width="16" height="16">
eJxjYBgFpACWgXbAKBgFVAQAD0AABQ==
</chunk>
<chunk x="-96" y="80" width="16" height="16">
eJxjYBgFo2AUwADLQDuAzgAAB8AABQ==
</chunk>
<chunk x="80" y="80" width="16" height="16">
eJxjYBgFo2AUEAtYBtoBVAYAB0AABQ==
</chunk>
</data>
</layer>
</map>
This map is effectively 187x171 in size (192 x 176 if we include the empty space in the chunks), but look at the size reported by both the map and layer: 30x20, the map's initial size. So, at least in Tiled 1.10.1, the map and layer size is not updated for infinite maps, it just keeps the value that the map was created with (edit: or the size it had when it was last finite, if it was ever finite).
I've played around a bit with multiple layers and the layers with and height is updated only for the last changed layer. As I use Tiled for prototyping only, this will work for me.
I think it's a fair expectation that Tiled should either not output sizes for infinite maps and layers, or should output sizes that make sense, so maybe it's too early to close this issue xP
I think it's a fair expectation that Tiled should either not output sizes for infinite maps and layers, or should output sizes that make sense, so maybe it's too early to close this issue xP
Sure, we can reopen this, if you would like to look into it. Maybe even change the feature label to bug.
When creating a chunked map, the width and height attributes of the map equals the values of the fixed sized map from the crate map dialog. So, these values are completely useless.
Looking at the layers, the size in each layer is as expected. But, for any tooling getting the width and hight of a map before iterating the layers would be beneficial.
Or allow to alter these values from the map properties. At the moment they are read only.