Procedural generation is a very broad topic, ranging from generating everything from levels, graphics, quests, music and more. Games like Spore and No Man’s Sky and the demo scene take these concepts to extremes in spetacular fashion.
A gentle introduction to procedural generation is cantor city (see below) that makes a very simple cityscape.
For a more detailed, academic, coverage of various topics in procedural generation see Ian Parberry awesome Procedural Content Generation resources page.
Lennas Inception, a game that draws inspiration from Zelda and The Binding of Isaac, has a lot of good resources about practical procedurally generating 2D levels.
There’s a great talk from GDC 2015 entitled Making Things Up: The Power and Peril of PCG that gives a broad overview of procedural generation and where it can be applied. On of the resources that is mentioned in the talk is the Procedural Content Generation in Games book, which can be read freely online. Another good resource is the Procedural Content Generation Wiki.
The code is also available as a gist:
Ideas for revisiting
Use procedural generation for:
- Auto-generating quests and story
- Creating a dynamic soundtrack that reacts to in-game events
- Using text-to-speech (e.g. the Web Audio Speech Synthesis API) to create speech dynamically
- Boost replayability by generating levels and terrain
- Create new enemies and encounters from a database of prototypes