## TL;DR
Procedural content generation (PCG) uses algorithms to automatically create game content — terrain, levels, items, quests — replacing manual design with computational generation. It is fundamental to modern open-world and roguelike games.
## Core Concepts
### Noise-Based Generation
Perlin noise and Simplex noise are the backbone of terrain generation. These functions produce natural-looking gradient noise that, when layered at multiple octaves, creates realistic mountains, valleys, and cave systems.
### L-Systems for Vegetation
Lindenmayer systems (L-systems) use recursive production rules to model plant growth. Starting from an axiom string, rules like F → F[+F]F[-F]F generate branching structures that resemble trees and foliage.
### Wave Function Collapse (WFC)
WFC treats content generation as a constraint satisfaction problem. Input examples are analyzed to extract adjacency rules, then the algorithm propagates constraints to fill a grid with compatible tiles — producing coherent dungeons, towns, and textures.
### Cellular Automata for Caves
Conway's Game of Life rules adapted for cave generation: cells with too few neighbors die (open space), cells with enough neighbors survive (walls), creating organic cave networks.
## Applications
- **Roguelikes**: Random dungeon layouts, item placement, enemy spawning
- **Open-world games**: Terrain, vegetation, weather systems
- **Asset generation**: Texture synthesis, material creation
- **Narrative**: Quest generation, dialogue variation via grammar-based systems
## Performance Considerations
Modern PCG must balance generation quality with runtime cost. Techniques include:
- Pre-generation during loading screens
- Chunk-based generation with LOD (level of detail)
- GPU-accelerated noise computation
- Seed-based determinism for reproducible worlds