Wave function collapse (random tilemap generation)

10 random tiles are generated at the start (these are the seed tiles)
A sprite is moved randomly about empty areas. (I have 4 to speed things up)
It looks at neighbouring and diagonal tiles and places tiles at it’s location if it sees a tile.
The tile placement rules are too long to explain, they’re in the code if you’re interested.

After 4 seconds, the tiles are all filled so no more generation
But there a still a bunch of mistakes so 2 more sprites go to clean up the sand tile placement.
Feel free to mess about with the code, try larger and smaller tilemaps and see if you can make some better tile generation code lol

Read me if you want to edit the code

This function should be adjusted to follow the dimensions of the tilemap
image
image
Change the repeat number to adjust the number of seed tiles


Change the frequency of the seed tiles by adjusting the array after the dark blue tile (keep order from 0-4 in the array)
image
What number corresponds to what tile for the set tile and if tile next to functions

8 Likes

New update!
(update in original link)
Customisable map sizes, sprite number and starting tiles
Pressing B opens the options menu
Press A in the menu to edit selected value
To start, fill in all the values
Menu button gives the option to reset settings

2 Likes

I uh, don’t know what a wave function collapse is… What’s happening here?

2 Likes

wow, this is really cool! can you maybe make the menu normal-sized?

1 Like

unfortunately the mini menu extension can’t handle larger font sizes (pretty sure)

ok, thanks anyway.

1 Like