The Wave Function Collapse (WFC) algorithm is a procedural content generation technique inspired by quantum mechanics. This project uses WFC to generate visually appealing patterns and structures such as roads, tracks, and terrains, based on a set of input tiles. The goal is to create varied, yet consistent, output by respecting local constraints between adjacent tiles.
Here is an overview of the project's directory structure:
├── images # Generated images or screenshots
├── Include # Header files for the project
├── Libs # External libraries (Raylib, etc.)
├── Src # Main source code (main.cpp)
├── Builds # Folder where your builds will be stored
To build the project, run the following command in the root directory where the Makefile is located:
mingw32-make
or
make
Make sure to run the executable from the parent folder, not the Builds folder, i.e., use ./Builds/app.exe ; Or you can paste the images folder inside your Builds folder.
You may need to compile external dependencies such as Raylib for your system. Please follow the instructions provided on the Raylib website for your specific platform. Changing the Scene The project allows you to modify and explore different scenes. The following images show where you can change the scene and where its definitions are located in the code:
Scene Modification(main.cpp):
Scene Definitions(constants.h):
Contributions are welcome! Feel free to fork the repository, create a branch, and submit a pull request. We encourage experimentation, so don't hesitate to modify the rules or try out different kinds of input images.
The WFC algorithm is inspired by The Coding Train's explanation of Wave Function Collapse. Special thanks to Raylib for providing the graphics library.