Crates.io | wave-function-collapse |
lib.rs | wave-function-collapse |
version | 0.3.0 |
source | src |
created_at | 2022-11-30 20:50:27.516838 |
updated_at | 2024-09-08 05:58:38.262909 |
description | Converts nodes and their restrictions into a collapsed node state based on the selected algorithm. |
homepage | |
repository | https://github.com/AustinHellerRepo/WaveFunctionCollapse |
max_upload_size | |
id | 726895 |
size | 598,843 |
Converts nodes and their constraints upon other nodes into a fully collapsed node state based on the selected algorithm. This can be used to solve any degree of complexity from dense node graphs to Sudoku to procedurally-generated game elements and more.
To use this framework, you will first want to determine the following:
Once these are answered, you can construct the vector of nodes and the vector of node state collections that those nodes reference for their permissive relationships. Please examine a relevant example to see how the construction of nodes and node state collections occurs.
Image example
This example demonstrates the same functionality showcased in https://github.com/mxgmn/WaveFunctionCollapse.
cargo run --release --example image
Sudoku example
This example demonstrates usage of a sequential wave function collapse algorithm.
cargo run --release --example sudoku
Landscape example
This example demonstrates usage of an accommodating wave function collapse algorithm.
cargo run --release --example landscape
Sparse example
This example demonstrates usage of an accommodating wave function collapse algorithm along with more sparse probabilities.
cargo run --release --example sparse
Zebra puzzle example
This example demonstrates usage of a sequential wave function collapse algorithm for word problems like the Zebra Puzzle.
cargo run --release --example zebra_puzzle
Perlin example
This example demonstrates usage of the proximity graph abstraction that shows how placement of game locations can be done in a dynamically generated environment.
cargo run --release --example perlin
Shared conditions between nodes
When you want to say that "when node 1 is in state A and node 2 is in state B then node 3 can only be in state C", you will end up needing to have multiple variations of the same node state such that our previously mentioned state "B" would be equivalent to "B when node 1 is A". This would permit you to specify for node 2 that when it is in the state "B when node 1 is A", then it will only permit node 3 to be in state C.
Example coming soon