Add support for pre-1.0 Tiled JSON formats#65
Add support for pre-1.0 Tiled JSON formats#65Cleptomania merged 1 commit intopythonarcade:developmentfrom
Conversation
While attempting to parse Starbound dungeons in Tiled JSON format, I encountered a number of parse errors. These errors appear to be due to pre-1.0 differences in the Tiled JSON map and tileset formats. As far as I can tell, most Starbound dungeon files were created and/or last edited with Tiled 0.15.2. * Map object `properties` were dictionaries rather than lists, with the key being the property name and the value always a string. * Tileset `tiles` were dictionaries rather than lists, with the key being the tile id (integer cast as a string) and the value being a dictionary containing the remainder of the tile definition. * Some map and tileset properties did not exist, or were optional. This patch introduces minimal changes to the code to allow the Starbound files to be parsed. There may be other legacy quirks, but these are the only ones I've noticed in these files.
|
Hey thanks for the PR. I'm happy to merge this and try to support older versions of Tiled on a sort of best effort approach, but don't think I can ever make a guarantee that older versions will work with every new version of pytiled-parser or anything, it's just infeasible for me to maintain compatibility and build tests for many different versions. That being said, as long as we don't break compatibility with current versions of Tiled, I'll gladly merge anything that increases compatibility with older versions. As a side note in this regard, our test suite has fairly substantial coverage, so if it doesn't break any tests, we can be pretty reasonably confident that there shouldn't really be any problems. |
|
@rl-starbound If you are willing, we'd love to hear about your specific use case for pytiled-parser. I assume you are not using the Arcade game library as well? |
|
I maintain and/or monitor a bunch of mods for Starbound. Starbound uses the Tiled JSON format for most of its dungeons. It uses Lua as its game asset language, but with a core in C++, which includes the Tiled parsing logic. Based on the Tiled assets, most of its dungeons were written in Tiled 0.15.2, with a handful of the newer dungeons written with Tiled 1.0.2-1.2.2. Mods typically use the latter as well, although many mods have used even newer versions of Tiled. My main use case for pytiled-parser was that I wanted to update the Starbound wiki with information about where to find various objects in the game. Most of the Wiki content was written by users as they found things organically, but as the game evolved, those reports tended to become inaccurate. By using pytiled-parser to parse the game assets, I was able to definitively state where objects could be found in the game, as well as identify which objects were not actually findable in the game. I've also used it to find which of my modded dungeon pieces contain certain objects, which helps find the pieces I need to edit. |
|
@rl-starbound I see, so it sounds like you mostly use it for data-mining type work, is that correct? Cool use case! |
While attempting to parse Starbound dungeons in Tiled JSON format, I encountered a number of parse errors. These errors appear to be due to pre-1.0 differences in the Tiled JSON map and tileset formats. As far as I can tell, most Starbound dungeon files were created and/or last edited with Tiled 0.15.2.
propertieswere dictionaries rather than lists, with the key being the property name and the value always a string.tileswere dictionaries rather than lists, with the key being the tile id (integer cast as a string) and the value being a dictionary containing the remainder of the tile definition.This patch introduces minimal changes to the code to allow the Starbound files to be parsed. There may be other legacy quirks, but these are the only ones I've noticed in these files.