Why are Tile Custom Properties not being saved?

I defined a TileSet, and included a series of Custom Properties for each tile in the set. When I make a map and save it, I DO see the Custom Properties listed in the .tmx, as in this example:

  <tile id="0" terrain="0,0,0,0">
    <property name="Class" value="PlainsHex"/>
    <property name="Type" value="Background"/>

HOWEVER, when I Export that TileSet, then Import it to make a NEW map, problems arise…
After doing my Import, I DO see the TileSet and Custom Properties listed in the “palette” area as shown here:

BUT, when I make the new map and save it, NONE of the Custom Property information is saved in the .tmx file. Here is a complete .tmx file for a 2x2 test map saved with the TileSet as pictured above:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map SYSTEM "http://mapeditor.org/dtd/1.0/map.dtd">
<map version="1.0" orientation="hexagonal" renderorder="right-down" width="2" height="2" tilewidth="38" tileheight="41" hexsidelength="23" staggeraxis="y" staggerindex="odd" nextobjectid="1">
 <tileset firstgid="1" source="../Tilesets/LW_Backgrounds.tsx"/>
 <layer name="Background" width="2" height="2">
  <data encoding="csv">

What happened to all of the Custom Property information? And why was it not saved into the .tmx?

Most importantly, how do I define a TileSet - and all of its Custom Properties - then save/export it so I can use it in other maps and be assured that the Custom Property info embedded in that TileSet will be included in all .tmx files produced?


The information you are looking for is not saved in the map file in case
the tileset is exported. The properties are saved in the exported .tsx fine
and are shared between the maps that way. Try to look into the .tsx file
with your text editor :wink:

Regards Ablu

Thank you Ablu. I will take a look for that.

I am using PyTMX to read Tiled map files directly into a custom game… and I am using Custom Properties to define many aspects (like tile Classes and various attributes) of the individual tiles (“hexes” in our game). So… I either need those Custom Properties always saved in the map file itself… or I need to figure out how to read this other file into my code and cross-ref with the tiles (hexes)…

I’ll leave it at that for now… I’m still learning (both Tiled and how to manipulate PyTMX), but I anticipate issues if that info is not directly stored in the map file itself. I’ll come back with a clearer question when I better understand the full scope of my issue.

Thanks again!

I didn’t try it, but it looks like PyTMX should have no problems loading maps that refer to an external tileset file:

Regarding Tiled. The thing about external tilesets is that currently you can’t edit them while they are external. So you import them into a map before you edit them, but afterwards you have to remember to export the tileset again (and overwrite the external tileset file to save the changes). This is a clumsy process and it’s the most tricky issue I still need to solve for Tiled 1.0.

Ah, thanks for finding the ref in PyTMX. I am doing the Tiled work on one PC and Python work on another, and did not copy the .tsx file over for my testing (not realizing at the time its purpose). I will try that next and see if/how PyTMX handles.

I must say I really like the Custom Properties area in Tiled. I have the ability to specify a host of parameters about each tile (“hex” in my case), and PyTMX makes them instantly readable as it loads the map. The key, naturally, is for PyTMX to link those tile descriptions to the tiles themselves. I’ll try bringing in the .tsx file next and see what happens.

Thanks again.