Wave Function Collapse Tool
Unity editor tool for generating 2D and 3D levels with Wave Function Collapse

Overview
A Unity tool that generates levels using Wave Function Collapse (WFC). Designers define tiles and which tiles can sit next to each other, and the solver fills a 2D or 3D grid with a layout that respects those rules.
I built it for my bachelor’s thesis at Universitat Jaume I, together with System Scape, a game that uses it to generate planets. It’s also the starting point for my PhD research.
How it works
- Each tile has sockets on its faces. Two tiles can be neighbours only if their facing sockets are compatible.
- The solver repeatedly picks the undecided cell with the fewest options left (lowest entropy), fixes it to one tile, and propagates that choice to its neighbours, removing tiles that no longer fit.
- If propagation leaves a cell with no valid tiles (a contradiction), the solver backtracks and tries again.
- Besides the CPU solver, the tool has a parallel version of WFC that runs on the GPU. That’s what System Scape uses to generate its planets.
The small demo at the top of the home page runs the same idea in your browser.
Current work
In my PhD I’m continuing this work. My newer, not yet published version stores tile sockets as bitmasks, so checking whether two tiles fit becomes a bitwise operation instead of a lookup.
Result
- The thesis was awarded Matrícula de Honor (top honours) at Universitat Jaume I. You can read the full thesis (PDF).
- Source code is on GitHub.