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:

  1. Place points in a hexagon shape
  2. Add layers of points outward, with an extra point between each outer point
  3. Triangulate from center outward
  4. Randomly dissolve edges — two triangles merge into a quad
  5. Subdivide remaining triangles into three quads each
  6. Subdivide all quads into four smaller quads
  7. 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 LevelPatch RepresentsTile Types
PlanetContinent-scale regionsOceans, landmasses, climate zones
ContinentKingdom-scale regionsBiomes, mountain ranges, major rivers, political boundaries
KingdomRegion-scale areasTerrain types, trade routes, settlement markers, wilderness zones
RegionLocal-scale terrainSpecific terrain, waypoints, roads, individual hexes
SettlementDistrict-scale areasBuilding 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