clock menu more-arrow no yes mobile

Filed under:

40 years after Pac-Man’s debut, Nvidia re-creates the game with AI

The AI figured out how Pac-Man works just by watching

Bandai Namco is celebrating Pac-Man’s 40th birthday all year long, but Friday is technically the big day: Namco began publicly testing Pac-Man in Tokyo arcades on May 22, 1980. A lot has changed in the intervening four decades, including, of course, the capabilities of computers. Artificial intelligence has advanced to the point of being able to drive cars and produce reasonably convincing “deepfakes” in both audio and video. Now it’s understanding how video games work just by watching them being played.

Nvidia Research announced Friday that it has produced a new iteration of Pac-Man that was generated entirely by AI. The company built an AI model that was able to create a fully functional, playable version of the seminal 8-bit arcade game without access to the underlying game engine. With no innate understanding of Pac-Man’s gameplay, the AI “trained” by watching sessions of Pac-Man — the official version from Bandai Namco — to learn the game’s rules and mechanics.

“We trained this artificial intelligence on 50,000 episodes of Pac-Man being played, without the AI actually seeing any of the code or anything — just seeing pixels coming out of the game engine,” said Rev Lebaredian, vice president of simulation technology at Nvidia, in a media briefing earlier this week. “It observed it just like a human might.”

a clip of a version of Pac-Man that was produced by an AI model called Nvidia GameGAN
A clip of a person playing the GameGAN version of Pac-Man. Note that the graphics have the blurry look that is typical of AI-generated imagery.
Image: Bandai Namco via Nvidia

The AI model in question is known as Nvidia GameGAN. It relies on generative adversarial networks (GAN), a common system in machine learning that pits two neural networks against each other for applications such as AI-generated images. And GameGAN is the first GAN to be able to reproduce a video game on its own, according to Nvidia.

“This is the first research to emulate a game engine using GAN-based neural networks,” said Seung-Wook Kim, an Nvidia researcher and the project lead for GameGAN, in an Nvidia blog post. “We wanted to see whether the AI could learn the rules of an environment just by looking at the screenplay of an agent moving through the game. And it did.”

Nvidia’s researchers gave GameGAN only two inputs: the footage of the Pac-Man play sessions (which comprised a few million frames) paired with data on the keystrokes used to control the game. The training took place over four days on an Nvidia DGX system, one of the company’s AI workstations, using four Nvidia Quadro GV100 GPUs.

By observing the gameplay in the 50,000 “episodes” of Pac-Man, GameGAN learned how the game works. It figured out that Pac-Man moves around the maze but can’t travel through walls; it learned that the ghosts chase Pac-Man, and that the game ends if one touches him; it understood that the ghosts turn blue when Pac-Man eats a power pellet, and that the pellet allows him to eat the ghosts.

The sessions in question were themselves played by an AI agent, not by humans — which ultimately resulted in the GameGAN version of Pac-Man being a somewhat inaccurate representation of the real thing. That’s because the AI agent playing the game was too good at it: “The Pac-Man almost never dies,” explained Sanja Fidler, director of Nvidia’s Toronto research lab and a co-author on the GameGAN project, during the briefing. “So the learned GameGAN that reproduces this game has this bias of never killing Pac-Man.”

What that means in practice is that if you’re playing the GameGAN version of Pac-Man, and you make a move that would ordinarily result in Pac-Man’s death, the AI goes out of its way to avoid that outcome — sometimes breaking the rules of the game to do so. For instance, it might change the game environment.

Sure, that’s a funny quirk, but Nvidia believes that GameGAN could have all kinds of real-world applications that would help people like game developers.

“We’re going to be applying this not just to 2D classic games like this, but also to modern 3D-style games, and even things that aren’t really games,” said Lebaredian. “We can see a road to much more complex simulators that are created from this fundamental idea.”

Lebaredian explained that GameGAN could be useful in developing an AI tool that assists artists with asset generation, which is some of the grunt work of game development (and a task that has grown significantly, as modern game worlds have become increasingly large and detailed).

Imagine being able to train an AI on the visual style and “rules” of a game world, and having it produce new art assets that make sense in the context of that world. Even procedural generation requires a lot of initial work to set up; GameGAN, said Lebaredian, is “potentially a way to short-circuit some of that work.”

“We could eventually have an AI that can learn to mimic the rules of driving, the laws of physics, just by watching videos and seeing agents take actions in an environment,” Fidler said in the Nvidia blog post. “GameGAN is the first step toward that.”

Nvidia plans to publicly release the GameGAN-generated version of Pac-Man this summer.


Sign up for the newsletter Sign up for Patch Notes

A weekly roundup of the best things from Polygon