Skip to main content

Walker generator

Walker generator is one of the layout generators that is implemented in Frigga. It's called like that because it implements the random walk (or sometimes drunkard's walk) algorithm. The generator is great for procedural dungeons but it can handle procedural islands as well if a different configuration is used.

The algorithm is relatively simple. We spawn one or more so-called walkers which are entities that move across the level and place floor tiles wherever they move. Their movement is random, based on configured probabilities that a walker will turn after they move one step forward. The algorithm will usually stop after a predefined number of tiles is placed.

One great advantage of the algorithm is that it never produces levels made of disconnected areas. That means that the whole level is always one large connected area and we don't need do any special post-processing to achieve that.

Animation of the walker generator (just the layout, no theme applied)
Animation of the walker generator (just the layout, no theme applied)

tip

The Walker generator is only responsible for generating the layout, while the Theme engine is here to make it look good by applying rules with actual tiles and game objects. The advantage of this approach is that we reuse the Theme engine for any number of layout generators.