2D Wave Function Collapse in GDExtension

Hi everyone,

I made a small C++ library implementing 2D Wave Function Collapse and made a Godot wrapper around it with GDExtension. You can find the repo here. If this is something you would like to use for your own game please feel free to do so. I added a few usage examples to showcase how the library works. For convenience I’m also adding here a few short snippets.

The first example is a drawing panel where you can partially fill in the image with the building blocks extracted from the input sample provided, and then ask WFC to fill in the rest. Or you can let WFC fill in the whole thing.

The second example is a pseudo level generator. Here I used a simplified input sample in WFC, so that it generates a skeleton of the level, and the map it to a more elaborate tileset. Below the final result:

Please keep in mind I only tested the build in Ubuntu, since it’s the only operating system I have. As far as I know CMake works on any operating system, but if you encounter any issues please let me know :slight_smile:

Cheers!

1 Like

Including some screenshots or video in the post may be a good idea. Also think about showcasing WFC as an animation where each frame is an iteration step. That always looks cool and gets attention :slight_smile:

2 Likes

Thanks for the feedback! I added a few videos on the repo I linked but indeed it may be more straightforward to also do it here :slight_smile:

1 Like

Thanks again for the feedback :slight_smile: Found some time these days to implement the animation and I’m quite happy with the result!

1 Like