This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I'm following this tutorial:

He makes a grass tileset using four tiles and assigns each equal priority of 1/4.

But when he paints the map using the grass tileset, note how at the boundaries of the map every tile uses the same sprite with blades of grass, ignoring the priorities. The inside of the map behaves as expected, with a mix of tiles.

How do I get the edge of the tileset to obey the priority distribution the way the inner tiles do?

in Engine by (15 points)

I have a better solution for you.

You can use atlas mode and enable priorities. I found the answer here.

enter image description here

1 Answer

0 votes
Best answer

The reason that's happening is because the tiles on the edges don't have any matching bitmask tiles. When that happens, it defaults to using whatever tile you have set as the icon tile.

A better way to have that effect would be to also create bitmasks for the edge tiles, so rather than be filled in by default, you can actually set those tiles yourself.

by (449 points)
selected by

I'm not sure what you mean by your second paragraph. All tiles in the tileset have bitmasks already, edge or no. Sure, I could manually place the edge tiles, but that defeats the point of an autotiler, no?

Really what I want is a way to ignore bitmasks entirely. That grass tileset shouldn't care about what surrounding tiles are, it should just pick a tile at random.

Bitmasks work by trying to match colour to colour, and non colour to non colour. In the example you gave, the only bitmasks that were marked for the grass tiles were:


Which means they'll only be selected as an appropriate tile when surrounded by tiles on all sides. Edge tiles will look like this (on a 2x2):

[ ][ ]      [X][ ]      [X][X]     [ ][X]
[X][X]  OR  [X][ ]  OR  [ ][ ]  OR [ ][X]

When the autotile goes to place an edge tile, it checks for the appropriate bitmask. If it doesn't find any that fit, which in this case it won't, it instead selects whatever the default, icon tile is set to.

If I'm creating an autotile where I want the edge tiles to be the same as the middle tiles, I use 5 of the same image. One for the middle, and one for each of the four edges. If I want to have multiple, random middle tiles, then I'll just add more, different images, and set their bitmask to the "middle" setting, aka the first one I wrote.

Ok, so it sounds like TileMap can't do what I want it to do without a large number of copies of every tile in my tileset. That's unfortunate. Thanks for your explanation.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.