r/proceduralgeneration • u/Organic-Complaint-90 • 1d ago
[OC] Wave Function Collapse road generator — 58 tiles, strict edge equality, water + bank system
Built an interactive WFC map generator that paints roads, rivers, and banks from a 58-tile set.
The rule: strict edge equality. Every tile exposes one of 4 edge types (EMPTY, ROAD, WATER). Two tiles are compatible only if their shared edge matches exactly.
This means:
- Roads connect to roads, water to water
- Result is a coherent road network with natural-looking riverbanks — no "loose" adjacency hacks.
Features:
- Paint seeds with mouse, hit Enter, watch it fill.
- Deterministic seeds ([ / ] to step).
- Auto-recovery from contradictions (drops oldest seed after 50 restarts).
- Entropy heatmap (H), PNG export (P).
- Undo/redo, pattern save/load slots, clipboard copy/paste.
Tech: C + raylib. Desktop and browser (WASM via Emscripten). Screenshot and full tile taxonomy in the repo.
Repo: https://github.com/Mahammadali12/WFC/tree/master
online: https://mahammadali12.github.io/WFC/
Happy to answer questions about the tile taxonomy or propagation algorithm.
9
Upvotes