Procedural Content Generation: From Automatically Generating Game Levels to Increasing Generality in Machine Learning

Sebastian Risi, Julian Togelius

TL;DR

Procedural Content Generation (PCG) is evolving from a tool for game replayability into a cornerstone for robust Machine Learning. By algorithmically creating diverse, open-ended training environments, researchers can combat the "generality problem"—the tendency for AI to overfit to specific tasks—and pave the way for agents that truly generalize to the real world.

What Problem Does This Paper Address?

Modern Machine Learning, particularly Deep Reinforcement Learning (RL), has a "brittleness" problem. While an agent might master a specific level of Super Mario Bros. or a fixed set of Atari games, it often fails spectacularly when faced with even minor variations. This is known as overfitting to the environment.

Traditional benchmarks like the Arcade Learning Environment (ALE) provide fixed levels, allowing agents to memorize sequences of events rather than learning general strategies. The authors argue that to achieve "General AI," we must move away from static training sets and toward environments that are as diverse and dynamic as the real world.

Methods

The paper reviews a spectrum of techniques that bridge the gap between game design and ML:

  • Classic Constructive PCG: Rule-based methods like Perlin noise for textures or L-systems for vegetation. These are fast and reliable but lack "intelligence."
  • Search-based PCG: Using evolutionary algorithms to search for content that maximizes a specific "fitness" function (e.g., a level that is challenging but beatable).
  • PCG via Machine Learning (PCGML): Training models like GANs or LSTMs on existing game data to generate new content. A key innovation here is Latent Variable Evolution, where researchers use evolutionary search within the latent space of a GAN to find functional game levels.
  • Domain Randomization (DR): A simpler form of PCG used in robotics. It involves randomizing simulation parameters (lighting, friction, object mass) so that a policy trained in sim can "transfer" to the messy physical world.
  • Co-evolutionary Environments: Systems like POET (Paired Open-ended Trailblazer) and MCC (Minimal Criterion Coevolution), where the agent and the environment complexity evolve together in a reciprocal arms race.
Examples of commercial games using PCG, from the ASCII dungeons of Rogue (a) to the infinite planets of No Man's Sky (e).

Datasets

The paper discusses several benchmarks designed to test generality through PCG:

  • ALE (Arcade Learning Environment): Cited as a classic but limited benchmark due to its lack of randomization.
  • GVG-AI (General Video Game AI): A framework for testing agents across many different procedurally generated games.
  • CoinRun & Obstacle Tower: Newer RL environments specifically built with PCG to quantify an agent's ability to generalize to never-before-seen levels.
  • UnityVGDL: A recent combination of the Unity engine with game description languages to create high-fidelity, randomized testbeds.

Key Insights and Ideas

  • Functional Content vs. Pictorial Content: Generating a game level is harder than generating a face. A GAN-generated face that is slightly "off" is still recognizable, but a Mario level with a gap that is one pixel too wide is "broken" and worthless for training. This necessitates "solver-based" or "functional" PCG.
  • Stepping Stones to Generality: The authors highlight that complex tasks often cannot be learned directly. PCG allows for Progressive PCG (PPCG), where the environment's difficulty scales with the agent's performance, creating a natural curriculum of "stepping stones."
  • The Reality Gap is a Content Gap: In robotics, the failure to transfer from simulation to reality is often because the simulation is too narrow. PCG fills this "content gap" by providing a near-infinite variety of training scenarios.
PCG-based learning environments: (a) POET's bipedal walker, (b) Quake III CTF maps, (c) OpenAI's Rubik's cube hand, and (d) progressive difficulty in video games.

Key Results

  • Sim-to-Real Success: OpenAI demonstrated that a humanoid robot hand could solve a Rubik’s cube in the real world—despite never seeing a physical cube during training—by using Automatic Domain Randomization (ADR) to scale the complexity of the simulation.
  • Mastering Quake III: DeepMind’s agents achieved human-level performance in Capture the Flag by training on a mixture of procedurally generated indoor and outdoor maps, forcing them to learn general navigation and teamwork rather than map memorization.
  • Efficiency via PPCG: Research showed that agents trained with Progressive PCG could achieve higher performance with less data by always being challenged at the "edge" of their current capabilities.

Limitations and Future Work

  • The Data Scarcity Problem: Most PCGML methods require large datasets of existing levels (e.g., thousands of Mario levels), which don't always exist. Learning to generate from "small data" is a major open challenge.
  • Generating Complete Games: While we can generate levels or characters, generating a complete game—including a coherent set of rules, mechanics, and aesthetics—remains the "gold standard" and is currently out of reach.
  • Lifelong Learning: The authors propose moving toward "lifelong generation," where environments continuously complexify over an agent's entire "lifetime," mimicking the open-ended evolution seen in nature.

Summary updated

Abstract

Procedural Content Generation (PCG) refers to the practice, in videogames and other games, of generating content such as levels, quests, or characters algorithmically. Motivated by the need to make games replayable, as well as to reduce authoring burden, limit storage space requirements, and enable particular aesthetics, a large number of PCG methods have been devised by game developers. Additionally, researchers have explored adapting methods from machine learning, optimization, and constraint solving to PCG problems. Games have been widely used in AI research since the inception of the field, and in recent years have been used to develop and benchmark new machine learning algorithms. Through this practice, it has become more apparent that these algorithms are susceptible to overfitting. Often, an algorithm will not learn a general policy, but instead a policy that will only work for a particular version of a particular task with particular initial parameters. In response, researchers have begun exploring randomization of problem parameters to counteract such overfitting and to allow trained policies to more easily transfer from one environment to another, such as from a simulated robot to a robot in the real world. Here we review the large amount of existing work on PCG, which we believe has an important role to play in increasing the generality of machine learning methods. The main goal here is to present RL/AI with new tools from the PCG toolbox, and its secondary goal is to explain to game developers and researchers a way in which their work is relevant to AI research.
BibTeX
@inproceedings{risi2022procedural,
  author = {Sebastian Risi and Julian Togelius},
  title = {{Procedural Content Generation: From Automatically Generating Game Levels to Increasing Generality in Machine Learning}},
  booktitle = {Nature Machine Intelligence},
  year = {2022},
  url = {https://openreview.net/forum?id=guDYy6sWs9},
}
Figure