Starting with Tiled 0.9.0, a new tool was added that makes it easier to edit terrain transitions in tile maps. There are many ways to handle terrain transitions between tiles in a tile map, but Tiled’s terrain tool supports transitions between tile graphics whose corners are all well-defined, which is also the most common approach.

Now let’s demonstrate how to use this tool and the steps for setting up terrain information, by working through the desert.tmx that ships in the example directory of the Tiled installation package.

Creating a new tile map and tileset

  1. Create a new map with a tile size of 32x32:

tiled-terrain-1

  1. Map -> New Tileset. As shown, add tmw_desert_spacing.png from the example directory as a new tileset. Set the margin and spacing to 1 pixel (used here just for testing, not a recommendation).

tiled-terrain-2

This tileset has 4 different terrain types. The traditional way of editing a map means you have to carefully connect the right transitions to avoid making a mess of the seams. But we’re now going to define terrain information from the tileset, and the terrain tool will automatically recognize and place the correct transitions between terrains.

Defining terrain information

  1. Click the small “Edit Terrain Information” button

tiled-terrain-3

  1. This dialog shows the list of terrain types in the tileset and lets you mark the corners where tiles belonging to each terrain type meet. Let’s get started. First add the 4 terrain types. The fastest way is to right-click on the tile that best represents a given terrain and choose “Add Terrain Type”. This automatically sets that tile as the image for that terrain.

tiled-terrain-4

  1. Give each terrain a suitable name. When you’re done, select the sand terrain and then mark all the corners on the tiles that this terrain should have. When you’re finished it should look like this: tiled-terrain-5

  2. If you paint a corner wrong along the way, you can undo it or erase the wrong corners with the eraser tool. Define each of the 4 terrains this way. In the end you’ll have marked all the tile parts for each specific terrain.

tiled-terrain-6

Now close the dialog and you can start trying out the terrain tool.

Editing with the terrain tool

Switch from the Tilesets window to the Terrains window. You’ll see the 4 terrains. Click sand and start painting, and you’ll immediately notice that nothing special happens. That’s because there are no other tiles on the map yet, so the terrain tool doesn’t know how to help (since our tileset has no transition to the “empty” terrain). In that case, we’re better off filling the whole map with sand first. Switch back to the “Tilesets” window for a moment, select the sand tile, and use the “Fill” tool.

Let’s switch back to the Terrains window and paint some terrain. Now you can see it working!

tiled-terrain-7

Holding down the Command key while painting shrinks the paint area (9 tiles by default, 4 tiles when shrunk) down to the one corner closest to the cursor position, which is handy for fine adjustments.

tiled-terrain-8

As you can see in the image above, when you paint cobblestone inside the “dirt” terrain, since there’s no direct transition between the “dirt” terrain and the “cobblestone” terrain, the terrain tool inserts a sand terrain transition between the two. Nice.

Final notes

By now you should have a good idea of how to use the terrain tool in your own projects. There are a few more things to keep in mind:

- For now, this tool requires all the tiles for every terrain type to be in the same tileset. You can have many tilesets with terrain, but the tool can’t automatically provide terrain transitions across tilesets. This means you’ll usually need to merge several tilesets into a single image. - Tilesets added via Tiled’s “Add External Tileset” currently have terrain information that can’t be edited. If you need to edit it, you can import the tileset first, edit it, and then export it again. - The terrain tool also works for isometric maps (but not for staggered isometric maps), however, the “Edit Terrain Information” dialog currently doesn’t render the overlay indicators correctly for their tiles. You have to picture it in your head: the top-left corner applies to the top, the top-right corner applies to the right, and so on. If in doubt, see the “isometric_grass_and_water.tmx” file in the example directory. - The tool handles any number of terrain types, and each tile corner can have a different terrain type. For transitions this tool can’t handle, there are still other ways to deal with them. Also, editing multiple layers at once isn’t possible. For a more flexible but also more complex approach to automatic tile placement, check out “Automapping”.

Tiled maintains some tilemap tilesets on OpenGameArt.org that include transitions and are compatible with this tool.

The original English source for the above is “Using the Terrain tool“.