20.7 C
New York
Monday, August 4, 2025

godot – How would I bitmask these tiles?


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

As talked about within the Godot documentation on tile maps, autotile 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 might have 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:

  • for our functions i ought to all the time 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 need 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 need to use that tile if we’re inserting 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 lengthening that to the remaining tiles, offers the next:

bitmask for all the house parts

The entrance & again partitions are doubtlessly 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, considered one of them might be chosen randomly, utilizing the tile priorities.

So that is going to return down to private desire. You possibly can embody the window wall into the autotile guidelines & Godot will randomly resolve 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 all the time use plain partitions and it could be as much as you to manually add window partitions have been desired.

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

┌──┐
│ ┌┘ 
└─┘

You would want 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, the whole lot besides e) in order that it could possibly be used as follows:

L shaped house with custom corner

Word: 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), but it surely’s as much as you to make sure your use respects the writer’s license. I solely checked the freely out there sprite pack; it is attainable that the paid model already consists of the additional sprites for all attainable home layouts.

The roof tiles are extra sophisticated 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 correct. 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 need 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 possibly can then change between roof teams as wanted. Nonetheless, by itself, this provides you with a format that has a bizarre double seam the place the 2 set meet (proven under on the left). To right that, it is advisable change off the autotiling & manually place in a row that joins the 2 (proven under on the correct).

double seam roof & corrected roof side-by-side

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

The remaining components (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