← THE BLUE STICK

Guides / How games are made

What Is Procedural Generation?

PLAY NOWSolo, free, in your browser

Procedural generation is a way of making game content with rules and controlled randomness, instead of crafting every piece by hand. A designer writes instructions for how to build a level, and the computer follows them to produce a new one whenever it is needed.

How it works

At its simplest, a generator is a recipe with dice.

Suppose a designer wants a dungeon.

  1. Place between five and nine rooms at random positions.
  2. Connect them with corridors so that every room can be reached.
  3. Put the entrance at one end and the exit at the other.
  4. Scatter treasure in dead ends.
  5. Place tougher enemies further from the entrance.
  6. Check that the exit can actually be reached. If not, start again.

Each run of the recipe rolls the dice differently, and a different dungeon appears. All of them obey the rules.

The skill is in the rules. Pure randomness produces nonsense. Good generation is carefully constrained, so that results are varied and always playable. The last step, testing the result, is what separates a dependable generator from a frustrating one.

A common tool is "noise", a kind of smooth randomness. Ken Perlin invented the best-known version in the early 1980s for film graphics, and it has been used to make natural-looking hills, clouds and caves ever since. Minecraft's terrain is built from layers of it.

Computers do not produce true randomness. They start from a number called a seed and derive a long, unpredictable-looking sequence from it.

The same seed always produces the same result.

UseWhat it allowsExample
Sharing worldsTwo players enter the same seed and get the same mapMinecraft seeds traded online
Daily challengesEveryone plays an identical layout on the same daySpelunky, Slay the Spire
SpeedrunningRunners practice and compete on a known seedMinecraft and roguelike categories
Tiny save filesA huge world is stored as one number plus your changesMinecraft, No Man's Sky
TestingA developer can recreate the exact level a bug appeared inStandard practice

What games generate

ContentExamples
Dungeons and levelsRogue, Diablo, Spelunky, Hades
Whole worldsMinecraft, Terraria, Dwarf Fortress
Planets and galaxiesElite, No Man's Sky
Maps for strategyCivilization, Age of Empires
Weapons and lootBorderlands, Diablo
Histories and charactersDwarf Fortress, RimWorld
Detail in hand-made worldsTrees, rocks and grass placed automatically in most large open-world games

The idea is old. Rogue built a new dungeon each time in 1980, partly because computers had so little storage. Elite in 1984 fitted eight galaxies of 256 star systems each onto a home computer by generating them from a handful of numbers. No Man's Sky in 2016 used the same principle to offer about 18 quintillion planets, far more than anyone could visit.

Why developers use it

It suits games built around repeated short runs especially well. The Blue Stick is one example: each of its towers is laid out afresh when you enter, so no climb is the same twice.

The trade-offs

DrawbackWhat it meansHow games address it
SamenessPlayers start recognizing the patterns. Everything is different, yet nothing is memorableMore building blocks, and hand-made set pieces mixed in
Less authored craftA hand-made level can hold a perfectly timed surpriseHand-built rooms arranged by the generator
Broken resultsAn exit that cannot be reached, or an impossible jumpThe generator tests its output and retries
Hard to balanceDifficulty varies between runsRules that guarantee certain items or cap enemy numbers
Quantity over qualityA vast world with little worth findingFewer, denser areas
Unfair luckOne run is easy and the next is hopelessLimits on how good or bad a roll can be

No Man's Sky faced the "sameness" criticism at launch. Its planets were numberless and many felt alike. Years of updates added more variety and more hand-designed content.

The most admired procedural games combine both approaches. Hades has rooms built by hand and shuffles their order and contents. Spelunky assembles each level from hand-designed chunks along a guaranteed path from entrance to exit, an approach its creator Derek Yu has described in detail. This keeps the craft of hand-made pieces and adds the variety of generation.

How to tell, and what to do with it

  1. Does the layout change when you restart? If so, it is generated.
  2. Is there a seed option? Look in the world creation or run setup screen.
  3. Do the same rooms recur in a different order? That is the hand-made-pieces approach.
  4. Share a seed with a friend to compare how you each handled the same world.
  5. Use the daily challenge, if the game has one, to compete fairly against others.
  6. Do not try to memorize. Learn the rules the generator follows instead: where treasure tends to be, what a dead end usually holds.
  7. If runs start to feel alike, take a break. Generated variety has a limit, and stepping away restores it.
PLAY NOWSolo, free, in your browser