Below are described the changes/additions that were made to the TMX Map Format for recent versions of Tiled.
- Added the
objectalignmentattribute to the <tileset> element, allowing the tileset to control the alignment used for tile objects.
- Text objects can now get their horizontal alignment saved as
justify. This option existed in the UI before but wasn’t saved properly.
- Added an
idattribute to the <layer>, <objectgroup>, <imagelayer> and <group> elements, which stores a map-unique ID of the layer.
- Added a
nextlayeridattribute to the <map> element, which stores the next available ID for new layers. This number is stored to prevent reuse of the same ID after layers have been removed.
<object id="3" template="diamond.tx" x="200" y="100"/>
- A new <group> element was added which is a group layer that can have other layers as child elements. This means layers now form a hierarchy.
- Added Text objects, identified by a new <text> element which is used as a child of the <object> element.
- Added a tile.type attribute for supporting Typed Tiles.
No file format changes.
fileas possible values for the property.type attribute.
- Added support for editing multi-line string properties, which are written out differently.
- The <property> element gained a
typeattribute, storing the type of the value. Currently supported types are
offsetyattributes are now also used for <imagelayer> elements, replacing the
yattributes previously used. This change was made for consistency with the other layer types.
- The tiles in an image collection tileset are no longer guaranteed to be consecutive, because removing tiles from the collection will no longer change the IDs of other tiles.
- The pure XML and Gzip-compressed tile layer data formats were deprecated, since they didn’t have any advantage over other formats. Remaining formats are CSV, base64 and Zlib-compressed layer data.
columnsattribute to the <tileset> element, which specifies the number of tile columns in the tileset. For image collection tilesets it is editable and is used when displaying the tileset.
backgroundcolorattribute of the <map> element will now take the format
#AARRGGBBwhen its alpha value differs from 255. Previously the alpha value was silently discarded.
- Added optional
offsetyattributes to the
objectgroupelements. These specify an offset in pixels that is to be applied when rendering the layer. The default values are 0.
- Added an optional
tilecountattribute to the
tilesetelement, which is written by Tiled to help parsers determine the amount of memory to allocate for tile data.
- Previously tile objects never had
heightproperties, though the format technically allowed this. Now these properties are used to store the size the image should be rendered at. The default values for these attributes are the dimensions of the tile image.
hexagonalto the supported values for the
orientationattribute on the
mapelement. This also adds
hexsidelength(integer value) attributes to the
mapelement, in order to support the many variations of staggered hexagonal. The new
staggeraxisattributes are also supported when using the
- Added an
idattribute to the
objectelement, which stores a map-unique ID of the object.
- Added a
nextobjectidattribute to the
mapelement, which stores the next available ID for new objects. This number is stored to prevent reuse of the same ID after objects have been removed.
Tile objects can now be horizontally or vertically flipped. This is stored in the
gidattribute using the same mechanism as for regular tiles. The image is expected to be flipped without affecting its position, same way as flipped tiles.
Objects can be rotated freely. The rotation is stored in degrees as a
rotationattribute, with positive rotation going clockwise.
The render order of the tiles on tile layers can be configured in a number of ways through a new
renderorderproperty on the
mapelement. Valid values are
left-up. In all cases, the map is drawn row-by-row. This is only supported for orthogonal maps at the moment.
The render order of objects on object layers can be configured to be either sorted by their y-coordinate (previous behavior and still the default) or simply the order of appearance in the map file. The latter enables manual control over the drawing order with actions that “Raise” and “Lower” selected objects. It is controlled by the
draworderproperty on the
objectgroupelement, which can be either
Tiles can have an
objectgroupchild element, which can contain objects that define the collision shape to use for that tile. This information can be edited in the new Tile Collision Editor.
Tiles can have a single looping animation associated with them using an
animationchild element. Each frame of the animation refers to a local tile ID from this tileset and defines the frame duration in milliseconds. Example:
<tileset ...> ... <tile id="[n]"> <animation> <frame tileid="0" duration="100"/> <frame tileid="1" duration="100"/> <frame tileid="2" duration="100"/> </animation> </tile> </tileset>
Per-object visibility flag is saved (defaults to 1):
Terrain information was added to tileset definitions (this is generally not very relevant for games):
<tileset ...> ... <terraintypes> <terrain name="Name" tile="local_id"/> </terraintypes> <tile id="local_id" terrain="[n],[n],[n],[n]" probability="percentage"/> ... </tileset>
There is preliminary support for a “staggered” (isometric) projection (new value for the
orientationattribute of the
A basic image layer type was added:
<imagelayer ...> <image source="..."/> </imagelayer>
Added ellipse object shape. Same parameters as rectangular objects, but marked as ellipse with a child element:
<object ...> <ellipse/> </object>
Added map property for specifying the background color:
<map ... backgroundcolor="#RRGGBB">
Added initial (non-GUI) support for individual and/or embedded tile images (since there is no way to set this up in Tiled Qt but only in Tiled Java or with pytmxlib, this is not very important to support at the moment):
<tileset ...> <tile id="[n]"> <!-- an embedded image --> <image format="png"> <data encoding="base64"> ... </data> </image> </tile> <tile id="[n]"> <!-- an individually referenced image for a single tile --> <image source="file.png"/> </tile> ... </tileset>
Tilesets can now have custom properties (using the
propertieschild element, just like everything else).
Tilesets now support defining a drawing offset in pixels, which is to be used when drawing any tiles from that tileset. Example:
<tileset name="perspective_walls" tilewidth="64" tileheight="64"> <tileoffset x="-32" y="0"/> ... </tileset>
Support for tile rotation in 90-degree increments was added by using the third most significant bit in the global tile id. This new bit means “anti-diagonal flip”, which swaps the x and y axis when rendering a tile.