How to make MTE load .tmx and not the .json map file?

Hi

If I save the .tmx the map in the emulator is not updated. It only reflects new changes if I export the json. Do I need to add a special line of code to make it use the tmx?

Thanks

Hello steve67,

At the moment you have to put the file extension at the end of the map’s filename to load a tmx. If it has no file extension MTE will try to load it as a json file. So, “maps/myMap.tmx” will try to load a TMX file, while “maps/myMap” will try to load a json file.

Hi,

I added the max like below, but now it says:  Attempt to compare number with nil

mte.loadMap(“map/castle.tmx”)  

First I would check that your map isn’t encoded in base64 with compression. The supported encoding formats are CSV, XML, and bas64(uncompressed). I’ve found Tiled to be a little deceptive in reporting and modifying these settings. If you open a map and simply change the Tiled preference to another encoding format, it may ignore the change. The best way to be sure is to open your .tmx file in a code edittor and check the layer data encoding yourself.

If these don’t lead you to the source of the problem feel free to email the project to me. I’ve been making steady improvements to MTE’s TMX parser, but I do find new exceptions now and then that need fixing.

Hello steve67,

At the moment you have to put the file extension at the end of the map’s filename to load a tmx. If it has no file extension MTE will try to load it as a json file. So, “maps/myMap.tmx” will try to load a TMX file, while “maps/myMap” will try to load a json file.

Hi,

I added the max like below, but now it says:  Attempt to compare number with nil

mte.loadMap(“map/castle.tmx”)  

First I would check that your map isn’t encoded in base64 with compression. The supported encoding formats are CSV, XML, and bas64(uncompressed). I’ve found Tiled to be a little deceptive in reporting and modifying these settings. If you open a map and simply change the Tiled preference to another encoding format, it may ignore the change. The best way to be sure is to open your .tmx file in a code edittor and check the layer data encoding yourself.

If these don’t lead you to the source of the problem feel free to email the project to me. I’ve been making steady improvements to MTE’s TMX parser, but I do find new exceptions now and then that need fixing.

just hit this issue & luckily found this post - probably would have taken ages - would be a good idea perhaps to put a hint in the error message (e.g. “check your map isn’t encoded in base64 with compression”)

Good thought, I’ll look into that.

just hit this issue & luckily found this post - probably would have taken ages - would be a good idea perhaps to put a hint in the error message (e.g. “check your map isn’t encoded in base64 with compression”)

Good thought, I’ll look into that.