Wave Function Collapse
procedural generation (c#)
Summary & Purpose
I’m a big fan of procedual generation and randomness in video games, to that end I wanted to make a package for doing procedual map generation. I stumbled upon wave function collapse and it seemed to accomplish what we needed to do. I found implementations in python and C, which were for small bitmaps or images which generated the image below.
I ported a combination of these implementations to unity, while adding in the ability to use gameobjects and 3d models of “blocks” as cells.
Minimal setup in unity thanks to some custom editor tools allows me to quickly generate maps.
A good start, but we can get even closer to an ‘objective’ level by making this a maze. The way we can do this is by preprocessing cells allowing for one “entrance” and one “exit”.
This is cool and all but adding in a bit of playability goes a long way. ( Car controller scripts not made by me, just a quick asset drop while using my procedually generated roads as a surface)
This system is currently being used as is with different blocks in a roguelike action game I’m making where it generates a procedual maze for certain levels.