Practical Game Design
上QQ阅读APP看书,第一时间看更新

Randomization and procedural generation

Randomization and procedural generation are two interconnected terms. While randomization is mainly concerned with the application of chance-based mechanics (think card shuffling, critical hit chance, and randomized loot drops), procedural generation is focused on creating new content based on carefully crafted rules.

Let’s focus on looking at the effects of randomization first!

To be effective at prolonging your game's lifespan, randomization has to be constrained and applied in a careful, deliberate way. If done right, it can add thrills and make the game slightly less predictable, without undermining the player's ability to plan ahead. Do it badly and you'll end up with an unplayable mess where player actions seem to have little influence over the end result and it's impossible to predict and prepare for what's going to happen next.

Anything that becomes randomized is at risk of making the game rules less understandable, as well as breaking the balance of the game (making it either too easy or impossible to win). Moreover, due to negativity bias, most humans pay significantly more attention to negative outcomes of randomization than to positive ones. This means that fully randomized effects can lead to players feeling cheated by the game and losing the sense of agency.

A fellow designer, Keith Burgun, makes interesting points on randomness that are worth sharing at https://www.youtube.com/watch?v=2qfFEP_-LkI. Keith distinguishes between two types of randomness: input randomness and output randomness. Input randomness is described as one that informs player’s decisions, for example, map generation. Players cannot affect or predict it in advance, but will able to make decisions based on what they've been served. On the other hand, we have output randomness, which defines the outcome of a player's actions, for example, a die roll that determines whether the action (which you've already committed to) was successful or not. Be very careful when you inject your game with output randomness! The feedback on the player's actions can become confusing and may limit satisfaction from performing good decisions, as well as the opportunity to learn from one's mistakes. A valid move can be met with a failed result, while a mistake on the player's part could yield a positive outcome.

There are many great examples of using randomization. Some games use it to prolong the lifespan of the game's content; others put it at the heart of their game mechanics. Card games such as Magic The Gathering or Hearthstone would lose most of their appeal if the decks always produced the cards in a predefined sequence. As for Hearthstone itself, the designers have added a wide selection of cards that provide randomized effects after they're played – a great example of using the aforementioned output randomness. It's a polarizing set of cards that can result in both moments of great elevation (Oh my, I got so lucky!), as well as ones of great frustration (This? Really? I quit!). Unless you can provide your players with a clear indication of risk and uncertainty, you should shy away from using output randomness in key areas of the game.

Another great use of randomization is within reward systems. In games such as World of Warcraft, groups of players would often replay the same dungeon several times in order to get a chance at the desired item. An extreme version of reward randomization is found in a game that uses a Gacha-based (Gacha, from the Japanese word gachapon, refers to capsules sold in vending machines and containing random toys inside) business model. In such games, the most important items in the game that gate player progression are stashed away in randomized loot boxes. It's important to know that not every implementation of gacha rewards is the same (and therefore always fully randomized). A so-called box-gacha refers to a reward set with random chances but no duplicate rewards. Imagine a box with a strictly defined set of 10 items. Even if one of these items has a tiny 0.1% chance of dropping, you can be sure that you'll get the item within 10 tries. The worst case scenario is that you'll need to pull out 9 other items first.

If you rely on reward randomization, make sure you carefully prepare to handle filler content and duplicate rewards—there's nothing more demotivating than getting a useless reward or no reward at all. In case of duplicates of unique items, perhaps you can convert them into useful resources? More on this type of rewarding and Gacha-based business model can be found in Chapter 15, Games As a Service.

An outstanding example of smartly utilizing randomization can be observed in Valve's 2008 first-person shooter Left 4 Dead. In Left 4 Dead, four players work together across one of several campaigns. A campaign is a predefined string of levels, and each level has a mostly linear path, with a fixed entrance and exit. The game offers just a handful of weapons and items, a few special enemy types, and no differences between characters. On first glance, it does not seem like a hugely replayable game. However, the makers of the game made some very smart design decisions…

Left 4 Dead features an AI Director. The Director's role is to provide the survivors (players) with a varied and exciting experience that matches the chosen difficulty level. To do that, the director will track a variety of attributes for each player such as health, state, skill level (accuracy, kills, and so on) and position (are they in a group or alone, ahead or behind). Based on this information, the AI Director is capable of making each play-through unique through a variety of gameplay adjustments, the most prominent being:

  • Spawning hordes of common infected (think fast-moving zombies). The director picks one of the available spawn zones. The quantity and frequency all operate within set limits and are decided by the director.
  • Spawning special enemies. Types and locations vary and there are limits as to how many special foes can be alive at a time. Some very difficult foes are set to only spawn a set amount of times per map, in one of a few predefined locations, no matter the state of the survivors.
  • Spawning weapons, health, and ammo in one of several predefined locations. Again, there are upper and lower limits, but if your team is hurt they are much more likely to find life-saving medkits rather than temporary painkillers.

The Director also takes care of much more subtle features, such as triggering weather effects or dynamic dialogs between survivors (these often refer to their current location or the enemies they face).

Since the AI Director plans some elements of the level before the game starts, you could say it dabbles in procedural generation, but the true powers of using procedural generation to create new content go way beyond that!

We can delve into the fully procedural worlds of Minecraft and Terraria, as well as No Man's Sky, which not only assembles an entire universe full of planets but also populates it with living creatures! It's important to acknowledge that such extensive procedural generation is an art form in itself, and requires immense technical expertize.

On the less extreme (and more controllable) end, we've got the cult action-RPG Diablo, an RPG shooter Borderlands, and countless modern examples of Roguelikes (Enter the Gungeon, Nuclear Throne, and Rogue Legacy to name a few). Looking a bit closer at Diablo, it uses procedural generation to create its special monsters, magical items, and even assemble dungeon layouts, but the designers chose to retain a much higher level of control over the most important aspects of the game. The best gear in Diablo, all of the bosses, the overall story, objectives, and order of dungeons and environments are all handcrafted and pre-planned.

When designing your game, try to find parts of it that would naturally benefit from randomization and procedural generation, but remember there are tradeoffs! Writing good procedural generation code will take a lot of time (and it will take even longer to test and fine-tune it), and this can have a huge impact on the scope of the game. Moreover, procedurally generated worlds/items/stories rarely feel as special as handcrafted ones. There's a lot you can do by simply randomizing a few elements rather than creating them from scratch. If your game requires a high quantity of content and you need to rely on procedural generation, think of ways in which you can maintain a level of control over the critical parts of it.