Learning to Simulate Dynamic Environments With GameGAN

Seung Wook Kim, Yuhao Zhou, Jonah Philion, Antonio Torralba, Sanja Fidler

Abstract

GameGAN is a generative model designed to mimic the visual rendering and underlying logic of a game engine by observing gameplay videos and player actions. Utilizing a novel memory module and a disentangled rendering architecture, GameGAN simulates complex, spatially consistent environments such as Pac-Man and VizDoom. This approach enables high-fidelity simulation and "component swapping," where game dynamics can be re-rendered with entirely different visual styles.

Introduction

Building simulators for robotics or AI testing is traditionally a labor-intensive process requiring manual coding of physics, object behaviors, and rendering rules. While "World Models" have attempted to learn these environments from data, they often suffer from visual drift—producing blurry images over time—and a lack of long-term memory, leading to inconsistent environments when an agent revisits a location. GameGAN addresses these challenges by learning a high-fidelity, spatially consistent simulator directly from raw pixels and action sequences.

Methods

GameGAN consists of three primary neural components trained end-to-end within a Generative Adversarial Network (GAN) framework:

  1. Dynamics Engine: An action-conditioned LSTM that predicts the next internal state based on the current action and a latent noise variable.
  2. Memory Module: Inspired by Neural Turing Machines, this module maintains a 2D feature map of the environment. It allows the model to "write" static features (like walls) to specific coordinates and "read" them back, ensuring long-term spatial consistency.
  3. Rendering Engine: A specialized architecture using SPADE (Spatially-Adaptive Normalization) layers to disentangle static backgrounds from dynamic actors, ensuring crisp visual output.
The GameGAN architecture featuring the Dynamics Engine, Memory Module, and Rendering Engine.

To ensure the separation of background and foreground, the authors introduced a Temporal Cycle Loss, which encourages the memory to store only persistent environmental features.

Key Insights: Learning Logic and Disentanglement

GameGAN does more than predict frames; it learns the fundamental rules of the environment. In Pac-Man, for instance, it learns that the agent cannot pass through walls and that ghosts change behavior upon consuming a power pellet. Because the model disentangles static and dynamic elements, it supports "component swapping"—rendering Pac-Man's logic using Doom's textures or a forest environment.

Visualization of the memory module tracking the agent's location and updating the generated image over time.

Results and Evaluation

The model was evaluated on Pac-Man, procedurally generated mazes, and the 3D VizDoom environment. Key findings include:

  • Long-term Consistency: In "come-back-home" tasks, GameGAN accurately reconstructed starting rooms after long random walks, significantly outperforming standard LSTMs.
  • Functional Simulation: Reinforcement Learning agents trained entirely within the GameGAN simulator performed nearly as well as those trained on the original game engine when transferred to the real game.
  • Visual Fidelity: GameGAN produced sharper images compared to VAE-based models, which often struggle with blurriness during rapid movement.

Conclusion and Future Work

While GameGAN successfully captures complex game mechanics, challenges remain in scaling to massive open-world environments and handling high levels of stochasticity. Future research aims to extend these models to complex real-world robotic environments, potentially revolutionizing how simulators are built for autonomous systems.

Summary updated

BibTeX
@inproceedings{kim2020learning,
  author = {Seung Wook Kim and Yuhao Zhou and Jonah Philion and Antonio Torralba and Sanja Fidler},
  title = {{Learning to Simulate Dynamic Environments With GameGAN}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  doi = {10.1109/cvpr42600.2020.00131},
}
Figure