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:
- What corner types exist at this zoom level
- Which corner types can be adjacent (share an edge on the main grid)
- Probability weights for each valid adjacency (how likely terrain is to continue vs. transition)
- 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:
| Mode | Who Resolves | When to Use |
|---|---|---|
| Artisanal | GM/players place freely, constraints checked after | Session zero, collaborative worldbuilding, emotionally important geography |
| Highlight | Engine identifies the most constrained tile and lists its constraints; human fills it | GM prep, focused creative work on the tile that matters most |
| Jigsaw | Engine collapses most tiles, leaves n tiles with m valid choices each for humans | Collaborative session with guardrails, player-facing worldbuilding |
| Roll Tables | Jigsaw, but dice select from the m choices instead of human judgment | Solo GM prep, fast generation with randomness |
| Automatic | Engine collapses everything | Background 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:
| Type | Description | Terrain Feel |
|---|---|---|
| Forest | Dense woodland | Trees, undergrowth, canopy |
| Plains | Open grassland | Rolling hills, farmland, savanna |
| Highland | Elevated terrain | Hills, ridges, plateaus |
| Mountain | Steep/impassable elevation | Peaks, cliffs, passes |
| Water | River, lake, or coast | Navigable or barrier |
| Wetland | Marsh, swamp, bog | Difficult terrain, rich resources |
| Desert | Arid wasteland | Sand, scrub, extreme heat |
| Settled | Inhabited area | Roads, buildings, cleared land |
Adjacency Rules
Which corner types can share a main-grid edge:
| Type | Can Be Adjacent To | Cannot Be Adjacent To |
|---|---|---|
| Forest | Forest, Plains, Highland, Wetland, Settled | Mountain, Desert |
| Plains | Plains, Forest, Highland, Desert, Settled, Water | — |
| Highland | Highland, Forest, Plains, Mountain | Water, Wetland, Desert |
| Mountain | Mountain, Highland | Water, Wetland, Forest, Desert, Settled |
| Water | Water, Plains, Wetland, Settled | Mountain, Highland |
| Wetland | Wetland, Water, Forest, Plains | Mountain, Desert |
| Desert | Desert, Plains | Forest, Mountain, Water, Wetland |
| Settled | Settled, Plains, Forest, Water, Highland | Mountain |
Continuity Weights
When collapsing, same-type adjacency is weighted higher to produce natural-feeling regions rather than noise:
| Adjacency | Weight | Effect |
|---|---|---|
| Same type → Same type | 5 | Terrain tends to continue (forests are big, not scattered) |
| Same type → Compatible type | 2 | Gradual transitions (forest → plains at edges) |
| Same type → Rare-but-valid type | 1 | Occasional 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.
| Feature | Pattern Required | Effect |
|---|---|---|
| River valley | 3+ Water corners in a line | Generates navigable river with banks |
| Mountain pass | Mountain-Highland-Mountain sequence | Creates a traversable route through mountains |
| Crossroads | Settled tile with 3+ Settled neighbors | Generates a waypoint, inn, or market |
| Deep forest | 4+ Forest tiles with no non-Forest neighbors | Generates ancient/primeval forest with discovery nodes |
| Lakeside | Water tile with 3+ non-Water neighbors | Generates 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
- The Stalberg Grid — the spatial grid algorithm these rules operate on
- The Artisanal-to-Automatic Spectrum — the five modes these rules power
- Wave Function Collapse — the underlying algorithm
- Geography Overview — how geography relates to the rest of the engine