/River-Land-Generation

generate a river land map using wave function collapse

Primary LanguagePython

River-Land-Generation

This here is a small project I made when I first learnt about wave function collapse.
I thought it was cool so gave it a go.
As long as you have pygame and a modern version of python you can just run main.py and create your very own river land.

Create your own

If you like you can create your own map or whatever else using the algorithm I've written
just upload all your images into the images folder and remove mine
(all my images are 25x25 but as long as yours are square they will be resized correctly).

Then you must tell the program how to connect the tiles,
open helper.py and find my rules on line 14, remove them.
Then create your own rules using the same syntax.
Next, find the function "get_nodes()", this function must return a list of all the possible tiles.
Remove mine and started adding yourown.
The function should look like this.

def get_nodes():
    """returns a list with all nodes"""
    nodes = [
        Node("WaveFunctionCollapse/images/<your_file_name>.png", <north rule>, <east rule>, <south rule>, <west rule>),
        Node("WaveFunctionCollapse/images/<your_second_file_name>.png", <north rule>, <east rule>, <south rule>, <west rule>),
        .
        .
        .
    ]

    return nodes

Then save the file and rerun main.py to see your own creation.