2D Tileset Terrain in Godot 4

godot 2d tutorial


As part of the tileset overhaul, Godot 4 replaced autotiles with a new tileset terrain feature. It makes it a bit of a pain to upgrade a tileset based project, but the end result should be a lot better.

Unfortunately, the docs don't yet cover this in detail, so I had to do a bit of trial and error to figure it out.

Setting up the Terrain

For this example, I'm recreating a simple 2x2 tileset autotile, meant to draw clouds/fog.

In godot 3, it would have had a bitmask that looked like:

godot 3 version of the autotile bitmask

The tile atlas I'm using for this example is in fact based on this image.

It ends up being the same general shape directly in the tileset terrain editor. The biggest gotcha here is that it's still a 3x3 bitmask inside each of the tiles, and the only tile with that center bit set is the fully-filled one.

Here's what it looks like:

Example terrain replacing a 2x2 autotile

Drawing with the Terrain

Drawing with the terrain is easy enough at this point! There's a few different options:

Note the eraser icon at the top; you can toggle that on or off to clear our tiles quickly. I kept forgetting to toggle it back to drawing mode.

Example painted output from tileset terrain

Other modes

I haven't tried the other modes yet, but hopefully this guide helps someone out!