Learning Constructive Primitives for Online Level Generation and Real-time Content Adaptation in Super Mario Bros

Ke Chen, Peizhi Shi, Ke Chen 0001arXiv 2015

Abstract

Procedural Content Generation (PCG) for platformers like Super Mario Bros (SMB) often faces a trade-off between quality, generation speed, and designer controllability. This paper presents a hybrid framework that utilizes "Constructive Primitives" (CPs)—short, high-quality level segments—to enable rapid online level generation and dynamic difficulty adjustment. By combining handcrafted conflict resolution rules with a Weighted Random Forest classifier trained via active learning, the system identifies valid game segments from a vast content space. These segments are then stitched together in real-time using a Markov Decision Process (MDP) to match player skill. Experimental results demonstrate that the generator can produce diverse, playable levels in approximately 57 milliseconds with a low error rate, facilitating seamless real-time content adaptation.

Introduction

The "holy grail" of game design is the ability to create infinite, high-quality content on the fly. However, current level generators for SMB typically suffer from a trilemma: they are either high-quality but computationally expensive (search-based), fast but lacking in diversity or playability (grammar-based), or controllable but difficult to author. Specifically, many generators struggle with quality assurance (e.g., unreachable enemies), efficiency for real-time use, and fine-grained controllability.

To address these gaps, the researchers propose a pipeline that moves from random sampling to intelligent level construction using Constructive Primitives.

Methods

The proposed framework generates levels by selecting and sequencing short (20x15 tile) segments that have been pre-vetted for quality.

The pipeline for learning Constructive Primitives (CPs) from a raw content space.

1. Content Space and Conflict Resolution

A 20x15 tile segment is represented as an 85-dimensional feature vector capturing the coordinates and types of enemies, tubes, gaps, and items. Initially, handcrafted rules are applied to resolve immediate conflicts, such as overlapping objects or unreachable platforms, filtering out "obviously" invalid segments.

2. Active Learning for Quality Evaluation

To address subjective quality—such as whether a segment is "fun" or "aesthetically pleasing"—a Weighted Random Forest (WRF) classifier is employed. To minimize human labeling effort, an Active Learning approach is used. The model identifies segments where its prediction uncertainty is highest and requests human annotation for those specific points. This allowed the training of a robust evaluator with only 1,100 annotated examples.

3. Online Generation and Adaptation

Levels are constructed by selecting CPs that satisfy designer-defined parameters: Leniency (difficulty), Density (structural complexity), and Linearity (path flatness). For real-time Dynamic Difficulty Adjustment (DDA), the system utilizes Thompson Sampling within an MDP. It tracks player survival rates and selects CPs to maintain a target difficulty "sweet spot" (e.g., an 80% survival rate).

Results

The system was evaluated using a modified version of Infinite Mario Bros.

Efficiency and Accuracy

The generator produces a full level in just 0.057 seconds, making it suitable for seamless online generation. The WRF classifier achieved a Half Total Error Rate (HTER) of 11.67%. Notably, the Type-II error rate (the probability of accepting a "bad" segment) was kept very low (~3.69%), ensuring that unplayable content rarely reaches the player.

Error rates of the classifier as a function of the number of annotated points, showing rapid convergence with active learning.

Expressive Range and Adaptation

Compared to existing generators like Launchpad, this approach offers a wider expressive range in terms of density and leniency. In simulations with AI agents, the MDP successfully adjusted difficulty levels: lowering challenges for novice agents to ensure completion and increasing them for expert agents.

Discussion and Conclusion

The success of this approach lies in the "Power of the Primitive." By focusing on 20-tile segments rather than entire levels, the content space becomes manageable for both rules and machine learning. The synergy between handcrafted rules (for objective constraints) and active learning (for subjective quality) significantly reduces the human authorship bottleneck.

Future work will address the "Pro Player Problem," where highly skilled agents provide insufficient failure data for the adaptation algorithm, and explore the application of Constructive Primitives to more complex genres like First-Person Shooters.

Summary updated

BibTeX
@misc{chen2015learning,
  author = {Ke Chen and Peizhi Shi and Ke Chen},
  title = {{Learning Constructive Primitives for Online Level Generation and Real-time Content Adaptation in Super Mario Bros}},
  year = {2015},
  eprint = {1510.07889},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1510.07889},
}
Figure