Skip to content

This project implements the wavefunction collapse algorithm in Rust

Notifications You must be signed in to change notification settings

careyi3/wavefunction_collapse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wavefunction Collapse

I talk about this here on YouTube.

This project implements the wavefunction collapse algorithm in Rust. The algorithm generates tile-based patterns using local constraints, suitable for procedural content generation.

Tiles are loaded from the img directory as PNG files. The configuration for tile edges and weights is provided in config.json. The program outputs an animated GIF showing the collapse process.

To build and run the program with optimal performance, use:

cargo run --release

The output GIF will be written to output.gif in the project directory.

Dependencies include the image and gif crates. Ensure you have Rust and Cargo installed.

Example output:

Wavefunction Collapse

└┘.┌--┘┌-┐.└-┘.└┐└┘|
..┌┘...└-+--┐...|..|
┐.└---┐..|┌┐└┐.┌+--┘
└-┐┌--┘┌-┘└┘.|.|└┐┌-
-┐└┘┌-┐└-┐┌--┘.└┐||.
-┘..|.|┌-┘|.┌┐..||└┐
..┌┐└┐||..└┐||..└┘┌┘
..└+-+┘|┌-┐|||.┌-┐|.
---┘.|.└+-++┘|┌┘.└┘.
┐...┌┘..|.||.||....┌
+┐..└--┐|┌+┘.└┘.┌┐┌┘
|└┐....└+┘|┌-┐..|||.
└-┘.....|.||.|..||└-
.┌-┐.┌┐┌+┐|└-┘┌┐└┘..
-+┐└┐|└┘└┘|..┌+┘...┌
.└+┐||....|┌-+┘....|
..||└+-┐.┌┘|.|..┌┐.└
--┘|.|.└-┘.└-┘.┌┘└--
...└┐|..┌--┐.┌┐|....
┌┐..└+--┘..|.└┘└-┐..

About

This project implements the wavefunction collapse algorithm in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages