A procedural content generation application written in Odin that is based on the Wave Function Collapse by Maxim Gumin WFC to generate structured outputs from input examples. The application loads pattern examples (PNGs) from a directory and generates new outputs based on adjacency and pattern constraints.
The main difference is that you are not restricted to generating outputs on a grid. Before the shape of the input defined the shape of the output. This implementation cuts this dependency and allows you freedom in how to shape the output.
On grid like graphs the output is the same quality as the original.

Irregularly arranged cells pose no problem.

You can make the graph complex, with different regions and complex edge-cases.

Even randomly placed cells, with different amount and distribution of neighbours can be used.

Though the larger or more complex the graph, the longer it may take to generate a complete output. (See my paper(in german) for more in depth explanations and analysis)
This project:
- Implements a Wave Function Collapse–style generator on graph‑like structures.
- Generates new outputs based on constraints extracted from the example image.
- The algorithm can take any input image and any graph-structure, but output quality may suffer in some cases.
- the program is written in Odin and uses Raylib to display and DearImGUI for the ui.
- everything besides that is implemented from scratch
If you feel brave, try if you can build and run it on your machine. No warranties.
You will need to install the odin compiler.
Then setup the project.
git clone https://github.com/mrmetube/wfc
git submodule init
git submodule update --recursive
Build.
odin run build
Run the app.
.\build\wfc.exe .\data\images
The UI is rough, as I made in a way to help me develop. It is not polished for end-users, or more percisely I was the only intended end-user.
The Extraction UI lets you select the used image.
In the Grid window you choose from some preset-graphs and adjust their size or parameters or below make your own.
The Generate section lets you control the running generation, pause and resume and scroll back through the steps.
The Stats and Visual Options show different information next to or on the graph.
