Skip to content

Auto-tile 47

Generate the 47-tile auto-tile sheet from a single source tile. The 47 configurations cover every meaningful combination of 8 neighbour cells in a tilemap, so an engine that consumes the sheet (Godot, Tiled, RPG Maker, Phaser) can pick the right tile to draw automatically as the player paints terrain.

The result is a structural starting point. Configurations that differ only by a diagonal neighbour will produce visually-identical auto-generated tiles — refine each by hand to make them all distinct.


Where to find it

Frames timeline header → Grid2x2 icon (next to the Sparkles button for frame interpolation).


Source requirements

The active frame is the source tile. It must be:

  • At least 2×2 pixels (algorithm needs to split into 4 quadrants).
  • Even width and height (so the split is clean).

Recommended: a 16×16, 32×32, or 64×64 tile that represents what a fully-surrounded cell looks like — terrain with no edges.


How it works

Each of the 47 output tiles is composed of 4 corner quadrants. Each corner is classified into one of 5 types based on the neighbour mask:

TypeWhenOutput for that quadrant
InnerBoth adjacent cardinals AND the diagonal are setFull source quadrant
ConvexBoth adjacent cardinals set, diagonal notSource quadrant minus a small triangle at the corner
Side-HOnly the horizontal cardinal (E or W) setSource quadrant minus a thin strip on the vertical edge
Side-VOnly the vertical cardinal (N or S) setSource quadrant minus a thin strip on the horizontal edge
OuterNeither cardinal setTransparent

The dialog generates all 47 in a single click and previews them in a 12×4 grid.


Output

When you click Generate, the editor:

  1. Computes the 47 tiles.
  2. Creates a new project named "Auto-tile 47" (or "Auto-tile 47 (transition)" with a second source) with the same canvas size as the source.
  3. Adds 47 frames (one per tile), naming them Tile N (mask 0xMM).
  4. Creates a sprite "Auto-tile 47" containing all 47 frames in order.
  5. Switches to the new project and filters the timeline to that sprite.

Your original project is not modified — it stays in IndexedDB at the previous slot.

To export: File → Export → Sprite sheet (with JSON metadata). Engines that consume Aseprite-format JSON read the result directly.

Multi-source transitions

Pick an outside source in the dialog to generate a transition tileset between two terrains (e.g. grass-to-dirt, water-to-sand, lava-to-stone). Instead of leaving the "outside" zones of each tile transparent, the algorithm fills them with the second source's matching quadrant.

Workflow

  1. Create two frames in your project:
    • Frame 1 — the "filled" terrain (e.g. grass), with detail in all 4 quadrants.
    • Frame 2 — the "outside" terrain (e.g. dirt), same dimensions.
  2. Activate Frame 1.
  3. Open the Auto-tile dialog (Grid2x2 button in the timeline header).
  4. In the Outside source dropdown, pick Frame 2.
  5. The preview updates: outer corners and edge transitions now show dirt instead of transparency.
  6. Click Generate. The new project "Auto-tile 47 (transition)" opens with all 47 tiles depicting the grass↔dirt boundary.

Tips

  • Both sources must have the same dimensions (the dialog enforces this).
  • Visually distinct sources work best — a hue or luminance contrast makes the transitions read clearly.
  • For a pure dirt-only tile (no grass), just paint dirt in Frame 2; the algorithm uses Frame 2 for the fully-empty configuration (mask 0x00).
  • The corner-cut algorithm produces sharp edges between the two terrains. Refine each tile by hand to add organic transition pixels (single-pixel jitters, blade-of-grass overhangs, etc.).

47-tile preview grid


Workflow

  1. Draw a single tile (let's say 32×32 grass) as the active frame.
  2. Open the Auto-tile dialog (Grid2x2 button in the timeline header).
  3. Inspect the preview. Some tiles will look identical — that's expected.
  4. Click Generate. The new "Auto-tile 47" project opens.
  5. Iterate through the 47 frames, refining each tile by hand:
    • Add unique corner details to distinguish tiles that share a base configuration.
    • Touch up the convex/side cuts for visual continuity.
  6. Export the sprite sheet → use in your engine.

Tips

  • Stay symmetric: if your source tile is asymmetric (more detail at one edge), the output will inherit that bias. Symmetric sources produce more flexible auto-tiles.
  • Plan for refinement: budget ~30 minutes to finalise the 47 tiles by hand even after auto-generation.
  • Use frame tags in the new project to group tiles by configuration ("inner", "outer", "T-junctions"). Makes the JSON export self-documenting for the consumer engine.

Limitations / future

Things still not in scope:

  • Wang 2-corner / 16-tile mode — same machinery but at the 16-config granularity. Add if requested.
  • Sub-pixel control for large tiles (≥ 64×64) — the algorithm splits into 4 quadrants regardless of source size. For larger tiles you may want finer control.
  • 3+ source terrains — only single-source and dual-source (filled + outside) are supported. Multi-terrain transitions (water ↔ sand ↔ grass) need separate runs.

  • Sprite sheet export — exports the 47 tiles for engine consumption
  • Frame tags — useful to group the generated tiles in the JSON output
  • Slices — for hitbox metadata on individual tiles after generation

Motestack is a personal hobby project. The editor and these docs ship under no warranty — back up your `.mstack` files.