JS

Wave function collapse

Introduction

An implementation of the Wave Function Collapse algorithm in Unreal Engine (C++), built for an unfinished game.

wave-function-collapse/index.svg

Goal of the project

Generate game maps that are different every time but always make sense, with neighbouring tiles fitting together.

My approach

The game board keeps a set of possible tiles for every cell. The algorithm repeatedly picks the cell with the lowest entropy, collapses it to one tile and propagates the constraints to its neighbours until the whole map is decided.

Result

A reusable GameBoard class for Unreal that generates consistent maps.

Photos

Wave function collapse wave-function-collapse/index.svg