Include the number of columns of an external tileset in .TMX data

I’m currently working on a game with many maps, and a small pool of large tilesets whose source images I’m frequently changing the width of.

A problem I’ve run into frequently is that whenever I change the width of a tile spritesheet, I have to re-open each map (or open the map’s tab) and re-save it with the updated tile indices which is error prone (i.e. forgetting to open a single map, accidentally selecting the wrong option to update tile indices, etc.).

One way to mitigate the issue might be to include the columns (and maybe rows?) property to external tileset tags at save-time just as metadata (it wouldn’t have to functionally “do” anything) – this would allow frameworks to effectively remap tile indices at runtime if there is a column count mismatch between the referenced tileset as it was saved and when it is loaded by the framework.

For instance, if I were to place a tile with an ID of 8 of from a tileset that is 8 tiles wide, and then I later resize the image to be 16 tiles wide, loading a map that was saved with a previous version of that tileset would use the tile in the 9th column of the first row.

With the proposed change, I could programmatically take that index and infer that an index of 8 refers to the first tile of the second row, and remap that interally to an index of 16.

This way, maps that had been saved with a previous version of that tilesheet would continue to function properly even if the tileset is widened without requiring a re-open and re-save.

It’s also a consideration for modding support – if, at some point, I (or a modder) chooses to widen a tileset image for whatever reason, user generated map files that rely on the old tileset would have to be re-opened and re-saved, which is not ideal.

Anyways, apologies if this has already been requested, I’ve tried to search but didn’t find anything similar. Also, if there is a better way for me to handle this situation using existing Tiled functionality, please let me know as well.

(And thank you for all of your work!)