Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
0

Wave Function Collapse in Godot

A topic by The Game Is Simple created Sep 10, 2022 Views: 559
Viewing posts 1 to 1

Hello everyone!
I’ve implemented Wave Function Collapse algorithm in Godot as a little coding practice: https://thegameissimple.itch.io/wave-function-collapse-in-godot

Initial source of inspiration: https://github.com/mxgmn/WaveFunctionCollapse

It’s a neat little algorithm and I invite everyone interested in some coding challenges to implement one yourself. The logic is pretty straight-forward, most of the challenge comes from designing a data structure to store tiles, rules, grid models and their relations. And, well, recursive backtracking is interesting too.

Peculiar thing is that it can be used to procedurally generate not only images, but also text (for poetry), meshes (for 3d level generation), and who knows what else.

There are other online implementations like this one in Unity: https://oskarstalberg.com/game/wave/wave.html
And this project generates infinite 3d city that looks pretty damn cool: https://marian42.itch.io/wfc

WFC was used in some games to generate some if not all of the content. Notable examples I am aware of: Caves of Qud, Townscaper, Bad North.

Hope you find it interesting :)