Tuesday, July 29, 2025

godot – How would I bitmask these tiles?

The tileset proven is not properly suited to autotile. Some elements work okay, others considerably, and a few by no means. The 9 home tiles are the most effective suited to autotile, so we’ll begin with these.

As talked about within the Godot documentation on tile mapsautotile makes use of a algorithm to find out which tile to attract based mostly on the content material of adjoining cells & the bitmask patterns (often known as peering bits) assigned to the tiles. The modes for the autotile are: 2×2, 3×3 (minimal) and 3×3.

The tiles you’ve gotten are designed for 3×3 (minimal) (as indicated on the obtain web page), so I am solely addressing that right here. This is an illustration of how the 3×3 (minimal) guidelines work:

3x3 (minimal) diagram

  • for our functions i ought to at all times be on if there’s an automap tile
  • for the opposite bitmask positions:
    • if there is a required neighbor at X then x is on
    • in any other case it’s off

If we apply that to the home tiles, we wish to choose brick ground after we place a tile surrounded by all eight different tiles:

diagrammed house floor tile

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

Examine that to the higher proper nook of the home. We solely wish to use that tile if we’re putting a tile that has neighbors in positions H, G & F:

upper right corner of house diagrammed

So the bitmask for the higher proper nook tile would masks bits: h,i,g,f

And increasing that to the remaining tiles, provides the next:

bitmask for all the house parts

The entrance & again partitions are probably a particular case as a result of there’s a strong model & a model with a window. Which means they might each have the identical bitmask sample. However the documentation says the next about this case:

If a couple of matching bitmask is discovered, one among them shall be chosen randomly, utilizing the tile priorities.

So that is going to come back down to private choice. You would embrace the window wall into the autotile guidelines & Godot will randomly determine which to make use of and you’ll have to manually change something you do not like afterward.
Or you might go away it out of the autotile guidelines. In that case Godot will at all times use plain partitions and it will be as much as you to manually add window partitions had been desired.

Notice that the home tiles in your submit do not account for all doable tiling conditions. Particularly, they do not present the tiles essential to make concave constructions. For instance to make a home with this define:

┌──┐
│ ┌┘ 
└─┘

You would wish to make a tile that appears like this:

customed house corner tile

That tile can be masked on a,b,c,h,i,d,g,f (or put in a different way, every thing besides e) in order that it may very well be used as follows:

L shaped house with custom corner

Notice: the license on the free pack prohibits me from distributing by-product works of the sprites, so I am not going to make & submit the precise variants. I free handed that particular nook hand to look intentionally dangerous. For those who want variants, it is comparatively straightforward to make higher ones utilizing a picture editor (Photoshop, Krita, Paint.web, and so on), nevertheless it’s as much as you to make sure your use respects the writer’s license. I solely checked the freely accessible sprite pack; it is doable that the paid model already consists of the additional sprites for all doable home layouts.

The roof tiles are extra difficult as a result of their placement relies upon not solely on whether or not or not they’ve neighbors, but in addition which neighbors they’ve. For instance, take into account these two teams of tiles:

up facing roof
down facing roof

So far as bitmasking goes, they group on the up going through group (proven on the left) has the identical guidelines because the down going through group. We all know than those on the left “go collectively” & as do those on the suitable. However autotile solely makes use of the bitmasking. As talked about earlier than, duplicate bitmasking patterns leads to random tile choice. So if We attempt to autotile all of the roof elements, autotile will give us a randomize mess.

If wish to autotile them, I might take into account making one set of tiles for upward going through shingles and one other for south going through shingles, as follows:

upward roof mask

downward roof mask

You may then swap between roof teams as wanted. Nonetheless, by itself, this will provide you with a structure that has a bizarre double seam the place the 2 set meet (proven under on the left). To appropriate that, you might want to swap off the autotiling & manually place in a row that joins the 2 (proven under on the suitable).

double seam roof & corrected roof side-by-side

It is as much as you to determine if it is definitely worth the inconvenience.

The remaining parts (the door tiles & the chimney) do not make sense to autotile in any respect. Stamp them in as wanted.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles