How to autotile 2-tile high walls for a procedural/random level generator?

Godot Version

4.6.3

Question

Hi everyone,

I’m currently dabbling in procedural level generation using a Random Walker algorithm. For my project, I am using this 32x32 dungeon tileset from OpenGameArt: Dungeon Tileset | OpenGameArt.org

I successfully got Godot’s native Terrain system to handle the basic layout without the two-tile tall brick walls. However, I’ve hit a total roadblock trying to fit those tall brick walls into the autotile system as well.

If I were designing my levels manually by hand, placing these walls wouldn’t be an issue. But because everything is being placed programmatically by the random walker script, I am at a loss as to how to approach this. Since the walls span two vertical grid cells, the standard 1-to-1 terrain bitmask layout just isn’t working out.

What is the standard workflow or approach for random generation when a wall tile visually overlaps two grid cells vertically like this? Should I be handling the wall heights directly in my generation script, or is there a way to configure the Terrain bitmasks to resolve this automatically?

Any advice, code examples, or tips would be greatly appreciated!

In my opinion, autotiling is most useful when you are placing the tiles by hand. Autotiling handles the boring repetitive work. But when creating levels by code, you can as well write the code that selects the suitable tiles and handles stuff like your two-tile high walls.

So my advice is to do the tiling by code. First generate the level floor map, then do the tiling.

Yeah, I’m overthinking this way too much, sounds pretty straightforward! It’s just that whenever I see tilemaps like this, I’m always going “Can I autotile this?”