Wave Function Collapse
May 8 2024Unity, Procedural Generation (C#)
Github: https://github.com/ChefSteveP/WaveFuntionCollapse
A two person project done with Stephen Pasch.
Inspired by Oskar Stålberg‘s Townscaper and Tom Hanssens’ video, we wanted to try writing our own implmentation of wave function collapse (WFC) and turn it into a game (although it turned out to be more of WFC toy than a game).
To start, the user can fill the grid with any tile from our provided tileset. After they’re satisfied, the user can either choose to move one step forward, filling in a couple tiles, or fill in the grid entirely. The user wins if the WFC leads to a viable path between the two path tiles.
Here’s an example of what happens when the user does not choose to fill in any tiles at all, and fills the grid from the start:
Here’s an example where the user has filled in some of the tiles before filling the board.
Here’s a much larger example. The two tiles that must be connected are the ones on the leftmost side of the screen: