Procedural Generation
Algorithmic content creation
Procedural generation created game content through algorithms rather than manual design, enabling vast worlds, endless replayability, and experiences that fit in kilobytes.
Overview
Why design one dungeon when an algorithm can create millions? Procedural generation uses mathematical formulas and random seeds to produce game content — levels, worlds, items, enemies, even music. Elite (1984) packed 2,048 star systems × 8 galaxies into 22 KB. Rogue (1980) created a different dungeon every play. Limited storage became infinite possibility, and the technique never went away — it became the foundation of an entire modern genre.
Fast facts
- Purpose: Generate content algorithmically rather than store hand-authored data.
- Benefit: Infinite variety from minimal code; reproducibility via seeds.
- Trade-off: Less hand-crafted detail; quality variance; designer surprise (good and bad).
- Legacy: Roguelikes, survival games, modern indies, AAA open worlds.
Core techniques
| Method | Application | Examples |
|---|---|---|
| Random number seeds | Reproducible generation — same seed = same world | Elite, Minecraft, No Man's Sky |
| Perlin / Simplex noise | Smooth terrain, textures, clouds | Minecraft terrain, modern open-world heightmaps |
| Cellular automata | Cave systems, organic shapes | Spelunky, Dwarf Fortress caves |
| L-systems | Plants, branching structures | Procedural foliage, fractal trees |
| Wave Function Collapse | Constraint-driven layout | Bad North, Townscaper, modern indie tools |
| Grammar-based | Structures, quests, narrative | Spore creature generation, Watch Dogs civilians |
| BSP / partition | Dungeon layout | Classic roguelike room-and-corridor |
| Drunkard's walk | Cave / tunnel generation | Many roguelikes |
| Voronoi diagrams | Region division (kingdoms, biomes) | Civilization maps, Caves of Qud |
| Markov chains | Text, dialogue, names | Dwarf Fortress place names, NPC dialogue |
Classic examples
| Game | Year | Generated content |
|---|---|---|
| Beneath Apple Manor | 1978 | First commercial roguelike — procedural dungeons |
| Rogue | 1980 | Dungeon layouts, monsters, items |
| Elite | 1984 | Star systems, planets, names, economies |
| Hack / NetHack | 1985+ | Dungeons, items, monsters |
| Diablo | 1996 | Levels, loot, monster placement |
| Minecraft | 2009 | Entire planet-scale terrain |
| Spelunky | 2008 | Level design from hand-crafted "rooms" |
| Dwarf Fortress | 2006 | World, civilisations, history, individuals |
| No Man's Sky | 2016 | Entire universe — 18 quintillion planets |
| Caves of Qud | 2015 | World, history, factions, language |
| Wildermyth | 2021 | Stories, characters, narrative arcs |
Elite's universe
Elite's achievement was fitting 2,048 star systems into a tiny program. The trick: don't store the systems — generate them on demand from a seed. Each system's name, position, government, economy, and tech level all derive from a single 24-bit number per galaxy:
| Element | Generation |
|---|---|
| 2,048 stars per galaxy | Computed from a recurrence relation seeded by the galaxy index |
| 8 galaxies | Different starting seeds; same algorithm |
| Names | Bit-pattern of the seed → consonant-vowel pairs ("Diso", "Lave") |
| Economies | Derived from the seed bits |
| Politics | Same |
| Sizes | Same |
The entire universe is data-free in ROM — every byte is code. Elite II: Frontier (1993) extended this to procedurally generate planet surfaces too.
Rogue's dungeons
Rogue (Toy/Wichman/Arnold, 1980) established the roguelike template:
| Element | Algorithm |
|---|---|
| Dungeon layout | Map divided into 3×3 grid of rooms; rooms placed randomly within their grid cell |
| Corridors | Connect rooms via L-shaped paths |
| Monsters | Level-appropriate spawning (level 1 monsters on level 1, etc.) |
| Items | Distributed treasure with rarity weights |
| Stairs | Random placement, ensuring connectivity |
| Per-level rerun | Each level fresh on each visit (in some variants) |
The "rooms in a 3×3 grid" template appears in countless games to this day; Spelunky uses essentially the same idea with hand-crafted room templates.
Advantages
| Benefit | Explanation |
|---|---|
| Storage efficiency | A 100 KB algorithm can generate gigabytes of content |
| Replayability | Different every time — no "I've seen this map before" |
| Scale | Worlds far larger than any team could hand-author |
| Surprise | The designer can be surprised by their own game |
| Emergent gameplay | Combinations of generated elements create unscripted situations |
Challenges
| Issue | Mitigation |
|---|---|
| Quality variance | Constraints, validation rules, "playability" guarantees |
| Lack of meaning | Combine procedural with hand-authored narrative anchors |
| Sameness | Multiple varied generation rules; biome variety |
| Testing / QA | Seed-based reproduction; automated playthrough validation |
| Bad seeds | Filter or re-roll if the generator produces unplayable output |
| Designer control | Hybrid approach: hand-craft the grammar, procedurally combine the pieces |
The "lack of meaning" problem is real: a procedurally-generated 18-quintillion-planet universe (No Man's Sky) feels emptier than a hand-crafted single small map (Outer Wilds). Modern procedural games like Wildermyth explicitly mix procedural and hand-crafted to address this.
Modern applications
| Area | Use |
|---|---|
| Roguelikes | Core genre feature — Hades, Slay the Spire, Risk of Rain, Spelunky 2 |
| Survival games | World generation — Minecraft, Terraria, Don't Starve, Valheim |
| Space games | Universe creation — Elite Dangerous, No Man's Sky, Stellaris |
| Open-world | Procedural cities, NPC behaviour — Watch Dogs, AC: Origins, Cyberpunk 2077 civilian crowds |
| Audio | Adaptive music — Wwise / FMOD generative composition |
| Narrative | Generated quests, dialogue — Dwarf Fortress, Wildermyth, Caves of Qud |
| Visual art | Procedural textures (Substance), shape generation, foliage |
| Tools | Wave Function Collapse, Houdini, ProBuilder for designers |