DevBlog#15 Procedurally generated environments. Why would you want them?


Hi everyone,

Although a day later than usual, here is this week’s blog. As the game From Hell is progressing, some of the design is established and I have quite clear idea of what game levels should look like, I have decided to introduce procedural level generation in my game.

Before I show how it looks like, I would like to dive deeper on what procedural generation is and why should we have such thing in our game at all.

What is procedural generation

Wikipedia sums up this quite nicely:

Procedural generation is a method of creating data algorithmically as opposed to manually, typically through a combination of human-generated assets and algorithms coupled with computer-generated randomness and processing power. In computer graphics, it is commonly used to create textures and 3D models.

In other words – procedural generation is an automatic process that creates something based on given input (code, graphics, words, anything). Instead of painstakingly creating each level by hand, you can create a programming logic that will create level for you any time, in any size and in infinite amount.

Sounds fantastic right? Well, there are some pitfalls related to this approach.

Why procedural generation should be used with caution

A good overview of pitfalls when using random generation (or anything random) can be found in this Gamasutra post.

From my perspective, biggest pitfalls are those that break balance of the game. Let’s say that player gets random loot and health to replenish at some point in the level. What if this point is randomly selected and appears at the start of the level when you don’t have need to replenish you health? You continue forward, inevitably lose some health on the way and at the end of the level meet boss. Unfortunately, randomness has played out that there is no health to get replenished after you had completed hardest parts of the level (which also appeared randomly) and so, you are now facing the boss with little health left and with no way of surviving this.

This is the word of caution – don’t overuse randomness, it can make the game a chaotic experience for the player.

So, if a procedural generation is “dangerous”, what can be the benefits for using it?

The benefits

 Advantages of procedural generation can include :

  • smaller file sizes,
  • larger amounts of content,
  • randomness for less predictable gameplay

Especially for indie game developers, procedurally generated randomness is great advantage, as it minimizes cost of time and money for creating levels. Randomness also serves for lengthiness of the game as players would go back to game more often, since every run would provide little bit different game experience.

So how do we make it work?

Best practices for using the procedural generation and randomness

My point of view for this is partial randomness. Instead of having everything pop up based on random dice that computer has thrown, there are areas that are designed by hand, purposely providing things to player that can balance out other, randomly generated areas.

Here are some guidelines that I found useful when designing procedural generation.

Summary of things to keep in mind while design random generation:

  • Decide on how big should generated level be compared to hand made level
  • Think about the purpose of generated level and how it can compliment manually crafted one
  • Include key things in manual levels that would balance the game for the players before and after encountering procedurally generated areas

Here is an example of procedural generation from my game From Hell (work in progress):

Random level generation

As you can see, this is a work in progress. Some things that I think should be improved upon are the size and accessibility of the overall level. Other would be platforms, boxes that are being generated inside the level area. They should have more balanced distance between each other. Furthermore, since the game is about jumping up, what if items inside are generated in a way, that there is too big of a gap between platforms and player can’t reach next one? Or, what if items are so tightly packed that it’s impossible to move upwards?

These things will be something to improve and balance out for best player experience..and prepare my game for the demo release! That’s right, slowly but steadily I am moving forward to have first playable demo this fall!

More info on how to play the demo will follow, but until then – feel free to share your thoughts in the comments or in game’s Discord channel!

As always, thanks for reading, don’t forget to subscribe for weekly game development blog and have a great day!

Leave a comment

Log in with itch.io to leave a comment.