Is autotiling possible using just the edges in the autotiling bitmap?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By hanke

I’m currently using the standard Godot autotiling bitmap:


Problems for me are that when I want players to not fall off the platform, I need to draw complex concave colliders and not all walkable tiles have the same area that is walkable.

However, I’d prefer if tiles were generally depicting the edges of the terrain, like so:

This has the advantage that the colliders would be super simple (just a square for each edge tile), blocking players from falling off the platforms. Also, all walkable tiles (just one, tile index x = 1, y = 1) would be the same size, square.

The issue seems to be that Godot is not evaluating the tiles around placed autotiles, so that bitmap rules which just contain, e.g. the corner, do not cause e.g. tile x = 0, y = 0 to be placed.

Is there a way Godot can do this out of the box, or would I have to implement this myself?

Manually placed this tileset works:

P.S: Just noticed a little error - tile x = 1, y = 1 should have a bitmap with just one red dot in the middle (and x = 6, y = 3, the single tile cannot exist). But with that fixed, it still appears to not evaluate tiles around placed autotiles.

:bust_in_silhouette: Reply From: exuin

The way bitmasks work is that a tile MUST have the center bit selected in order to be used. If you want to use your bitmask, you’ll need to implement custom logic yourself.

I’m also not sure how your proposal will make drawing collision shapes easier. You’ll still have to draw the same collision shapes, but in a different arrangement.

The way bitmasks work is that a tile MUST have the center bit selected in order to be used. If you want to use your bitmask, you’ll need to implement custom logic yourself.

Thanks – how could I implement custom logic myself? Can’t find much in the way of how to trigger autotiling for surrounding tiles. I assume it’s probably best to just leave it to Godot.

I’m also not sure how your proposal will make drawing collision shapes easier. You’ll still have to draw the same collision shapes, but in a different arrangement.

It’s possible that I am totally off on this one, so let me explain.
I’d like the player to not be able to go off the platform, so in the standard way of autotiling I’m adding concave colliders:
concave collider

While in the other way I can just use simpler convex collider shapes:


On average, I have to place about half of the corners for the second way of doing things per tile.
Does that help or am I overcomplicating things for the standard case? Is there another solution like testing e.g. pixels under a player’s feet?

P.S: This appears to be possible with the upcoming terrain system.

hanke | 2021-04-30 14:18

Yeah I’m not really sure how to implement custom autotiling logic since I’ve never done it before. But I see what you mean about the collision shapes now. Yeah, tilemaps will get a lot better in Godot 4. Nothing to do but wait…

exuin | 2021-05-12 20:21

In code, I can just add 4 additional tiles around the placed tile in a cross shape to get what I want, but not yet in the editor, so will wait for Godot (4). Cheers!

hanke | 2021-05-13 13:00