Export map grid as C array


I am creating a 2D RPG game as a project in my computer engineering course entirely in C.
I have not been trying out Python at all but I do know that you are able to write Python scripts for custom exports using Tiled.

Is it possible to write a script that exports the map as an array as such:

If yes, then how do I do that properly in Python?


If you can get the Python plugin to work (which I think is doable on Windows, but won’t currently work on macOS and I’m also not sure how to do it on Linux), then you can indeed solve this with a Python script. If you can write Python, then I’m sure you can adjust the example in the documentation to write out your map in your desired format.

It may be easier to write this in JavaScript instead. For that, you need to install the “snapshot” version of Tiled and write a startup.js script that registers your custom map format. You can read about how to do this in the latest documentation.