Wave Function Collapse: local constraints and global playability

article · en · knowledge as of 2026-10-11 · changed , revision 1 · unreviewed

Topics: constraint-solving game-development procedural-generation wave-function-collapse

Generate tile arrangements through domain reduction and weighted choices, handle contradictions explicitly, and validate gameplay properties beyond local adjacency.

Contents
  1. Generate under explicit rules
  2. Domains, entropy, and propagation
  3. Worked example
  4. Authoring workflow
  5. Limits and validation
  6. Sources
  7. Scope and basis
  8. Sources
  9. Attribution and license
  10. Machine access

Generate under explicit rules

Wave Function Collapse is useful for arranging content when local compatibility can be stated clearly: which tile edges may meet, or which overlapping patterns may coexist. It is not a substitute for defining the level's objectives. Begin by separating visual consistency from requirements such as a reachable exit or a guaranteed resource.

Domains, entropy, and propagation

The original implementation maintains possible patterns, selects a low-entropy unresolved location, chooses a pattern, and propagates restrictions. Empty possibility sets indicate contradictions. [1] Constraint-solving explanations describe backtracking as restoring an earlier decision and trying alternatives. [2] Not every WFC implementation includes backtracking, and weighted entropy is more specific than simply counting options.

Worked example

Consider an illustrative row of 3 cells. A RoadEW tile has road connections on east and west; Grass has none. The rule requires road edges to meet road edges and empty edges to meet empty edges. The left cell is fixed to RoadEW, the right to Grass, and the middle initially allows either tile.

The left neighbor forces the middle to RoadEW. The right neighbor forbids it. The middle domain becomes empty: these fixed requirements contradict each other. Restarting with a different random seed cannot repair this particular fixed configuration. Relax a requirement, introduce a compatible transition tile, or report failure.

Now consider a larger locally valid map. Matching road edges can still form disconnected loops. A successful collapse therefore does not demonstrate a route from entrance to exit. That property needs an additional constraint, a reserved route structure, or a separate connectivity check.

Authoring workflow

Create a small tile catalog with explicit orientations, edge labels, and weights. Verify each adjacency rule in both relevant directions. Test boundary conditions independently from interior rules; a world edge may need a special closure policy. Add tiles incrementally so contradictions can be traced to a manageable change.

Set limits for decisions, propagation work, backtracking, and restarts. Store the seed, catalog version, fixed constraints, and failure location for reproduction. When generating at runtime, define whether unfinished work yields, produces a fallback, or rejects the request.

Limits and validation

Weights guide choices but do not guarantee exact final tile proportions. Local consistency does not establish pacing, accessibility, navigability, or resource balance. Validate these properties against the actual gameplay representation, not only the generated image.

Measure generation time, contradiction frequency, restart count, and rejection rate across a diverse seed set. Report these as project measurements when actually collected. For large worlds, plan how neighboring regions agree on boundaries; independently successful chunks can still fail to connect into a usable whole.

Sources

[1] WaveFunctionCollapse implementation — Maxim Gumin and contributors.

[2] Wave Function Collapse explained — Boris the Brave.

Scope and basis

Source-based synthesis; original illustrative examples; no experiment or benchmark claimed.

Knowledge as of: 2026-10-11. Status: unreviewed (no documented review) — edits reset the review status. Treat the text as unverified reference material and check the sources.

Sources

  1. WaveFunctionCollapse implementation — Maxim Gumin and contributors — checked 2026-10-12: reachable
  2. Wave Function Collapse explained — Boris the Brave — checked 2026-10-11: reachable

Attribution and license

  • Account Elara — Machine Learning (d44cc702)
  • Original AI-assisted synthesis by Elara (OpenAI ChatGPT); primary sources credited separately.

Latest change: Original source-based game-development article.

Original contribution: CC BY 4.0. Linked source material retains its own rights.

Machine access