The Stalberg Grid
The Geography layer needs a spatial substrate — a grid that tiles can sit on, with adjacency relationships that drive WFC constraint propagation. The Stalberg grid provides this across every zoom level.
The Algorithm
Oskar Stalberg invented a method for generating irregular quadrilateral grids from hexagonal patches. The steps:
- Place points in a hexagon shape
- Add layers of points outward, with an extra point between each outer point
- Triangulate from center outward
- Randomly dissolve edges — two triangles merge into a quad
- Subdivide remaining triangles into three quads each
- Subdivide all quads into four smaller quads
- Relax — iteratively adjust points so each is equidistant from its neighbors
The result is an organic, irregular quad grid that looks natural rather than mechanical. Because each patch is hexagonal, patches tile infinitely by snapping edge-to-edge.
The Dual Grid
The grid above is the main grid. Its dual — offset by half a cell — is where tiles actually live.
On the main grid, each point has a type (terrain, biome, etc.). On the dual grid, each quad’s four corners have types inherited from the main grid points. This means tile identity is defined by corner types, not whole-tile types.
This reduces the number of distinct tile configurations dramatically. Instead of tracking every possible neighbor arrangement, you only need rules for what corner types can coexist on a single quad. For a binary system (land/water), this drops from 15 distinct cases to 6.
For the Pandemonium Engine’s richer terrain vocabulary, the reduction is even more valuable — it keeps the constraint table manageable as terrain types multiply.
Why Hexagonal Patches
Each patch is a self-contained unit that collapses independently. Patches tile laterally (more geography at the same zoom level) and vertically (zooming in — one tile at a parent level becomes an entire patch at the child level).
Hexagonal patches have six neighbors. Six connection points. Six edges that become boundary constraints for adjacent or child patches. This is richer than square patches (four neighbors) without the ambiguity of triangular patches.
Fractal Zoom Levels
The same algorithm generates grids at every scale. The tile types and constraint rules change; the spatial structure doesn’t.
| Zoom Level | Patch Represents | Tile Types |
|---|---|---|
| Planet | Continent-scale regions | Oceans, landmasses, climate zones |
| Continent | Kingdom-scale regions | Biomes, mountain ranges, major rivers, political boundaries |
| Kingdom | Region-scale areas | Terrain types, trade routes, settlement markers, wilderness zones |
| Region | Local-scale terrain | Specific terrain, waypoints, roads, individual hexes |
| Settlement | District-scale areas | Building clusters, landmarks, streets, open spaces |
Boundary Inheritance
A parent tile doesn’t dictate what’s inside the child patch — it dictates what the edges must look like. A “forested highlands” tile at the Kingdom level means the child Region patch has forest/highland terrain on every border edge. The interior is full superposition until collapsed.
Features that cross parent-level boundaries — rivers, roads, mountain ranges, coastlines — become pinned entry points on the child patch’s border. The child patch must route them through its interior during collapse.
Two adjacent child patches that both collapse will automatically agree on shared borders, because both inherited the same edge constraints from the parent level.
Responsive Generation
Only collapse a zoom level when players declare intent toward it. The Kingdom grid can exist fully collapsed while every Region patch within it remains in superposition. When someone says “we’re heading to the Thornwood,” that Region patch collapses — and only that one.
This is The Shadow Horizon applied spatially. Collapsed but unvisited patches are provisional. Visited and observed tiles are pinned. The geography solidifies through play exactly like every other layer.
Connection to the Six-Layer Die
The Stalberg grid is the spatial substrate for the Geography and Settlement faces of the six-layer die. The other four layers (People, Factions, Quests, Lore) aren’t spatial — they attach to geography nodes via posts but propagate constraints through their own graph edges.
At each zoom level, the full six-layer die applies. A continent has factions (empires). A region has factions (guilds, local powers). A settlement has factions (clubs, families). The spatial grid provides coordinates; the non-spatial layers provide meaning.
See Also
- Constraint Rules — the adjacency tables that drive collapse at each zoom level
- The Artisanal-to-Automatic Spectrum — the five generation modes that all use the same constraint rules
- Geography Overview — how geography nodes relate to the rest of the engine