How to randomly chose between several viable tiles? (Wang method, Terrain method)

(Geoffrey Mégardon) #1


I am playing with Tiled and the Terrain and Wang methods.
I have made a small tileset here:


You can see that to avoid repetition, I made several viable tiles for the borders.

However, when I use the Wang method tool, I am getting that:

Basically, the Wang Brush does not use all the viable solutions and only one border is repeated over and over.

Is that a normal behaviour? is there an option that I did not see?

(Geoffrey Mégardon) #2

No answer yet :confused: maybe I did not explain well my problem?

What I meant is that, for instance, I have two tiles that can be used as a bottom edge:

However, when I use the Wang Brush, the tool only used one of these tiles:

Is there a way to make the brush randomly select between the two possible bottom edge tiles?

Hope this makes it clearer :slight_smile:

(Thorbjørn Lindeijer) #3

No, I just fell ill and am lagging behind in responding to messages. Also, even when not sick I do still have “only” two days per week for Tiled stuff, so a reply can always take a few days.

Actually I’m a little surprised by your question, since this is supposed to just work. It may be that you have found a bug, but I can’t reproduce it. If I use the Wang Brush on the isometric_grass_and_water.tmx map, I can definitely see it picking randomly between the two available variations for the straight edges.

The probability of choosing one variation over another can be configured per Wang color and per tile. By default this probability is 1, which should give all tiles the same chance to appear. You did not somehow by accident put it on 0 for your tiles or Wang colors?

Which version of Tiled are you using exactly and maybe you could upload a zip of your assets. When the example map works but somehow your own assets do not, then they may help me reproduce the issue.

(Geoffrey Mégardon) #4


I am sorry if it sounded as if you were too slow to answer ^^ I did not mean that; in fact I was not expecting that you, specifically, would answer. I am also working part-time in fact :slight_smile: so I understand perfectly your time constraints.

Anyway. Here are example files:
example-forum.tmx (3.8 KB)
walls_tileset.tsx (1.6 KB)

Concerning the probability of occurrence, when I am in the Wang Set Editor, it is not straightforward how I can just select a tile (there is no selection tool ^^, maybe worth a feature request?), so I ended up using the right-click to select a tile and see its probability, they all seem to be at 1.

I just updated my version of Tiled, so it is 1.1.3 (I think I was 1.1.2 before), the issue persists when using the files attached.

(Thorbjørn Lindeijer) #5

I really appreciate that others sometimes try to answer questions here, but it’s a bit rare unfortunately. Anyway I shouldn’t have assumed it was addressed to me personally. :slight_smile:

Please upload a zip file with a complete set of files. Maybe I don’t need holes_tileset.tsx, but it would certainly be useful to have walls_tileset.png.

Right, selecting tiles to edit their probability is easier when you toggle off the Wang Sets mode. Then you can just select tiles, and you can also select multiple to change the probability in one go.