finds.dev← search

// the find

mxgmn/WaveFunctionCollapse

★ 25,144 · C# · NOASSERTION · updated Mar 2026

Bitmap & tilemap generation from a single example with the help of ideas from quantum mechanics

Wave Function Collapse is the original reference implementation of the WFC algorithm — it generates bitmaps and tilemaps that are statistically consistent with a small input sample. It's for game developers and researchers who want to understand how the algorithm actually works, not for people looking to drop a library into a project.

The overlapping model is elegant: the AC-4 constraint propagation with minimum-entropy observation produces globally coherent output from purely local rules, and the math behind why that works is non-obvious but correct. The tile symmetry system is a genuinely clever reduction — encoding D4 group symmetry cuts adjacency enumeration down significantly for symmetric tilesets. The codebase is small enough to read in an afternoon; five .cs files covering both models with no framework dependencies. Production use in Caves of Qud, Bad North, and Townscaper confirms the algorithm is real, not a demo toy.

This is a research artifact, not a library — there's no API, no NuGet package, and wiring it into your own project means forking and gutting the console app. Contradiction handling is limited to detection and restart; no backtracking, no incremental repair, which means complex or tightly-constrained tilesets can spin on retries. The project is effectively in maintenance mode since 2018 with only occasional patches; anyone wanting active development or 3D support should look at the ports instead. Configuration is XML-only, which is awkward in 2026.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →