How to map graphic tileset to ascii symbols?


I’m very happy to find ‘Tiled’ - this is really beautiful programm!

I’m rookie developer and working at online roguelike game Angband Online which is based at Angband.

In my game I got maps which consist of simple ascii maps, for example: - this is a town - this is a map ‘legend’, so # is a wall, O is a road etc

Each ascii tile at the map got graphical tile which is bound to it. So user got an option - to play in pure ascii or with tileset.

I’ve installed ‘Tiled’, created new .tmx with proper size and imported there graphical tileset as .tsx. Now I’m able to draw everything with tiles, not with ascii characters and it’s great! The problem is:
how to export my map which I’ve made in ‘Tiled’ as a pure ascii map (examples of which I linked above)?

I’ve read the ‘Tiled’ documentation and noted the option to export as .csv while having ‘name’ property with acsii symbol for each tile. But it using commas between symbols and also fills empty spots with ‘-1’ (and I need to leave them empty). The only way to solve it (which I found) is to replace ‘-1’ and commans in text editor with spaces which isn’t really comfortable as I need a lot of testing during maps drawing. Also I’ve checked .tmx file format documentation (which also uses .csv), but I failed to understand - is there way to solve this issue there…

Please help, guys! Are there any way to customize output to pure and simple ascii map without additional symbols? So each tile (picture) would have one property (ascii character) at output file; and the same time output file won’t have commas and empty spots would be marked as spaces.

1 Like

The easiest way to do this is with Python scripting.

The example in the docs shows a basic example, pretty much the same as a csv. All you would have to do is slightly modify that script to do what you want. Now, depending on how familiar you are with coding (and the Python language), you may find this to be difficult to understand. If you need any assistance, let me know!

1 Like

Tryed it with the example script. Working on windows with Tiled v. 1.2.2, Python 3.7. installed.
Added script to C:\Users\ <user> \.tiled nothing seems to happen. No new export option in Export As dialog.
Also I see this in plugins:

Example which output I have right now:
Which output I need:
(additionally I need to have a frame and each stroke should start with ‘D:’… I wander is it also possible somehow)?

Thank you!

After I’ll learn a bit, I’m going to make series of video tutorials about ‘Tiled’ at my youtube channel :wink:

The Python scripting is relatively hard to get working since the upgrade to Python 3, because you need exactly the version of Python that Tiled was built against installed on your system (and it needs to match the architecture of the Tiled you installed - 32 or 64 bits).

In the meantime, the development snapshots have gained the option of defining map export formats in JavaScript. This works on all platforms since the JavaScript engine is shipping with Tiled. The extension mechanism is subject to change, but it’s documented at:

The best place to define your custom format is currently in the startup script.

1 Like

Thanks for the answer @bjorn! Yeah I love that option. But unfortunately having problems with it too.
Asked a question in separate thread: made a startup.js script for your needs.


awesome :smiley: THANKS! =)

I see there’s an upcoming game jam on where this script could prove useful: