Autotile Generator (Blob 47)

Build a complete terrain autotile set from a tiny 5-tile template. Preview it on a random map, then export the tileset PNG and a bitmask lookup table for your engine.

Drop a 5-tile template here (5 tiles in one row), or click to choose a file.
Not sure what that is? Load a sample template or download it to draw over.

Template order: 1 isolated · 2 vertical · 3 horizontal · 4 inner corners · 5 fill

How to make an autotile tileset

  1. Draw a 5-tile template in your pixel editor. Use one row of five square tiles with an even size such as 16, 24 or 32 px. The tiles must be in this order: isolated, vertical, horizontal, inner corners, fill.
  2. Drop the template above. You can also click Load a sample template to see the format, or download the sample and draw over it.
  3. Check the random preview map. Every edge and corner should join cleanly. If something looks off, fix that quarter of the matching template tile.
  4. Export the tileset PNG and the bitmask JSON, or both as a ZIP.

Using the tileset in code

// tileset.json from this tool
const BITS = { N: 1, NE: 2, E: 4, SE: 8, S: 16, SW: 32, W: 64, NW: 128 };
function tileFor(map, x, y) {
  const same = (dx, dy) => map[y + dy]?.[x + dx] === map[y][x];
  let m = 0;
  if (same(0, -1)) m |= BITS.N;   if (same(1, -1))  m |= BITS.NE;
  if (same(1, 0))  m |= BITS.E;   if (same(1, 1))   m |= BITS.SE;
  if (same(0, 1))  m |= BITS.S;   if (same(-1, 1))  m |= BITS.SW;
  if (same(-1, 0)) m |= BITS.W;   if (same(-1, -1)) m |= BITS.NW;
  return tileset.lookup[m];       // index into the tileset PNG
}

The tile at index i is at column i % columns and row floor(i / columns) in the PNG. The JSON also lists each tile's pixel position.

Engine notes

Why only 5 tiles?

Each tile corner only depends on three neighbors: the two sides next to it and the diagonal between them. That gives just five possible corner shapes. If you draw each shape once, in all four corners of a template tile, the generator can assemble every one of the 47 combinations.

This is the same quarter-tile method classic RPG engines used for their autotiles.

FAQ

What is a blob 47 tileset?

A terrain tileset that covers every way a tile can connect to its 8 neighbors once irrelevant corners are ignored. 256 neighbor combinations reduce to exactly 47 distinct tiles, including inner corners, so terrain edges always join cleanly.

How should I draw the 5-tile template?

Put five tiles of equal, even size in one row: 1) an isolated island with edges on all sides, 2) a vertical piece open at the top and bottom, 3) a horizontal piece open at the left and right, 4) a fully filled tile with inner-corner notches in all four corners, 5) a plain fill tile. Load the sample to see an example.

How does the generator build 47 tiles from 5?

Every output tile is made of four quarters. For each quarter it looks at the two side neighbors and the diagonal neighbor and copies the matching quarter from your template: isolated, vertical, horizontal, inner corner or fill.

How do I use the JSON in my game?

For each map cell, add up the bit values of its neighbors that have the same terrain (N=1, NE=2, E=4, SE=8, S=16, SW=32, W=64, NW=128). Use that number as an index into the lookup array to get the tile index.

When should I use the 16-tile set?

If your engine or game only checks the four side neighbors. It has no inner corners, so diagonal gaps are drawn as filled. Use Blob 47 when you want clean inner corners.

Is my template uploaded?

No. Everything is generated locally in your browser.