Learning Controllable 3D Level Generators

Zehua Jiang, Sam Earle, Michael Cerny Green, Julian Togelius · DOI

Abstract

Researchers from NYU have successfully extended Procedural Content Generation via Reinforcement Learning (PCGRL) into three-dimensional environments using Minecraft. By training agents to build levels based on functional goals—such as maximizing path length or ensuring connectivity—rather than mimicking human-authored data, they have created "controllable" generators that adapt to specific design constraints like gravity and verticality.

Introduction

Procedural Content Generation (PCG) is a cornerstone of expansive games like Minecraft and No Man’s Sky, yet traditional methods often struggle with "functional" constraints. While it is relatively straightforward to generate a level that aesthetically resembles a cave, ensuring that the space is traversable, maintains a specific difficulty, or contains a path of a precise length is significantly more complex.

While PCGRL has shown promise in 2D environments, 3D spaces introduce a massive jump in complexity. Designers must account for gravity (where paths may become one-way if a player falls), occlusion, and a significantly larger search space. This research explores whether reinforcement learning and evolutionary algorithms can learn to "design" 3D spaces that are both functional and user-controllable.

Methods

The authors tested two primary approaches within a 7×7×7 voxel space in Minecraft:

  1. Reinforcement Learning (PPO): Using Proximal Policy Optimization, an agent "scans" the 3D grid and decides whether to place a block or leave it as air. The agent is rewarded based on how much its edits improve a specific metric, such as increasing the shortest path between two doors.
  2. Evolutionary Neural Cellular Automata (NCA): Instead of a single scanning agent, every cell in the grid updates itself based on its neighbors. These are evolved using MAP-Elites, a quality diversity algorithm that seeks the best generators across a spectrum of features, such as level density.

To handle 3D navigation, the authors implemented custom pathfinding logic that accounts for Minecraft-specific physics, including jumping, falling, and headroom requirements. The agents were trained on-the-fly without human datasets, using the Evocraft framework for rendering.

Key Insights and Ideas

  • The "Staircase" Emergence: When tasked with maximizing the path between two points, agents naturally discovered that a spiral staircase is the most efficient way to "pack" a long path into a small 3D volume.
A complex 3D path generated by the RL agent, showcasing the emergence of vertical structures like staircases.
  • Gravity and Playability: Unlike 2D grids where movement is typically reversible, 3D paths are often one-way. Agents had to learn to build structures that allow for "climbability" to ensure levels remained playable.
  • Controllability vs. Capability: While RL agents were highly controllable—successfully providing a path of length 15 when requested—they encountered a "performance ceiling" when attempting to generate the extremely complex, winding paths required for high-end targets.
  • The Necessity of Dense Rewards: To make 3D training viable, the authors used a "loss-difference" reward system. Rather than only rewarding the agent at the end of a build, they provided rewards for every block placement that brought the level closer to the target metric.

Key Results

  • Door Connection: RL agents successfully learned to connect two doors placed randomly on the 7x7x7 border. Success was highest when doors were diagonally opposite, allowing for the longest natural paths.
The generator creates multiple functional paths, illustrating the controllable nature of the PCGRL approach.
  • Dungeon Logic: In dungeon tasks, agents learned to place a "chest" (the goal) and "pumpkins" (enemies) while ensuring a traversable path existed from the entrance to the chest and then to the exit.
  • NCA Diversity: The evolutionary approach successfully produced a wide variety of generators. It revealed that the most diverse structures typically exist in the middle-ground of density—neither too crowded nor too sparse.

Conclusion and Future Work

The primary limitation of this approach is scale; a 7×7×7 grid is small compared to standard game levels. Scaling to 32x32x32 or larger will require more efficient architectures, potentially utilizing hierarchical RL. Additionally, while the current agents use a limited block palette, future work could involve "mixed-initiative" tools where human designers place "anchor" blocks and the AI generator fills in the remaining space while maintaining functional constraints.

Summary updated

BibTeX
@inproceedings{jiang2022learning,
  author = {Zehua Jiang and Sam Earle and Michael Cerny Green and Julian Togelius},
  title = {{Learning Controllable 3D Level Generators}},
  booktitle = {FDG},
  year = {2022},
  doi = {10.1145/3555858.3563273},
}
Figure