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.
- Place between five and nine rooms at random positions.
- Connect them with corridors so that every room can be reached.
- Put the entrance at one end and the exit at the other.
- Scatter treasure in dead ends.
- Place tougher enemies further from the entrance.
- 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.
| Use | What it allows | Example |
|---|---|---|
| Sharing worlds | Two players enter the same seed and get the same map | Minecraft seeds traded online |
| Daily challenges | Everyone plays an identical layout on the same day | Spelunky, Slay the Spire |
| Speedrunning | Runners practice and compete on a known seed | Minecraft and roguelike categories |
| Tiny save files | A huge world is stored as one number plus your changes | Minecraft, No Man's Sky |
| Testing | A developer can recreate the exact level a bug appeared in | Standard practice |
What games generate
| Content | Examples |
|---|---|
| Dungeons and levels | Rogue, Diablo, Spelunky, Hades |
| Whole worlds | Minecraft, Terraria, Dwarf Fortress |
| Planets and galaxies | Elite, No Man's Sky |
| Maps for strategy | Civilization, Age of Empires |
| Weapons and loot | Borderlands, Diablo |
| Histories and characters | Dwarf Fortress, RimWorld |
| Detail in hand-made worlds | Trees, 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
- Replay value. A game that is different every time can be played for far longer.
- Surprise. Even the developers do not know exactly what a player will meet.
- Scale. A small team can offer more content than it could ever build by hand. Minecraft was begun by one person.
- Small file size. Rules take less space than finished levels.
- Fair challenge. Nobody can memorize the layout, so players rely on skill and understanding.
- Stories that emerge. In Dwarf Fortress and RimWorld, generated characters and events produce tales nobody wrote.
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
| Drawback | What it means | How games address it |
|---|---|---|
| Sameness | Players start recognizing the patterns. Everything is different, yet nothing is memorable | More building blocks, and hand-made set pieces mixed in |
| Less authored craft | A hand-made level can hold a perfectly timed surprise | Hand-built rooms arranged by the generator |
| Broken results | An exit that cannot be reached, or an impossible jump | The generator tests its output and retries |
| Hard to balance | Difficulty varies between runs | Rules that guarantee certain items or cap enemy numbers |
| Quantity over quality | A vast world with little worth finding | Fewer, denser areas |
| Unfair luck | One run is easy and the next is hopeless | Limits 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
- Does the layout change when you restart? If so, it is generated.
- Is there a seed option? Look in the world creation or run setup screen.
- Do the same rooms recur in a different order? That is the hand-made-pieces approach.
- Share a seed with a friend to compare how you each handled the same world.
- Use the daily challenge, if the game has one, to compete fairly against others.
- Do not try to memorize. Learn the rules the generator follows instead: where treasure tends to be, what a dead end usually holds.
- If runs start to feel alike, take a break. Generated variety has a limit, and stepping away restores it.