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
Embedded images (as base64) in json format #1957
Comments
Right, in fact embedded images as base64-encoded PNGs is already supported by the TMX Map Format (if the The main problem is how to provide this option to the user. At the moment, embedding images is only possible through code, since there is no UI in Tiled for telling it to embed an image or not. But, I think it could be enough if this existed as an export option (see also #1850). That said, I am not a fan of allowing to embed everything just so that we can have a single file. With Tiled 1.0, I moved away from having tileset definitions embedded by default and instead they are in their own files. In Tiled 1.1, object templates were added as external files and there is no option to embed them. The reason is mainly that the option of embedding adds complexity, mainly to the UI but also to the saving and loading code, which has to support both options and remember how the data was stored. In general, I think this is a rather specific problem and you would probably benefit from either supporting the archived assets or writing a custom tool (or plugin) that packs together all the needed files in a format that's easy to digest by your engine. |
hmm- where is some info about how i can create such plugin ? |
There is some documentation on writing Python plugins, but for C++ plugins you will need to take the existing plugins as example, and start by setting up a Tiled development environment (see Contributing to Tiled). |
Made such a JavaScript plugin to export image data directly in the JSON format as Base64 encoded strings: I really like the JavaScript API you put together here! Really easy to use and build upon. Thanks a lot. |
@RobLoach That's great, thanks for publishing your extensions! Btw, the option to minimize the output is already provided in the Tiled Preferences, though only when exporting: |
Now we can embed tilesets into map, but would be nice get possibility embed images (tilesets, image-ayer .. ) to have single file for whole map.
Reason:
Now im working on some platfromer game that uses tiled as main level editor, most of job is done in tiled: defining level, parallaxes, enemy types, collisions (made up from individual shape of tiles), animations... so idea is to create "online-platformer-engine" where all tools what you need is Tiled. To be able run it online - it would be nice have possibility - to upload just 1 file an get fully running game.
For now only solution is to make zip file out of map + images and upload it, then extract all stuff in browser, update all references to images (to use base64 or other kind of data) and only then run game.
The text was updated successfully, but these errors were encountered: