Source-linked AI summary

Evolving Mario Levels in the Latent Space of a Deep Convolutional Generative Adversarial Network

Vanessa Volz, Jacob Schrum, Jialin Liu, Simon M. Lucas, Adam Smith, Sebastian Risi

arXiv:1805.00728v1cs.AIcs.NE

TL;DR

Automatic generation of game levels remains challenging, particularly when only an existing corpus is available for emulation. The paper trains a GAN on one Super Mario Bros level and evolves its latent vectors with CMA-ES using static and agent-based fitness functions. It generates varied Mario levels with high-level structure beyond direct replicas, while sometimes producing broken structures and relying on imperfect fitness measures.

  • Problem

    Automatic game-level generation with little or no human intervention is challenging, motivating methods that can learn from existing level corpora.

  • Method

    A GAN is trained unsupervised on one Super Mario Bros level, then CMA-ES evolves latent vectors using static properties and artificial-agent simulations as fitness functions.

  • Results

    The GAN captures basic Mario-level structure and evolves levels that are not merely replications of the training examples.

  • Takeaways & Limitations

    Latent variable evolution can generate Mario levels with different tile distributions, combinations of objectives, and agent-based evaluation criteria.

  • Takeaways & Limitations

    Fitness functions can be noisy and may not reflect desired difficulty: levels optimized for ground tiles or enemies may be unplayable or remain easy for agents.

Abstract

from arXiv · show

Generative Adversarial Networks (GANs) are a machine learning approach capable of generating novel example outputs across a space of provided training examples. Procedural Content Generation (PCG) of levels for video games could benefit from such models, especially for games where there is a pre-existing corpus of levels to emulate. This paper trains a GAN to generate levels for Super Mario Bros using a level from the Video Game Level Corpus. The approach successfully generates a variety of levels similar to one in the original corpus, but is further improved by application of the Covariance Matrix Adaptation Evolution Strategy (CMA-ES). Specifically, various fitness functions are used to discover levels within the latent space of the GAN that maximize desired properties. Simple static properties are optimized, such as a given distribution of tile types. Additionally, the champion A* agent from the 2009 Mario AI competition is used to assess whether a level is playable, and how many jumping actions are required to beat it. These fitness functions allow for the discovery of levels that exist within the space of examples designed by experts, and also guide the search towards levels that fulfill one or more specified objectives.

1 INTRODUCTION

The paper applies GAN-based procedural content generation to create Super Mario Bros. levels from expert-designed examples, then evolves latent vectors to target specified level properties.

  • Procedural Content Generation creates game content algorithmically, including rules, levels, characters, stories, textures, and sound.
  • The approach trains a GAN to emulate expert-designed game levels and applies CMA-ES to search its latent space for particular attributes.Latent variable evolution had not previously been applied to procedural generation of video game levels.
  • The study focuses on Super Mario Bros and trains its GAN using a single level from the Video Game Level Corpus.
  • CMA-ES evaluates generated levels with fitness functions to discover playable levels, optimize additional goals, and explore beyond the sparse examples designed by humans.

2 BACKGROUND AND RELATED WORK

The background frames automatic game-level generation as a challenging PCG problem and motivates combining GAN latent spaces with fitness-based evolutionary search.

  • 2.1 Procedural content generation: Automatic game-level generation with little or no human intervention is challenging across games such as Doom, Pac-Man, and Super Mario Bros.
  • 2.1 Procedural content generation: Prior Mario level-generation approaches used Grammatical Evolution, LSTMs with player-path information, and auto-encoders trained on existing levels.
  • 2.2 Generative Adversarial Networks: GANs learn a generator-discriminator adversarial process, after which the generator maps latent vectors to novel outputs resembling the training examples.
  • 2.3 Latent variable evolution: Latent variable evolution searches a GAN’s real-valued latent space to select among meaningful variations, extending prior image-focused work to game-level generation.
  • 2.4 CMA-ES: CMA-ES is suited to optimizing real-valued vectors on nonlinear, non-convex problems without assuming a smooth fitness landscape.
  • 2.4 CMA-ES: The paper applies CMA-ES with fitness functions based on static level properties or artificial-agent game simulations.

3 APPROACH

The approach trains a DCGAN on sliding windows from one Mario level, represents tiles numerically and with one-hot encoding, then evolves latent vectors to generate targeted levels.

  • 3 APPROACH: The pipeline has two phases: adversarially train a GAN on an existing Mario level, then search latent vectors for levels with desirable properties.
  • 3 APPROACH: The generator maps a 32-dimensional real-valued latent vector to a tile-level Mario representation that CMA-ES can evolve.
  • 3.1 Level representation: Each tile type is encoded as an integer, expanded into a one-hot vector for the discriminator, and mapped back to Mario AI values for rendering and simulation.
  • 3.1 Level representation: Training data consists of 173 images created by sliding a 28 × 14 window across a 14-tile-high VGLC level one tile at a time.
  • 3 APPROACH: The small dataset supports testing whether the method learns from limited data and generates properties not directly present in the training set.
  • 3.2 GAN training: The DCGAN uses strided convolutions in the discriminator, fractional-strided convolutions in the generator, and batch normalization after each layer.
  • 3.2 GAN training: The GAN’s 10 × 32 × 32 output is cropped to 10 × 28 × 14 and decoded by argmax into a Mario AI-compatible level.

4 EXPERIMENTS

The experiments test CMA-ES optimization of Mario levels using static tile properties and agent-based playthrough measures. The agent-based evaluation explicitly targets playability and scalable difficulty, while the representation-based approach has important limitations.

  • Experimental design: The experiments comprise representation-based and agent-based testing, serving as a proof of concept for the proposed approach.Applying the approach in a game would require fitness functions designed for the intended purpose and desired generated-content properties.
  • Representation-based testing: CMA-ES evolves tile distributions, including target ground coverage and combined ground-and-enemy configurations across five subsections.The second experiment uses 100% ground coverage in sections 1–2 and 70% in sections 3–5; sections 4–5 also maximize enemy count.
  • Representation-based testing: Representation-based fitness can produce levels that are unplayable or whose ground and enemy counts fail to determine human or agent difficulty.Enemies may fall into holes, or alternative routes may avoid difficult jumps.
  • Agent-based testing: Agent-based testing maps a latent vector through a sigmoid into [−1, 1]n, generates a level, and evaluates it in the Mario AI framework.This playthrough-based evaluation was introduced to test playability directly and observe playthrough characteristics.
  • Agent-based testing: The A* agent’s level progress determines playability, while jump actions approximate experienced difficulty; additional experiments seek playable levels requiring minimal jumps.The jump–difficulty relationship is explicitly treated as an assumption, although jumping is required to overcome holes and enemies.
  • Agent-based testing: The incomplete-level offset of 60 makes passable levels score higher than impassable ones, while jump counts are averaged over 10 simulations to reduce nondeterministic outliers.CMA-ES uses population size λ = 14 and runs for at most 1,000 function evaluations; the study reports 20 non-agent runs and 40 runs for each agent-based fitness function.

5 RESULTS

The GAN generates diverse Mario level layouts with local variation, while CMA-ES searches its latent space for levels meeting structural and agent-based objectives. The approach can optimize tile distributions, enemy placement, and jump-based playability criteria, but generated levels may contain non-playable or visually broken structures.

  • GAN expressivity and locality: The GAN generates varied level layouts whose local mutations remain similar to their parent vectors.Some structural elements, such as pipes, are not always captured perfectly.
  • Representation-based testing: The approach comes very close to targeted ground-tile percentages in almost every run, except at a 20% ground fraction.Figure 5 reports means across 20 runs with one standard deviation.
  • Agent-based testing: Agent-based optimization discovers playable levels requiring either many or few jumps, but also produces non-playable levels and broken tile structures.The F2 example requires one jump, while some high-fitness F1 individuals contain slight tile errors.
  • Discussion and future work: The optimization remains controllable despite a noisy difficulty approximation, although further fitness-function and noisy-optimization improvements may increase efficiency.The average fitness of generated individuals decreases as iterations increase, while some low-scoring individuals appear late in optimization.
  • Discussion and future work: GANs capture basic Mario-level structure and evolve levels beyond direct training-example replications, but incomplete pipes and fitness-design constraints remain limitations.The paper also notes that evaluating fitness is time-consuming and that richer player-behavior data could support design annotations.

6 CONCLUSION

The paper presents latent variable evolution as a way to evolve Mario levels for tile distributions and agent-based objectives, while acknowledging occasional broken structures. It concludes that the approach is promising for fast video-game level generation and may extend to other genres.

  • Latent variable evolution evolves new Mario levels after unsupervised training on an existing Mario level.
  • The approach optimizes different tile-type distributions and agent-based evaluation functions.
  • The GAN often captures the training level’s high-level structure but sometimes produces broken structures.
  • LVE is presented as a promising approach for fast generation of video-game levels that could extend to other game genres.
Loading 1805.00728v1…