Introducing Procedural Generation For My Game

Introducing Procedural Generation For My Game

I focused on the procedural generation of the map.

In this week's devlog for my new game Escape The Wave, I focused on the procedural generation of the map. It was a challenging but instructive process, and with the help of ChatGPT and a lot of research, I was able to successfully generate a map for my game!

Exploring Procedural Generation Methods

The objective of my game is to generate an island with randomly placed walls that have spaces for the player to pass through. To achieve this, I first researched various procedural generation methods. The first method I tried was perlin noise, which uses noise values to determine the position of each tile. While this method was easy to implement, it didn't allow me to control the form of the generated map to match my specific needs for the walls.

Next, I experimented with the walker algorithm, which is often used to create dungeon-like environments by creating rooms and links between them. I attempted to use this method to generate walls, but the result was inconclusive.

Developing a Custom Algorithm

Ultimately, I decided to create my own algorithm inspired by the two previous methods. I began by creating a 2D array with a predefined size, filling it with zeros to represent water. Then, I added an island by placing a circle in the center of the array with a radius equal to one-quarter of the array size. I filled this circle with ones to represent grass. To improve the form of the island, which initially resembled a simple circle, I used perlin noise and added water depending on the noise value. To ensure that the island did not become an archipelago, I applied the noise only on the border of the circle.

Finally, I added walls with a simple pattern, removing the middle of any wall larger than six tiles to ensure that the player could pass through all walls.

You can find the full algo here


Overall, the procedural generation of the map was a challenging but rewarding process. I am excited to continue developing my new game and to see how the generated map will enhance the player's experience.