Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json tile map parsing null #65

Open
natebot13 opened this issue Mar 17, 2023 · 4 comments
Open

Json tile map parsing null #65

natebot13 opened this issue Mar 17, 2023 · 4 comments

Comments

@natebot13
Copy link
Contributor

(json) => null, // data is just a string or list of int on JSON

Is this line supposed to return null? This seems to make tileData for the layer be null, causing a null assertion failure in flame_tiled that assumes tileData is not null.

@spydon
Copy link
Member

spydon commented Mar 17, 2023

No idea, can you check who wrote that line and we can tag them? :)

@natebot13
Copy link
Contributor Author

@luanpotter The blame gods have mentioned your name.

@jtmcdole
Copy link
Collaborator

There's very limited documentation or testing of the parser code. Flame-engine only deals with XML files, so this looks like an oversite.

Tiled Map Editor does document this field as being either a list of ints or base64 encoded for JSON. There is no example of this in their codebase (or I'm just bad at search this early in the morning) but the XML format has the documentation for why there's a compression/encoding field. In JSON format:

Array of unsigned int (GIDs) or base64-encoded data. tilelayer only.

and

The data of a tile layer can be stored as a native JSON array or as base64-encoded and optionally compressed binary data, the same as done in the TMX format. The tiles are referenced using Global Tile IDs.

Further down in this code we call "parseLayerData" - but since this will ALWAYS be null for json, it'll never actually attempt to parse it.

This file needs a little love and testing.

@luanpotter
Copy link
Member

Probably an oversight on my part. I think i didn't have many/any JSON examples and thought that field was not set for the JSON format. Def open to PRs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants