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:
- Even, Even → Octagon. The primary dungeon cells. Floor, walls, content live here.
- Odd, Odd → Connector diamond. A small 45°-rotated square filling the diagonal gap between four octagons.
- Mixed parity (even-odd or odd-even) → Void. Nothing. Not a cell, not a wall, not anything. Just geometric absence.
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.
Long Edges vs. Short Edges
An octagon has 8 walls. Four of them are long edges, four are short edges. The distinction matters:
- Long edges (wall indices 0, 2, 4, 6) face N, E, S, W. They're shared with the adjacent octagon in that cardinal direction — octagons abut each other directly on long edges, no connector between them.
- Short edges (wall indices 1, 3, 5, 7) face NE, SE, SW, NW. They don't touch another octagon — they face a connector diamond in the diagonal gap.
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.
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:
- Octagon base square: 12.8 m × 12.8 m
- Corner cut ratio: 0.20 (20% of the base length). You can swap to 0.15 (cramped) or 0.29 (spacious) per dungeon via the corridor scale setting.
- Octagon long edge: ~7.7 m at 20% cut
- Octagon short edge: ~3.6 m at 20% cut
- Connector diamond side: ~3.6 m (matches short edge exactly — that's the geometric constraint)
- Layer height: 12 m per floor (multi-level dungeons stack along Y)
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.
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: