Loading TMX/Tiled-Exported JSON Into a Game

0 favourites
  • 3 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • What I want to do is be able to load TMX files and/or the JSON files generated by the map editor Tiled into C2.

    However, I need this to be done by loading from my website.

    I'm a bit confused by the process, and information regarding loading tilemaps is incredibly vague, let alone on how the current JSON importer works with the tilemap plugin. I saw mention but once about loading TMX files into C2, but there was no mention of whether or not this could be done during, say, gameplay.

    What would be even better is if I could load the JSON files generated by the Tiled exporter, as the file size is cut to about a quarter of the TMX size.

    Is there any native functionality of C2 to load these files? If not, how would I go about loading and parsing the JSON files created by Tiled? It seems pretty straightforward, but I have little experience writing parsers.

    I found a few other tutorials with similar content, and one for parsing the XML of Tiled's TMX file, but nothing about handling JSON.

    Can anyone help?

  • It's difficult to load TMX files at runtime because the TMX format uses a variety of different compression schemes, some of which are tricky to get working in a browser.

    The editor can import TMX, and then you can use the TilesJSON expression at runtime to get the tile data in JSON format which you can later load at runtime.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I did note the compression schemes. Tiled has an option to use uncompressed XML, which I was considering, but it takes up more data than it needs to, hence why I said it was taking up relatively more space than their JSON export.

    There is a tutorial explaining how to import Tiled's TMX XML maps at runtime, and I am hoping to get down one type of file. XML would work for now, I just can't think of how to get started.

    However, I do need to do all this without preloading anything through the editor.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)