Why So Random? - When is Procedural Generation Effective


Procedural generation is an incredible, powerful, and versatile tool for game developers. Since its inception in the games Beneath Apple Manor and Rogue, procedural generation has made a place in the gaming industry as a somewhat unique case. Rarely is a mechanic used to sell a game; typically, a game is sold on its premise, genre, or visuals, but many players will jump at games that feature procedural generation. Today, we will take a look at the rogue-like genre and procedural generation to develop a better understanding of when and how to use procedural generation in your games.

Nuts and Bolts

The initial purpose for procedurally generated levels was to conserve on memory. If you can teach a computer how to make a level using a certain set of parameters, you can cut down on the amount of memory used for storing things like huge, sprawling dungeons or vast environments. Today, it's used for much more than that. A synthesis between pre-made assets and generated levels has been achieved that allows developers to create more than just black and white ASCII dungeons, or thick splotches of matte colors with text.

We've come quite a way from Beneath Apple Manor.

You can use procedural generation to compensate for elements your development team might lack. For instance, RoboBlitz, released in 2007, had procedurally generated textures. Not only did this cut down on the file size by a ton, it meant that the developers could afford to have a weaker art side. There are also a number of ways to procedurally generate sound effects and music, though this is a much harder task to do on the fly.

The primary reason developers tend to use procedural generation is for the element of replayability. With levels being different every time they are played, you don't have to worry about your player getting bored of the same stage. This is something that's especially important if the player is going to be forced to do that same stage over and over. In the case of games with permadeath, procedural generation is almost a necessity. Games like The Binding of Isaac, Rogue Legacy, and FTL: Faster Than Light have cultivated a huge following on the backs of their procedural generation, high difficulty, and permadeath mechanics.

Rogue Legacy's insane castle changes every time your next-of-kin enters it, but you can stop it from shifting for the right price.

Another reason you may want to have procedural generation in your game is if it's a short experience. Bite-sized experiences gain hours of replayability from having some element of randomness to them. Whether or not this is achieved by having procedural levels or through some other mechanic, you can gain a whole lot with some simple code.

A Whole New World

Some games use procedural generation as a part of their story. In Eldritch, the player explores realms based in Lovecraft's world of elder gods. A dungeon that's different every time you enter it makes a lot of sense in an environment based on madness and chaos. Likewise, in Ziggurat, the player is thrust into a temple full of trials set up by a council of examiners looking to test them. In Minecraft, the world is generated in a way that is (for the most part) believable, and used to help immerse the player in their survival adventure.

Interestingly, Ziggurat keeps a pretty firm hold on how much experience the player can actually earn; an impressive feat given the very random nature of the game.

Sometimes you may want to incorporate procedural generation as a headlining mechanic in your game, but you may have a hard time justifying a reason for it. Thinking of a story or flavor element from the outset can help guide the direction of what your generation algorithm should and should not include, and can give your team a firmer sense of what type of experience you're trying to create. This type of reasoning tends to be what most developers lean toward; they set their game in a long-forgotten dungeon or a realm that is constantly in flux to explain their ever-changing dungeons. Just remember that you don't always need a reason to incorporate any mechanic.

Give and Take

Sometimes a game doesn't really need procedural generation. I found this with a game I recently played: Lovers in a Dangerous Spacetime. Lovers is a rather short game intended to be played with 1-4 players, and of its 20 main campaign levels, 16 of them are procedurally generated. Initially, I thought that including the procedurally generated worlds was a pretty good idea, but as I entered the second set of levels I realized that Lovers could have greatly benefitted from having well-planned and structured levels. The second world features some levels that have mazes of water currents pushing the player around the level. When randomly generated, these currents are mostly just a nuisance, but with some real, solid level design they could have been used more effectively. I can see that the intent was to extend replayability, being a short game and all, but I feel like the players would achieve a greater satisfaction by learning how to master the chaotic stages as a team, rather than rolling the dice each time. I say this because, after beating Lovers, there's no real need to go back in and try for mastery. All of the ships can be unlocked in a single playthrough, and with no other secondary or tertiary goals, the players are left with a pretty empty experience after completion. The main point here is that while the unpredictability and excitement of procedural generation can be a big draw and add to a games replayability, there are instances where non-procedurally generated levels can bring a lot to the table.

Make no mistake, Lovers is a lot of fun even if it is really difficult from time to time. I'd recommend it if you can get it for cheap.

Lovers does reveal an alternative for those whose teams are divided on whether or not to build or generate their levels. In level Cetus 2, titled 'The Four Queens', the players first navigate from a side room to the center room. They become locked in this room and have to face off against four huge sea creatures. After defeating them, they are able to go to the other three side areas before finishing the level, but what's interesting here is that this level features a more rigid kind of procedural generation. The center room is almost identical every time you play it, while the side rooms don't vary much from run to run. As a designer, you can change how flexible your procedural generation is. Enter the Gungeon works in a similar way, with certain rooms always showing up on each floor. Though, in Gungeon, this is more to the player's benefit than detriment, as knowing what challenges they should expect upon entering a room increases their survivability.

This room always shows up on level 2, but it has no enemies or challenges. It keeps players thinking about what purpose the room could serve and what mysteries the Gungeon keeps secret.

The Dice Keep Rolling

Whether or not you use procedural generation for the entirety of your dungeons like Dungeons of Dredmor, or simply reserve it to one aspect of your game the way Borderlands does, the excitement of casting a die is always something to at least consider when making your game. Just make sure you're using the technique effectively and ensure there is enough content for it to utilize.

Good luck, devs!