1
\$\begingroup\$

I am using Cup Noobles's Sprout Lands asset pack for my small game. I want to use the wooden house tileset, but I am confused about how to set up its Autotile bitmask in Godot. How can I achieve this?

Example tiles

\$\endgroup\$
2
  • 1
    \$\begingroup\$ It's not clear to me what you're trying to do with the tiles & their bitmask. Do you mean the bitmask used by the Autotiles or something else? \$\endgroup\$
    – Pikalek
    Commented Feb 2, 2023 at 14:30
  • \$\begingroup\$ @Pikalek yes that is what i meant! \$\endgroup\$
    – josie
    Commented Feb 3, 2023 at 3:09

1 Answer 1

3
\$\begingroup\$

The tileset shown isn't well suited to autotile. Some parts work ok, others somewhat, and some not at all. The nine house tiles are the best suited to autotile, so we'll start with those.

As mentioned in the Godot documentation on tile maps, autotile uses a set of rules to determine which tile to draw based on the content of adjacent cells & the bitmask patterns assigned to the tiles. The modes for the autotile are: 2x2, 3x3 (minimal) and 3x3.

The tiles you have are designed for 3x3 (minimal) (as indicated on the download page), so I'm only addressing that here. Here's an illustration of how the 3x3 (minimal) rules work:

3x3 (minimal) diagram

  • for our purposes i should always be on if there's an automap tile
  • for the other bitmask positions:
    • if there's a required neighbor at X then x is on
    • otherwise it is off

If we apply that to the house tiles, we want to select brick floor when we place a tile surrounded by all eight other tiles:

diagrammed house floor tile

That means the brick tile has all of its bits masked.

Compare that to the upper right corner of the house. We only want to use that tile if we're placing a tile that has neighbors in positions H, G & F:

upper right corner of house diagrammed

So the bitmask for the upper right corner tile would mask bits: h,i,g,f

And extending that to the remaining tiles, gives the following:

bitmask for all the house parts

The front & back walls are potentially a special case because there is a solid version & a version with a window. That means they could both have the same bitmask pattern. But the documentation says the following about this situation:

If more than one matching bitmask is found, one of them will be selected randomly, using the tile priorities.

So this is going to come down to personal preference. You could include the window wall into the autotile rules & Godot will randomly decide which to use and you will have to manually change anything you don't like afterward. Or you could leave it out of the autotile rules. In that case Godot will always use plain walls and it would be up to you to manually add window walls were desired.

Note that the house tiles in your post don't account for all possible tiling situations. Specifically, they don't provide the tiles necessary to make concave structures. For example to make a house with this outline:

┌──┐
│ ┌┘ 
└─┘

You would need to make a tile that looks like this:

customed house corner tile

That tile would be masked on a,b,c,h,i,d,g,f (or put differently, everything except e) so that it could be used as follows:

L shaped house with custom corner

Note: the license on the free pack prohibits me from distributing derivative works of the sprites, so I'm not going to make & post the actual variants. I free handed that special corner hand to look deliberately bad. If you need variants, it's relatively easy to make better ones using an image editor (Photoshop, Krita, Paint.net, etc), but it's up to you to ensure your use respects the author's license. I only check the freely available sprite pack; it's possible that the paid version already includes the extra sprites for all possible house layouts.

The roof tiles are more complicated because their placement depends not only on whether or not they have neighbors, but also which neighbors they have. For example, consider these two groups of tiles:

up facing roof down facing roof

As far as bitmasking goes, they group on the up facing group (shown on the left) has the same rules as the down facing group. We know than the ones on the left "go together" & as do the ones on the right. But autotile only uses the bitmasking. As mentioned before, duplicate bitmasking patterns results in random tile selection. So if We try to autotile all the roof parts, autotile will give us a randomize mess.

If want to autotile them, I would consider making one set of tiles for upward facing shingles and another for south facing shingles, as follows:

upward roof mask

downward roof mask

You can then switch between roof groups as needed. However, by itself, this will give you a layout that has a weird double seam where the two set meet (shown below on the left). To correct that, you need to switch off the autotiling & manually place in a row that joins the two (shown below on the right).

double seam roof & corrected roof side-by-side

It's up to you to decide if it's worth the inconvenience.

The remaining elements (the door tiles & the chimney) don't make sense to autotile at all. Stamp them in as needed.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .