Constraint Rules

Constraint rules are the adjacency tables that drive WFC collapse on the Stalberg grid. The same rules power every mode on the generation spectrum — whether a human is choosing, rolling, or letting the algorithm decide, the constraints are identical.

How Constraints Work

Each tile on the dual grid has four corners. Each corner has a type. The constraint rules define:

  1. What corner types exist at this zoom level
  2. Which corner types can be adjacent (share an edge on the main grid)
  3. Probability weights for each valid adjacency (how likely terrain is to continue vs. transition)
  4. Boundary pins inherited from the parent zoom level

A tile is valid when all four of its corners satisfy the adjacency rules with their neighbors. WFC collapse picks the most constrained tile, selects a valid configuration, and propagates updated constraints to neighbors.

The Five Generation Modes

The constraint rules are the invariant. The modes differ only in who resolves each tile:

ModeWho ResolvesWhen to Use
ArtisanalGM/players place freely, constraints checked afterSession zero, collaborative worldbuilding, emotionally important geography
HighlightEngine identifies the most constrained tile and lists its constraints; human fills itGM prep, focused creative work on the tile that matters most
JigsawEngine collapses most tiles, leaves n tiles with m valid choices each for humansCollaborative session with guardrails, player-facing worldbuilding
Roll TablesJigsaw, but dice select from the m choices instead of human judgmentSolo GM prep, fast generation with randomness
AutomaticEngine collapses everythingBackground regions, time-pressured prep, digital tool

Highlight Mode

The engine presents: “Tile 14 is the most constrained uncollapsed tile. Its constraints are: north edge is forest, east edge is river (must connect to tile 9), south edge is open, west edge borders a faction stronghold. Valid terrain types: forested riverbank, ford, bridge site, mill site.”

The GM fills it with whatever they want within those constraints. The engine doesn’t care which valid option — it only guarantees structural coherence.

Jigsaw Mode

The engine collapses a patch but leaves n tiles unresolved, each with m remaining valid configurations. The GM or players choose from the options presented.

Design knobs:

  • n (tiles left open) — scales creative input. Tie to region development: well-traveled areas have fewer open tiles because prior play has pinned more.
  • m (choices per tile) — scales decision complexity. m=2 is fast binary choices. m=4+ is a real creative exercise.

Roll Table Mode

Same as Jigsaw, but each open tile’s m choices are numbered for a die roll. The constraint rules are the roll tables — they just happen to also be machine-readable.

Constraint Table Format

(Draft — to be refined per zoom level)

Corner Types (Region Zoom Level)

Each corner on the dual grid has one of these types:

TypeDescriptionTerrain Feel
ForestDense woodlandTrees, undergrowth, canopy
PlainsOpen grasslandRolling hills, farmland, savanna
HighlandElevated terrainHills, ridges, plateaus
MountainSteep/impassable elevationPeaks, cliffs, passes
WaterRiver, lake, or coastNavigable or barrier
WetlandMarsh, swamp, bogDifficult terrain, rich resources
DesertArid wastelandSand, scrub, extreme heat
SettledInhabited areaRoads, buildings, cleared land

Adjacency Rules

Which corner types can share a main-grid edge:

TypeCan Be Adjacent ToCannot Be Adjacent To
ForestForest, Plains, Highland, Wetland, SettledMountain, Desert
PlainsPlains, Forest, Highland, Desert, Settled, Water
HighlandHighland, Forest, Plains, MountainWater, Wetland, Desert
MountainMountain, HighlandWater, Wetland, Forest, Desert, Settled
WaterWater, Plains, Wetland, SettledMountain, Highland
WetlandWetland, Water, Forest, PlainsMountain, Desert
DesertDesert, PlainsForest, Mountain, Water, Wetland
SettledSettled, Plains, Forest, Water, HighlandMountain

Continuity Weights

When collapsing, same-type adjacency is weighted higher to produce natural-feeling regions rather than noise:

AdjacencyWeightEffect
Same type → Same type5Terrain tends to continue (forests are big, not scattered)
Same type → Compatible type2Gradual transitions (forest → plains at edges)
Same type → Rare-but-valid type1Occasional surprises (forest → wetland pocket)

These weights become dice probabilities in Roll Table mode. Weight 5:2:1 maps to roughly: “Roll d8. 1-5: terrain continues. 6-7: gradual transition. 8: surprise.”

Boundary Pins

Inherited from the parent zoom level:

  • Edge type — every border tile’s outward-facing corners are fixed by the parent tile’s type
  • Feature entry points — rivers, roads, mountain ridges that cross parent boundaries pin specific border tiles with specific types and connection requirements
  • Settlement markers — a parent tile marked as containing a settlement pins at least one interior tile as Settled type

Multi-Tile Features (Chunks)

Some features span multiple tiles and only trigger when their pattern matches the surrounding constraints. These are the spatial equivalent of hyperedges.

FeaturePattern RequiredEffect
River valley3+ Water corners in a lineGenerates navigable river with banks
Mountain passMountain-Highland-Mountain sequenceCreates a traversable route through mountains
CrossroadsSettled tile with 3+ Settled neighborsGenerates a waypoint, inn, or market
Deep forest4+ Forest tiles with no non-Forest neighborsGenerates ancient/primeval forest with discovery nodes
LakesideWater tile with 3+ non-Water neighborsGenerates shoreline features, fishing, docks

These chunks serve the same role as Stalberg’s multi-tile special pieces — they reward pattern formation with richer, hand-authored content that breaks visual/narrative repetition.

What This Doesn’t Cover

The constraint rules handle the Geography and Settlement faces of the six-layer die. The non-spatial layers (People, Factions, Quests, Lore) attach to geography nodes via posts but have their own constraint propagation rules.

A geography tile collapsing as “forested riverbank” doesn’t determine which NPCs or factions are present — it constrains which people/faction types are plausible (river trade guild: yes; mountain miners: probably not) and the non-spatial layers resolve from there.

Next Steps

  • Define corner types for each zoom level (Planet, Continent, Kingdom, Region, Settlement)
  • Playtest the Region-level adjacency table — are the “cannot be adjacent” rules too restrictive?
  • Build roll table versions of the continuity weights for each zoom level
  • Define the multi-tile chunk library and triggering patterns
  • Determine how the seeded discovery pool attaches to geography tiles during collapse

See Also