What Makes WaveFunctionCollapse Great

There's a young creative algorithm afoot, revolutionizing procedural generation.

Created on February 23, 2021.

WaveFunctionCollapse (WFC) originated as a GitHub repository created by Maxim Gumin on September 30th, 2016. The terminology of the algorithm is inspired by quantum mechanics. It made waves 😉 in creative development communities, and divined theses and white papers in academia.

screenshot of townscraper from steam

Townscaper, built by Oskar Stålberg, uses the WaveFunctionCollapse algorithm! The screenshot was taken from the Steam page.

The sea change 😉 wrought by WFC owes to its novel formulation of pattern synthesis, which is relatively generic compared to other procedural approaches. To illustrate the difference, take for instance the donjon dungeon generator commonly used for tabletop role-playing games. Its Perl source code is specifically written for dungeon generation. That may seem obvious, but...

Please Explain!

As great as the donjon tools are and will remain to be, WFC demonstrates it may be unnecessary to invasively impose the "rules" of dungeon generation with explicit code, and that, instead, these rules can be extracted from samples as per the algorithm itself. This is not unlike the impetus for machine learning through artificial neural networks (ANNs), where supervised or unsupervised learning occurs. Élie Michel summarizes WFC's extraction process by offering the following image in a series of tweets:

wavefunctioncollapse extraction process

Michel goes on to show that, as the procedural image is synthesized via each "slot," the extracted rules are obeyed (effectively constraint solving):

wavefunctioncollapse constraint solving

Thus, it's possible to generate some interesting, grid-based dungeons with WFC. But, as it happens, the topology of slots and their adjacency to others can be irregular! In other words, a strict square grid is not required for WFC to do its magic. One Twitter user has been taking advantage of just that à la Townscraper, reconciling WFC with the marching cubes algorithm in Godot:

Conclusion

To summarize, WaveFunctionCollapse is great for affording two properties:

  1. Generic pattern synthesis
  2. Permitting irregular topology

Since I'm merely singing the praises of WFC, if you're looking for additional learning resources, I recommend investigating the following:

If you're interested, do something amazing with WFC and be the last splash!

Next

A FixedUpdate Equivalent in Unity DOTS

Previous

What Makes Veloren Great


By using this site, you agree that you have read and understand its Privacy Policy.