+1 vote

I'm new to Godot but I got really interested in trying some advanced stuff with the autotile feature. From watching tutorials I became somewhat familiar with how the bitmask works, but there is something I'd like to do that I just can't even imagine how from what I've seen:
Having different types of terrain/background interact with one another through the autotile system, something like...
Imagine that the background of the autotile is just transparency. Now imagine there are some jungle stone temple blocks, as well as some jungle grass/dirt blocks and both have their own autotile system telling them which sprites to use for which shapes and such, regular autotile stuff.
But how do I make it so that the stone blocks interact with the grass and dirt?

I know there has to be some way because Terraria seems to do this well enough, while it's not perfect, you can still have something like the stone blocks inside the dirt and it behaves like a whole new autotile:
enter image description here
enter image description here
I searched for advanced tutorials and in the documentation, but I didn't really find anything on this. Then I tried some thought experiments involving inverted bitmasks, and pairs of bitmasks without the center square that match each other's normal bitmask, but since I couldn't wrap my head around it really well and I had no clue if there was a way it would even work, I decided it was best to just ask.

Any help is greatly appreciated!

in Engine by (13 points)

1 Answer

0 votes

Well shucks, I can't believe nobody chimed in here.

So what you're looking for is a non-binary bitmap or tilemap. Godot has only the binary version built in which means you either have tile, or no tile. Does not play well with multiple types of tile. You probably won't find much on it because the solutions are varied, depends heavily on your art, they're not intuitive, and they require a lot of tinkering to get how you want it to look. Fixing problems with them can often either be done by the artist, or by the code. It's really crappy to make a tutorial for. So, just to make sure we're on the same page. I am currently using 2x2 autotile bitmasks, my artwork purposely extends half the width of my tiles, I am not using angles, it's all squares. Basically, I'm making a top down map with multiple biomes using a a tileset like this Basic biome tileset

The first thing you have to accept is that if you're going to do this you need, at minimum, four layers of tilemap. Because at any point, 4 different biomes "or blocks, or whatever" are going to meet in a corner and if you want things to look nice and "spill" into the tiles next to them they have to overlap.

The way I have been tackling this is basically imagine your grid that you already have, and make a second "artwork" grid (4 layers deep), and shift it, down and to the right, half a tile. This makes it so that every tile in your main "grid" overlaps 4 "artwork" tiles. When you change a tile in your main "grid" You're going to change the corner of each "artwork" tile you're overlapping to make one complete tile. If you start filling out your artwork tiles and you find something already there, just move to a higher layer of artwork node.

I highly, highly recommend getting real warm and fuzzy with tilemaps. Specifically how autotiling actually works. This link https://michagamedev.wordpress.com/2018/02/24/181/ is a fantastic dive on how the logic of autotiling actually operates.

by (82 points)
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 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 webmaster@godotengine.org with your username.