InfiniWave | Wave Function Collapse for arbitrarily large worlds

InfiniWave was developed with fellow student Daniel Eckmann. We aimed to modify and extend Maxim Gumin’s Wave Function Collapse Algorithm to work in Unity with 3D tiles and most importantly in arbitrarily large worlds. If possible we wanted it to work at runtime. Generated parts of the world are saved to disk and loaded again as to reduce the need for generating them.

The basic building blocks of a generated world are Unity prefabs, this allows vast flexibility. You could for example create a prefab for a room in a dungeon with various scripts attached, which fill the room randomly.

I’m currently working on polishing it, so we can release it.

For the generation algorithm constraints need to be set manually. The user needs to set, which sides of a tile may be adjacent to what other sides of a tile. This is done using a custom UI allowing you to choose the sides in a Unity scene. The creation of a tileset is handled by a custom UI as well. You just need to set the size of the tiles, the name of the tileset and add the prefabs, which need to be in the Resource folder (or a subfolder thereof).

The generation is handled by the InfiniWaveController script. No other script needs to be interacted with. In the inspector you can set all necessary variables, like the tileset, that should be used, the location of the saved files, the size of the generated volume, the direction of generation and so on.

Our architecture allows the use of different tilesets for different levels and entirely differently configured generation as well.