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 creation of vast, replayable worlds in titles like Minecraft. However, developers face a trade-off between two primary methodologies. Evolutionary Search (ES), such as Genetic Algorithms (GA), excels at discovering diverse and playable content but is computationally intensive and often too slow for real-time generation. Conversely, Reinforcement Learning (RL) provides near-instant generation once a policy is trained, but the training process itself is often prohibitively expensive and requires complex, handcrafted reward functions.
This paper proposes a hybrid framework that leverages the creative diversity of evolution to "teach" a fast-executing policy via Behaviour Cloning (BC), effectively distilling the expensive search process into an efficient generative model.
Methodology
The proposed framework operates in three distinct phases designed to bridge the gap between search-based and learning-based PCG.
Phase 1: Evolutionary Search as the Expert
Instead of relying on human demonstrations, the system uses a Genetic Algorithm to generate "expert" data. The GA evolves a population of random levels through iterative cycles of crossover, mutation, and elitism until a set of levels meeting a specific fitness threshold is produced.
Phase 2: Policy Distillation via Behaviour Cloning
The levels generated by the GA are treated as a series of expert demonstrations. By analyzing the transitions from initial random states to final evolved levels, the system extracts a sequence of "actions"—specifically, tile-level changes. These demonstrations are then used to train a policy via Behaviour Cloning. In this study, a nearest-neighbor algorithm was employed to map level states to the optimal actions required to improve their fitness.
Phase 3: Policy Execution
To generate a new level, the system starts with a random grid and iteratively queries the trained BC policy. To enhance stability and prevent infinite loops, the researchers implemented "temporally extended actions," where the policy applies a sequence of changes before re-evaluating the state.
Experimental Setup
The framework was evaluated in two distinct environments:
- Maze Domain: A custom environment focused on creating solvable mazes with specific wall densities. Tests were conducted on grid sizes ranging from 10x10 to 50x50.
- Super Mario Bros: Utilizing the amidos2006 Mario AI framework, the system generated levels (101x16 tiles) that required successful navigation from start to finish while incorporating game elements like power-ups.
Key Results and Discussion
The hybrid approach demonstrated significant advantages over standalone evolutionary search:
- Computational Efficiency: In the Maze domain, the BC policy scaled much more effectively than the GA. While the GA's computation time grew exponentially with maze size, the policy maintained high speed.
- Generalization: The policy successfully generalized to novel, random starting states, producing unique and playable levels that were not merely replicas of the training data.
- Quality Dependency: A critical observation was that the policy's effectiveness is directly proportional to the quality and diversity of the GA's initial output. A robust set of high-quality "expert" levels is necessary to train a resilient policy.
Conclusion
By using Evolutionary Search as an automated expert for Behaviour Cloning, this research provides a viable path for real-time procedural content generation. While the current implementation uses a simple nearest-neighbor model, future work could integrate deep learning architectures like CNNs or Transformers to capture more complex spatial relationships. Additionally, moving from single-tile changes to "macro" actions (e.g., placing entire biomes) could further enhance the system's capabilities.
Summary updated