Abstract
In this work, we consider the problem of procedural content generation for video game levels. Prior approaches have relied on evolutionary search (ES) methods capable of generating diverse levels, but this generation procedure is slow, which is problematic in real-time settings. Reinforcement learning (RL) has also been proposed to tackle the same problem, and while level generation is fast, training time can be prohibitively expensive. We propose a framework to tackle the procedural content generation problem that combines the best of ES and RL. In particular, our approach first uses ES to generate a sequence of levels evolved over time, and then uses behaviour cloning to distil these levels into a policy, which can then be queried to produce new levels quickly. We apply our approach to a maze game and Super Mario Bros, with our results indicating that our approach does in fact decrease the time required for level generation, especially when an increasing number of valid levels are required.
Introduction
Procedural Content Generation (PCG) is a cornerstone of modern game design, enabling the infinite worlds of Minecraft and the dynamic environments of roguelikes. However, developers typically face a trade-off between two primary methodologies:
- Evolutionary Search (ES): Genetic algorithms excel at finding diverse, playable content by evolving populations. However, they are computationally intensive and often too slow for real-time generation.
- Reinforcement Learning (RL): While trained RL agents can generate levels near-instantly, the training process is often prohibitively expensive, requiring millions of iterations and complex, handcrafted reward functions.
This paper introduces a hybrid framework designed to bridge this gap, combining the diversity and ease of setup found in ES with the execution speed of a trained policy.
Methodology
The proposed framework operates in three distinct phases:
Phase 1: Evolutionary Search (The Teacher)
The process begins with a standard Genetic Algorithm (GA) to generate a set of "acceptable" levels. A level is deemed acceptable if its fitness score—calculated based on playability and structural interest—surpasses a predefined threshold.
Phase 2: Policy Creation (The Distillation)
The core innovation lies in treating the GA's optimization path as a set of "expert demonstrations." By analyzing the sequence of tile changes from a random seed to a finished level, the researchers create a dataset for Behaviour Cloning (BC). This maps specific level states to the optimal actions needed to improve them.
Phase 3: Policy Execution (The Student)
To generate a new level, the system starts with a random grid and queries the learned policy. A Nearest Neighbour algorithm identifies the most similar state in the training data to determine the next action. To avoid infinite loops and increase efficiency, the system applies "temporally extended actions," making batches of changes before re-evaluating the state.
Experimental Setup
The framework was evaluated in two environments:
- Maze Domain: Grid-based worlds (10x10 to 50x50) where the objective is to ensure a valid path exists between two points.
- Super Mario Bros: Utilizing the AMIDOS2006 Mario AI framework. These complex levels (101 x 16 tiles) require managing diverse tile types (pipes, enemies, coins) while ensuring the level is beatable by an AI agent.
Key Results and Insights
- Significant Speedup: In the Maze domain, the BC approach vastly outperformed the GA in wall-clock time as level size increased. Similarly, for Super Mario Bros, the policy generated playable levels much faster than repeated GA runs.
- Scalability: Because the policy uses a lookup-style Nearest Neighbour approach, it scales more gracefully to larger maps than GAs, which suffer from exponential search space growth.
- Generalization: The policy did not merely replicate training levels. It successfully learned the underlying logic of level transformation, allowing it to turn unique random seeds into novel, playable maps.
- Quality Sensitivity: Performance is highly dependent on training data quality. The policy becomes significantly more robust when the GA is required to produce a population where 100% of levels meet the fitness threshold.
Conclusion and Future Work
While the current framework uses a simple Nearest Neighbour approach, future iterations could utilize Deep Neural Networks (such as CNNs) for better generalization. Additionally, exploring "macro-actions" (e.g., placing entire structures like pipes) could further accelerate generation. This method successfully demonstrates that optimization processes can serve as "experts" for behavior cloning, removing the need for human demonstrations or complex RL reward engineering.
Summary updated