Simple TMX tilemap parser

Here’s a simple parser for TMX files created using the Tiled map editor. It is written in C++ and uses Boost property_tree and tokenizer.

EXAMPLE:

NLTmxMap* map = NLLoadTmxMap( "map1.tmx" );
std::cout << map->width << " x " << map->height << std::endl;
delete map;

UPDATE: Now on Github, modified to remove the Boost dependency and use RapidXML directly. Github repo also contains Xcode project with demo, including a demo map.

LIMITATION: you need to select “CSV” map data encoding in Tiled preferences. I didn’t bother with decoding the base64/gzip formats that Tiled also supports.

Leave a Reply