Solution for Nested Maps

For projects with complex maps, the ability to nest one map (a submap) inside another can make level design much easier.

This can be used for repeating complex patterns such as buildings, whereby a change to one will affect all instances. It also allows very large or complicated maps to be designed in smaller sections. These sections can then be moved around individually.

How to Emulate

I could not find this feature supported in Tiled, however, I realised you could emulate it by using image layers. To create a submap, simply export a tmx as an image with the zoom level as 1, then add this as an image layer in your main map. After making changes to the submap, re-export as an image and hit ctrl-r in the main map.

In order to use this in your game, you could use a special prefix for the submaps, for example “submap_”, so that when you come across an image layer called, for example, “submap_house1.png”, you know to load the extra tilemap “submap_house1.tmx” in that position.

This does have the issue that you require a separate layer for every submap, which could get messy if you have a lot.

Suggestions for Feature

I think this would make a great feature as it is incredibly useful. However, the way I would implement it would require an additional feature that tiled currently seems to lack.

It seems to me that image layers shouldn’t exist. It makes more sense to me that images should be added as an image object to an object layer instead. There are also multiple object types, so it would be consistent with that. You would still be able to achieve the same behaviours as an image layer, except you would also be able to have multiple images on the same layer, alongside other objects. Furthermore, this could simply be used as a way of making it easier to see what your objects are. The tile-objects can somewhat do this, but a lot of the time your game objects are larger than a single tile.

As for submaps, the image-objects would already make the solution I proposed for submaps even better, as it would avoid the need for having many image layers. Perhaps in the far future, though, an additonal object type for submaps could be added, whereby you can open and edit the submap from the main map.

It’s definitely a feature I’d like to support. Sharing or repeating buildings is a nice use-case, and it would also help with stitching multiple maps together to represent a larger world.

Regarding the image layers, indeed I also think that feature has very little merit. You should actually be using tile objects already, putting your placeholder images in an image collection tileset. Such tilesets can contain individual images of different sizes.

This workaround of using images is rather clever!

When to implement it ? I’m looking forward to it very much!

This is very hard to estimate, given that there are so many things to do and I can currently spend one day/week on Tiled (though soon two days/week). To be honest, I do not expect to get around to this in this year. This is mainly because there are so many other improvements to be made as well.

But, every time somebody mentions that he could use a certain feature, it raises its priority a little bit. :slight_smile: