Evolving Personalized Content for Super Mario Bros Using Grammatical Evolution

Noor Shaker, Georgios N. Yannakakis, Julian Togelius, Miguel Nicolau, Michael O'Neill

TL;DR

Researchers have developed a system that uses Grammatical Evolution to procedurally generate Super Mario Bros levels tailored to a player's specific emotional state. By using machine learning models as fitness functions, the system can evolve levels designed to maximize engagement, minimize frustration, or provide the perfect level of challenge based on an individual's unique playing style.

What Problem Does This Paper Address?

Procedural Content Generation (PCG) in games often focuses on "offline" generation—creating a bunch of levels before the game is ever played—or simple Dynamic Difficulty Adjustment (DDA), which only tweaks how hard a game is.

However, "fun" isn't just about difficulty. A level that is challenging for an expert might be frustrating for a novice, and a level that is engaging for one person might be boring for another. The authors address the gap in personalized, online content generation. They want a system that can sense how a specific person plays and then evolve new content that targets complex emotional states like engagement and frustration, rather than just sliding a difficulty scale up or down.

Methods

The core of the approach is Grammatical Evolution (GE). GE is a type of evolutionary algorithm that uses a "grammar" (a set of rules) to define the search space.

  1. The Grammar: The authors defined a design grammar for Infinite Mario Bros that describes levels as a series of "chunks" (e.g., gaps, pipes, cannons, coin rows).
  2. The Fitness Function: This is the most novel part. Instead of a human designer deciding what a "good" level looks like, the authors used Player Experience Models developed in their previous research. These models were trained on data from over 1,500 human gameplay sessions to predict how a player would feel based on six content features (like the number of enemies or gap width) and their specific playing style.
  3. The Loop: To test the system without needing thousands of human hours, they used two different AI agents: an "expert" A* search agent and a "heuristic" agent (Sergio’s agent) that plays more like an average human.
Comparison of playstyle metrics between the A* expert agent and Sergio's heuristic agent.

The system records an agent's playstyle on a test level, then evolves 100 new levels specifically to maximize a target emotion (e.g., "Make a level that is highly engaging for the A* agent").

Datasets

  • Training Data: The fitness models (the "judges" of the evolution) were built using a pre-existing dataset of crowd-sourced gameplay data from over 1,500 game sessions.
  • Evaluation Data: The authors generated and analyzed 100 levels for each of the two AI agents across three emotional categories (Engagement, Frustration, Challenge), resulting in a dataset of evolved levels and predicted emotional responses used for the statistical analysis in this paper.

Key Insights and Ideas

  • Skill-Dependent Engagement: The system discovered that "engagement" looks different for different players. For the expert A* agent, the most engaging levels were packed with gaps and enemies. For the average "Sergio" agent, engagement was maximized by flatter levels with more coins.
  • The Challenge/Engagement Gap: One of the most important findings is that challenging levels are not necessarily engaging. While the system could evolve levels that were both, it also found that some challenging levels actually decreased predicted engagement, particularly for less skilled players.
  • Frustration is Complex: For the expert agent, engagement and frustration were positively correlated (a "good" kind of stress). For the average agent, they were strongly negatively correlated—frustration killed the fun.
  • Asymmetric Optimization: The authors found it was significantly easier to generate highly engaging and challenging levels for the "expert" agent than for the "average" agent. This suggests that high-level play provides a clearer signal for the evolutionary algorithm to latch onto.

Key Results

  • High Predictive Accuracy: The evolved levels achieved high predicted fitness scores across the board. For example, levels evolved for engagement reached average predicted scores of 78.23% for the A agent and 74.01%* for the Sergio agent.
Predicted fitness scores for 100 levels evolved specifically to maximize engagement for the A* agent.
  • Distinct Level Archetypes: The GE successfully created visually distinct levels based on the target emotion. "Frustrating" levels for both agents tended to have a high density of enemies placed specifically around gaps to knock the player into a pit.
  • Statistical Validation: Correlation analysis confirmed that the system could successfully distinguish between the three emotional states, showing that optimizing for one (like frustration) often had predictable, measurable effects on the others (like challenge).

Limitations and Future Work

  • Model Expressivity: The fitness models were originally trained on a different, simpler level generator. The authors note that using these models on the more complex GE-based levels provides an estimation of quality, but might not be perfectly accurate.
  • The "Human" Factor: While AI agents are great for testing the mechanics of evolution, the authors acknowledge the need for a large-scale study with human players to see if the "predicted" engagement actually matches "felt" engagement.
  • Multi-Objective Evolution: Currently, the system optimizes for one emotion at a time. Future work could involve multi-objective optimization—for example, trying to maximize engagement while strictly minimizing frustration.

Summary updated

BibTeX
@inproceedings{shaker2012evolving,
  author = {Noor Shaker and Georgios N. Yannakakis and Julian Togelius and Miguel Nicolau and Michael O'Neill},
  title = {{Evolving Personalized Content for Super Mario Bros Using Grammatical Evolution}},
  booktitle = {AIIDE},
  year = {2012},
}
Figure