Memorable Procedural Content in Games

Many of my favorite computer games feature "procedural content": game content randomly generated by the computer. Minecraft has procedural landscapes. NetHack has procedural dungeons. Spelunky has procedural platformer levels.

The advantage of procedural content (as opposed to handmade content) is that it makes the game more replayable. On the other hand, it's very very difficult to write an algorithm that will regularly produce memorable content. After just a few minutes of play, most random content feels like little more than noise.

Two of my favorite Radiolab episodes are especially relevant to this topic: Games and Stochasticity. In Games, the hosts discuss how stories and miracles can arise in the midst of a formal rule structure (e.g. chess or sports). In Stochasticity, they discuss how random outcomes regularly produce stories and miracles. (For instance, while it's extremely unlikely that a given person wins the lottery twice, it's very likely that someone out there will.)

So, it goes to show that the skeptics of procedural content generation, who say it can never produce meaningful, memorable results, are probably wrong. We just aren't doing it right.

The Solution

The trick, I believe, is in how you combine game elements. In most games each game element (monster, item, environmental feature, etc.) pretty much stands alone. The type of floor will have little effect on monster behavior, for example. The lighting won't have much of an effect on your armor. If each game element had a unique, interesting interaction with each other game element, then the total number of unique interactions would be combinatorically huge. Say you had 15 kinds of monsters, each of which had a unique interaction with each other kind. You'd have (15*14)/2 = 105 unique pairs. Factor in items, environmental features (e.g. traps), and larger groups of monsters, and you've got virtually endless combinations. It's a situation in which each given combination is rare, but it's very likely that some interesting combinations will occur.

Unfortunately, it's not feasible to manually give everything a unique interaction with everything else. You don't want to hand-code every interesting combination as a special exception - your code cleanliness would be in a constant state of decline as you added new features. It's easier to write code with fewer nuanced interconnections, when each game element has a generalized interface, and all the elements are "loosely coupled". But loosely coupled code makes for boring procedural content.

So, to reiterate: We want substantial, varied ways for game elements to interact with each other, without a major coding hassle. In other words, we need to be able to generalize.

What's the solution? One solution is hidden lower level qualitative mechanics: Generalizations that are not immediately visible to the player (hidden and lower level), and vary in behavior instead of in parameters (qualitative). An example would be a materials system: Each item, monster, and tile is made of a certain material, and different materials have different properties. Paper and wood are flammable. (Paper can also get soggy.) Iron can rust. Flesh can bleed. Cheese is edible. In most games, this only goes as far as a quantitative difference: In Pokemon, for instance, ice types are weak to fire types, but that weakness works exactly the same as water types being weak to electric types. The behavior is exactly the same, only the parameters vary. In NetHack on the other hand, iron armor can actually rust, and paper (e.g. scrolls) can burn up. But NetHack's system only scratches the surface of what is possible.

Another solution is to vary things slightly with qualitative "quirks". For instance, give each individual monster a few quirks, chosen from a pool of ten or twenty. Many games allow monsters to vary in stats (qualitative quirks) but stats don't produce memorable content. Qualitative quirks would substantially modify behavior - examples might be Cowardly (the monster flees the player), Telepathic (the monster always knows the location of the player), Kamikaze (the monster explodes on death), or Greedy (the monster searches for items). Or, instead of quirks, outfit monsters with unique equipment.

All the above suggestions should improve the memorability of what happens, but still leave the locations rather bland. In handcrafted game environments, locations can be interesting regardless of the characters and items inside. In Zelda games, for instance, each dungeon has its own feel. Even dungeons with the same element (e.g. fire) can vary substantially from each other. The Forest Temple in Twilight Princess has a considerably different mood from the Forest Temple in Ocarina of Time.

Memorable locations need to be both aesthetically and behaviorally unique. This can be accomplished through a combination of variations in layout (rooms and corridors, random caves, catwalks over chasms), obstacles (keys and doors, boss monsters, magic statues, puzzles), level-wide properties (ambient temperatures, anti-magic fields, poisonous air, darkness), and terrain (slippery ice, knee-level water pools).

Problems with the Solution

The above suggestions have three fundamental problems:

  1. Bugs. A combinatorial explosion of possibilities will certainly result in bugs, even with much of the behavior generalized under-the-hood. This problem is probably unavoidable.
  2. Game balancing. With enormous numbers of substantially unique possibilities, balancing the difficulty of the game would be nigh impossible. This problem could be mitigated by making death as fun as possible. Really, though, I think game balance is not such a big deal in most cases. Better to have a unique and memorable experience than a well-balanced one.
  3. Inconsistent theming. You probably don't want a fire dragon turning up in an ice cave. One trick to solve many of these kinds of problems would be to simulate the level for a while before the player enters, giving some elements a chance to stabilize. (If you generated a hot dungeon with ice patches, the ice would melt before the player saw it.) Again though, it's better to have unique experiences than carefully-themed ones. If you always see fire dragons in volcanoes, that's not memorable.


It's easy to theorize about improved procedural content, but extremely difficult to deliver on it. In any event, as more and more new games explore the possibilities of procedural content generation (with big success for games like Minecraft and Dungeons of Dredmor), hopefully we'll begin to see truly memorable locations and scenarios.