Tiled AutoMap Auto-Generate Walls

I recently discovered the Tiled AutoMap feature and was excited to learn how to auto-generate walls based off the ground tiles. This feature is shown in the examples of the Tiled AutoMap docs and in a few popular videos about auto cave and dungeon walls generation.

However, these examples showed it working in a way that I could never get working.

The basic setup that each of the examples gave was to create a Tiled map and add a layer called Ground which contains ground tiles in the shape you wanted.

Tiled map editor with a 4x4 grid of ground tiles
Tileset image courtesy of Kenney

Next, you create another Tiled map (I called it wall-rules.tmx) in the same directory and create three layers: regions, input_Ground, and output_Walls. Using these layers, you create a rule to add a single wall above a single ground tile.

AutoMap Rule Layers
Tile layerName
Tiled map editor with a 1x2 grid of tiles to represent the rule regionregions
Tiled map editor showing the bottom grid as a ground tileinput_Ground
Tiled map editor showing the top grid as a wall tileoutput_Walls

Lastly you create a rules.txt file in the same directory as the Tiled map that lists each rule map you want to include.

wall-rules.tmx

With that, every example showed you should be able to run the AutoMap feature and it would populate the walls above the top row of ground tiles. This is the part that never worked.

It turns out that at the end of 2017 a new feature was added that prevents these examples from working as is. The new feature added a flag to input layers called StrictEmpty that changed the default behavior to not match empty tiles:

In "StrictEmpty" mode, empty tiles in the input region match empty tiles in the set layer. So when an "input" layer contains an empty tile within the input region, this means an empty tile is allowed at that location. And when an "inputnot" layer contains an empty tile within the input region, it means an empty tile is not allowed at that location.

Without the "StrictEmpty" option, when no "input" layer specifies any tile for a given location, and no "inputnot" layers exist, any tile that isn't used elsewhere on any input layer is considered valid. Also, when an "inputnot" layer contains an empty tile, it is simply ignored. This behavior can be convenient, but it is not always desired.

The "StrictEmpty" mode can be enabled per input layer by adding a custom boolean property named "StrictEmpty" with the value "true".

So to get the examples to work, what you have to do is add a Layer Property to the input_Ground layer called StrictEmpty of type Bool and set the value to true.

Once you do that, the AutoMap feature will now work.

Tiled map editor with a 4x4 grid of ground tiles and a 4x1 row of wall tiles above the first row of ground tiles

You can download the complete example files from github so you can try it out yourself.