WaveFunctionCollapse
WaveFunctionCollapse is an open-source implementation of the Wave Function Collapse algorithm, originally introduced by Maxim Gumin. The repository contains a C# program that generates bitmap images and tilemaps from a single input example, using constraints derived from local patterns. It supports both the Simple Tiled Model, which works with predefined tiles and adjacency rules, and the Overlapping Model, which extracts patterns directly from an input image. The algorithm treats the output grid as a superposition of possible states for each cell and repeatedly collapses cells to concrete states based on the constraints, propagating information to neighboring cells to maintain consistency. This produces outputs that are locally similar to the input but globally novel, making it suitable for procedural content generation. The project includes a Windows desktop application with a graphical interface for loading inputs, adjusting parameters, and viewing results. It has been widely adopted and ported to many other languages and game engines, serving as a reference implementation for the technique.
- Category
- Code
- Pricing
- Open Source
Problem solved
WaveFunctionCollapse solves the problem of generating large, non-repetitive textures, tilemaps, and patterns from a single small example. It automates the creation of locally consistent content, significantly reducing manual design effort in games, art, and procedural generation.
Use cases
- Generating game levels from sample tilemaps
- Creating seamless textures from a small image
- Procedural dungeon and map generation
- Artistic pattern synthesis and experimentation
- Educational demonstration of constraint solving
Audience
- Developers
- Hobbyists
- Researchers
- Content Creators
Pros
- Simple to use with a single input example
- Produces high-quality, locally similar outputs
- Supports both overlapping and simple tiled models
- Open source with permissive MIT license
- Widely referenced and ported
Cons
- Windows-only desktop application
- Requires manual parameter tuning
- Performance may degrade for large outputs
- Limited to 2D grids
- Not packaged as a reusable library
Official website: https://github.com/mxgmn/WaveFunctionCollapse
Canonical LambdaBase page: https://www.lambdabase.com/tools/wavefunctioncollapse