TMX Format request


I’m currently developing a mini-game engine (algostorm) for a small roguelike I’m trying to make. I want to add support for the Tiled JSON map format and I actually want to be able to define my entire game in tiled maps using custom properties, so I can use the .json map as a single saved-game-file.

However, some meta-data about the game (such as timers that have a type and an int property “remainingMillis”) is hard to save in Tiled using the tmx/json format, because that would be an object inside an object-group, but doesn’t physically exist in the game (doesn’t have an x and y / width and height / gid). I’d suggest to make it possible to add objects (using the same format as before), but to make the x and y optional attributes - and not imperative - (as far as I know, gid / width / height are optional), because this would easily allow to include meta-data about the maps as well.

I could just ignore the x/y attributes and keep the timers like that anyway, but it just seems wrong to me. This change would be compatible with previous versions of the format, but more flexible for this type of use-cases. I don’t know how much effort it would require to implement, but it doesn’t seem too complicated.

An alternative solution would be to allow object property types (because then, such composite meta-data could be saved in map properties instead of a “timers” object-group), but I think that would require a lot more effort and still wouldn’t help with grouping the meta-data logically (everything would be thrown in the map properties, instead of having an object-group for every type of meta-data).

I don’t know if this suggestion fits what you actually want tiled to do or if you will implement this or not, but it seems like a nice thing to have for the given use-cases of encoding meta-data.

Good job for what you’ve done so far!

EDIT: on the same category of suggestion, if the x, y, width, height properties on a layer can’t be changed in Tiled Qt, wouldn’t it be better to make them optional when saving the map?

I think this is the wrong place for such meta-information. Objects can be selected, resized, dragged around, so making their position optional is not really a trivial change. I’d rather extend the custom properties to allow for structures and arrays, so that you could use the map properties for this without it feeling like a hack.

While it is currently not supported to have layers of different sizes, I think at some point it will be (and, in Tiled Java it was supported). Removing those variables would be possible (if we define their defaults to match the attributes on the map), but in terms of file size we don’t really gain anything there while it does have the potential to cause compatibility issues in TMX-supporting libraries.

Thanks for the answer! Indeed, I only thought about the file format compatibility, not about the editor tool aswell. That seems a lot harder to accommodate.

Another request, rather to the community, can someone update the JSON format documentation? The last update was in November 2015.

After playing a bit with the editor and analyzing the output, I noticed several things: the structure is not the same as the xml format; some places in the documentation mentioned the “tile” property, but in reality, “tileid” is produced; tilepropertytypes is present on tilesets, animation is present on tiles etc. I know these are mentioned for the xml somehow, but since they don’t have the same structure, I don’t know if I’m missing something or doing something wrong. Guessing the format by analyzing small outputs is really error-prone.