The Octile Grid

Octagons joined by diamonds. Why the geometry matters.

Why Not Just Squares?

A grid of plain squares is the classic dungeon surface. It's also limiting. Every room is rectangular. Every corridor runs cardinally. Diagonal movement is either impossible or stair-stepped, and rooms never quite feel carved — they feel gridded.

DM uses a truncated square tiling: squares with their corners cut off become octagons, and the cut-corner gaps between them fill with small 45°-rotated squares (“connector diamonds”). Cardinal movement flows along long edges; diagonal movement flows through connector diamonds. Rooms of any shape — L-bend, T-corridor, plus-cross arena, irregular cavern — can all coexist on the same surface without grid artifacts.

The Parity Rule

The grid is stored as a 19×19 interleaved array for a 10×10 octagon layout (formula: gridWidth = octagonCols × 2 - 1). Every cell's position determines what kind of thing it is:

The parity rule isn't a quirk — it's what makes the tiling work. It guarantees every octagon is surrounded by four other octagons cardinally (sharing long edges) and four connector diamonds diagonally (sharing short edges). No ambiguity. No off-grid neighbors. The address system does the geometry for you.

3×3 octagon patch showing octagons (even/even), connector diamonds (odd/odd), and void cells (mixed parity)
Recommended: 800×800

Long Edges vs. Short Edges

An octagon has 8 walls. Four of them are long edges, four are short edges. The distinction matters:

A connector diamond has 4 walls (indices 0–3 clockwise: TL, TR, BR, BL). Each of its walls faces a short edge on one of the four surrounding octagons. So every corridor passage goes octagon short edge → connector wall → connector wall → octagon short edge.

📌 Wall index reference

Octagons (clockwise from N): 0=N, 1=NE, 2=E, 3=SE, 4=S, 5=SW, 6=W, 7=NW. Even indices are long; odd are short.

Connectors (clockwise from top-left): 0=TL, 1=TR, 2=BR, 3=BL.

Proportions

The default proportions, chosen so dungeons feel like walkable spaces rather than abstract diagrams:

In world space, cells sit on a uniform lattice: cellSpacing = (baseSquareSize + connectorSize) / 2 ≈ 8.21 m. An octagon at grid (row, col) centers at world (col × cellSpacing, row × cellSpacing).

What This Enables

Because long edges connect octagons directly, cardinal corridors are clean: no tiny passages, no wasted diamonds. Because short edges route through connector diamonds, diagonal movement is first-class — you get real 45° passages, not stair-stepped approximations.

And because the parity rule is strict, the grid is impossible to misuse. You can't accidentally put a room cell on a connector slot, or a corridor on a void slot. The geometry corrects you. That's what lets DM keep Sims-style direct manipulation honest — click a wall, cycle it, click a cell, activate it. The addressing does the rest.

✅ When you hit this

If you ever find yourself confused about “why can't I place a wall there” — check parity. A wall you're trying to edit may belong to a connector diamond (odd, odd) or sit on a void boundary (mixed parity). The grid is telling you what's geometrically possible.

For the Curious

The geometric foundation and wall-addressing scheme are documented in full in the project's architectural decision records:

What's Next