Skip to content

PranjalKhatri/simple-cpp-WaveFunctionCollapse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wave Function Collapse (WFC) Algorithm

Overview

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.

Project Structure

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

Build Instructions

To build the project, run the following command in the root directory where the Makefile is located:

mingw32-make

or

make

Important Notes:

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:

main.cpp

Scene Modification(main.cpp):

constants.h

Scene Definitions(constants.h):

Contributing

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.

Acknowledgments

The WFC algorithm is inspired by The Coding Train's explanation of Wave Function Collapse. Special thanks to Raylib for providing the graphics library.

About

a naive c++ implementation of WFC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published