Random Grass etc - Best method?

Hi All,

I am pretty new to Tiled so just want to see if there is a way I can get what I want going.

I can see in the Terrain editor you can add percentages, so thought I could create a terrain with several Mixed Types set.

Basically I want to have 10 different grass variations and when I use fill or paint etc it picks one of them out of the list. That works great as all share the same chance of being picked. But I want my base grass to be picked 90% of the time, and then the rest to be less common so it doesn’t look cluttered.

I read the docs and watched a few YouTube videos but most of them just talk about grass vs path type setups.

Thanks for any insight.


Are you talking about picking particular grass tiles (e.g. you have a base grass tile and some more detailed cosmetic variants of it), or different grass terrains (e.g. you have entire sets of different grass tiles, such as a light green grass and a dark green grass, and you want a random one to be chosen but then used consistently from then on)?

If you mean random tiles: You can set probabilities on individual tiles as well, not just on terrains. Then, any time you use those tiles in a situation where random tiles are selected (e.g. with Random mode on the Brush or Bucket Fill tool, or with Terrains where these tiles have the same labels), the tiles will be selected taking their probabilities into account. So, you’d label all your different tiles with the same terrains as if they were entirely interchangeable, and set those tiles’ probabilities so favour the tile(s) you want used most commonly.

I couldn’t see a way to set probability on the tile itself. Could see the value but not change it. As you mentioned it I checked again and had the terrain tool set on tile editor page. When I changed to the “4 arrows” it let me edit it.

Thank you! :smiley:

Now I just wish I could get it working on the terrain one as the tileset I have been given has 4 different types of grass that I don’t want to mix, so terrain lets me opt into a more specific list lol

You should be able to do that. Label the unmixable grasses as different Terrains.

Once I got the percentage working on the tile itself everything worked as expected. Perfect, thank you so much!

I should note, the probability on tiles is not a percentage. It’s a weight. The actual probability of the tiles depends on the total probability values of the tiles involved in the random selection. For example, if Tiled is picking between two tiles, one of which has probability 10 and the other has probability 1, then the first tile will be picked with 10/(10+1) = 91% probability. If Tiled is picking between three tiles that all have probability 10, then they will all have an equal chance to be picked.