Home

Procedurally Generated Maps

Year:
2022
Role:
Programmer
Tech:
Unity, C#
Platforms:
PC

Nuclear Throne is a bullet hell roguelike developed by Vlambeer. It's highly addictive and endlessly replayable because the map is different every time you play.

I wanted to try implementing something similar.

I start with an empty matrix for the grid, plus variables for the room width and height.

Each tile is one of three types: empty, floor, or wall.

Next, I use a random walk. A struct called Walker stores a position and a direction.

The room is set up and a given number of walkers are created.

Each step, the walkers randomly move, change direction, or die.

Once the room is filled above a certain percentage, all the walkers are removed.

A floor tile is placed at every position a walker has visited. Then a wall tile is placed in every empty position next to a floor tile.

Procedural generation can add a lot of content to a game, but it needs to be done well. Otherwise you're just choosing quantity over the quality of handcrafted levels.

This was just a learning exercise, and I'd love to explore other procedural generation methods for my own games.

Media