CSV values offset


I’m having a weird problem with Tiled. I’m currently using it to build some simple tilemaps that I need as CSV files. In fact, I only need the CSV part, so I manually rip out the CSV values from the TMX file. However, the exported CSV values seem to be offset by one when compared to the values show inside the editor. For example: a tile with ID 17 inside the editor is saved as ID 18 in the CSV table of the TMX file.

It’s probably a simple configuration error, but for the life of me I can’t find it anywhere? Any ideas?

Thanks in advance!

Please read the section of the file format definition carefully. It explains why there is an offset. (In short: the offset is the firstgid of the tileset you used. If you only have one tileset it is +1 everywhere. But with more tilesets you can get higher numbers.

Also: If you only need the CSV part. You might want to check out the new CSV export format in tiled 0.11.0! Then you can save yourself from ripping the csv part out always :smile:


Thanks for the help! So… “TMX loader” libraries need to substract the firstgid value to get the proper tile ID…?

Anyway, problem solved with 0.11.0. The CSV exporter seems to only export the “lowest” layer in the layer list, but otherwise it’s fine.

Thanks again :smile:

Yep :slight_smile: It would need to subtract the firstgid of the tileset which has the highest firstgid lower or equal than the actual tile id (the tile belongs to the tileset with that firstgid then).