Help autotiling different terrains

Godot Version



Hello everyone, I’m just starting using Godot for the first time, and I’m trying to perform autotiling with two different terrains, called “WALLS” and “EXTWALLS”, but I can’t quite make the sides of the two terrains connect automatically… The following image should explain the issue.

As you can see, I’m trying to connect automatically the EXTWALLS terrain with the WALLS terrain (which works just fine, btw), but Godot picks “sprite2” even if “sprite1” should be (to my understanding) the more plausible one, requiring a WALLS terrain on its left. I also tried to set the probability of the 4 top-left sprites to 0.0 and the bottom 4 to 1.0, but it doesn’t work as I want. Maybe there’s something I’m not fully understanding about autotile and bitmasks. Any help is highly appreciated <3

Terrain tiles match by peering bits, not center bits. So this is expected behavior since the empty peering bit in your sprite 2 matches the wall tile’s empty peering bit. This is actually a deceptively complicated situation. If Godot chose the wall tile that matched sprite 1, it would be a center tile, which is probably not what you want either.

You’ll need an addon like Better Terrain to do what you want reliably. My plugin terrain autotiler can also do this with alternative terrains, but it’s more of a prototype, so Better Terrain will have better longer term support.

More info about how terrain tiles match can be found here.

Edited to add: You can come up with a more complex configuration (with alternative tiles and a third terrain) to have matching peering bits that, in theory, would match the way you want. However, then you run up against two core limitations in Godot’s algorithm: (1) it doesn’t match deterministically, so it will choose different tiles depending on other factors like the order you draw them on the TileMap, and (2) you still need the tiles with empty peeting bits for other situations, and there is no way to manually control the priority of which peering bits get chosen. This is why I say a plugin is required.

1 Like