Multiple Wang IDs or Terrains per tile

I like to design my tiles to be versatile, so that e.g. the side of a terrain can also serve as a corner, or may perhaps work for multiple types of terrain. Tiled makes working with such minimalistic tilesets very inconvenient, as there’s no way to define a particular tile as fulfilling multiple roles, and there are fewer tiles than are required for a particular terrain/Wang set, making those tools produce incorrect (or even glitchy) results. If one could assign multiple terrain or Wang patterns to a tile, that would solve the problem.

I imagine the UI for this is quite difficult. Perhaps an per-tile editor akin to the Tile Animation Editor would work, but with terrain/Wang patterns instead of frames.

The AutoMap feature can do this work, but having a way to do it without it would be much more convenient, especially for tilesets with a lot of variants of functionally identical tiles. Since technically my suggestion doesn’t add new functionality to Tiled and requires a bunch of UI work, I understand that it would be very low priority.

(Related problem: the Wang and Terrain tools don’t support flipping tiles or other transformations. I believe that’s already been brought up though.)

1 Like

Please see this related discussion:

In particular, in my last comment I tried to explain why multiple terrain patterns on a single tile can’t work:

It’s not possible because Tiled does not store terrain information on the map. The tool derives from the tiles that are placed the terrain at each location, which would not be possible if a tile is shared between multiple terrains.

I think with the current system we don’t get around to duplicating the tile in this case.

But now that you brought it up again, I think it could work, if it would be somehow possible to search for matches based on multiple options. Using bitflags for example, though the limit of 255 different terrain types is a bit high for mapping that directly to bitflags.


I see the difficulty. I hadn’t thought about the fact that the tools work based on just the tiles in the map and don’t have access to the metadata that may have been used to place them.

It seems like my best bet is to keep using Tiled primarily for placing objects and details, and leave the heavy lifting of creating the bulk of the game terrain to external tools. Serves me right for making weird tilesets :D

1 Like

Right, so another solution, as you imply, would be to introduce a new layer type specifically for terrain, where we store the metadata from which the actual tile layer is derived. This technique is often used when using AutoMapping as well. It’s not without a few drawbacks, but could also be considered.

Is it not an option to help with extending Tiled to do what you need? What other tools do you already have available or are you planning to develop?

I don’t think my tools would work with Tiled’s general approach, as most of them generate map pieces randomly/semi-randomly, and those that don’t rely on inputs that would probably not be practical in Tiled. But, I’m always happy to talk about my silly tools, especially if they might help provide reference or inspiration for Tiled :D

Level generator

Builds platforms based on sketches. I wrote this because I wanted to be able to just “draw” my sloping terrain instead of pasting groups of tiles or defining end-points for AutoMap, as that’s a huge hassle when you want frequently changing slopes. It currently works with an image; ideally I’d like to add an editor to skip the importing step and speed up iteration, but I’m worried it would take me longer to implement that then it would save time. This tool also adds collision tiles on an extra layer (I use special tiles to define collision because Tiled’s collision tool doesn’t work well for my game, as any given ground tile may be either solid ground or a one-way platform, and some wall tiles may have collision in one area and no collision in another, and there’s no reliable way to tell based on the final tilemap).
This tool requires tile labelling, which works similarly to Tiled’s terrains, but with 8 points of interest rather than 4, allowing for easier slope definitions. Each tile label also optionally includes the shapes of required tiles above and below, so each tile has 24 points defined in total. This post from a couple of years ago has more info, including screenshots of some of the labels (Ctrl+F for “Procedural Generation” to skip past the irrelevant parts).

Tree generator

Makes random trees. Requires definitions of trunk tiles, (for spruces and pines) branch tiles, and (for birches) leaf tiles. Trunks and branches have defined thinknesses that are used by the generator to make natural tapering, and leaves have a 4-bit shape definition very similar to Tiled’s terrains, except they’re matched to a “plan” of leaves rather than just to neighbouring tiles, and a given tile may match multiple patterns. The post linked above has some more (old) screenshots and a description of how some of it works. There’s also a description of how I set up parallax layers in Tiled in there, in case you’re interested.

Background terrain generator

Makes a random 1D heightmap and then builds a terrain to match using tiles. I use this to fill in the ugly platform edges made by the level generator. Requires definitions of tiles’ shapes (flat ground, slope sections, cliffs, etc). More screenshots and explanation here. I’d like to make a version of this tool where the user can create the heightmap themselves by moving points around, or perhaps allow importing the sketches used by the level generator and build terrains based on those.

I also have a “fader” tool which takes a Tiled JSON map, detects terrain or tree tiles in it, and replaces them with lighter “background” versions. My tileset is laid out so that these alternative versions have the same layout as the “foreground” versions, so it’s just a matter of adding an offset to the tile ID for each tile that’s detected to be within the relevant part of the tileset.

(Edit: Almost forgot this one.

It’s based on the tree generator and makes splotches of rock texture. I’d have much preferred to use these tiles as a terrain in Tiled, but because many of the tiles serve multiple roles, it just didn’t work well.)

All of these tools allow saving Tiled JSON maps. The level generator also prepares parallax layers and some other engine-specific stuff for me, and its output maps serve as my base maps. The trees and background terrains get pasted into the maps as needed.

If there’s anything in here you think might be useful for Tiled, I’d be happy to share and help.