Barbarian Meets Coding

WebDev, UX & a Pinch of Fantasy

3 minutes readbook-notes

Notes on Procedural Content Generation in Games

Procedural Content Generation in Games is a textbook on procedural content generation used to provide an overview of the landscape of PCG and also teach a course on PCG in the University of Copenhagen. What follows are my personal notes as I read the book and practice different PCG techniques.

What is procedural content generation?

PCG is the algorithmic creation of game content (levels, maps, rules, stories, characters, music, art, etc…) with limited or indirect user input.

Why PCG?

  • Save cost of game development by relying on algorithms instead of people to create content
  • Empower individuals like game designers, small game studios or hobbyists with algorithms
  • Create adaptative games that adapt to the way a player plays to make the games more enjoyable (e.g. Left 4 dead uses adaptive PCG to adapt the difficulty of the game to the player in order to keep the player engaged)

Search-based PCG

Search-based PCG follows the idea that designing a solution for a given problem is like the process of searching: there is a solution out there and we just need to keep iterating over one or many solutions, incorporating what works, removing what doesn’t until we arrive to the desired solution. Search-based PCG often rely on evolutionary or genetic algorithms to find successively better solutions.

The core components of a search-based PCG solution are:

  • A search algorithm (oftentimes an evolutionary algorithm) that generates the content
  • A content representation, that is, the representation of the artefacts we want to generate (e.g. levels, characters, items, quest, etc). They could be anything from an array of numbers, to graphs, strings or objects.
  • One or more evaluation functions that allow us to evaluate the quality of an artefact. Evaluation functions are applied on the artefacts we generate and result in a number that describes how good the artefact is. This number could represent how fun a level is or whether it is playable at all.

Evolutionary Search Algorithms

An evolutionary search algorithm is an stochastic search algorithm inspired by Darwinian evolution through natural selection. The idea is to keep a population of individuals (also called chromosomes or candidate solutions) which are evaluated in each generation. The fittest (highest evaluated using an evaluation function) individuals get to reproduce and the least fit are removed from the population. A generation can then be divided into two phases: selection and reproduction. The result of reproduction are new individuals that are a mix of the fittest individuals (through combination or crossover) or a copy with small changes (mutation). Over a number of generations the resulting population will be more fit according to the evaluation function used to determine fitness… Example…


Jaime González García

Written by Jaime González García , dad, husband, software engineer, ux designer, amateur pixel artist, tinkerer and master of the arcane arts. You can also find him on Twitter jabbering about random stuff.Jaime González García