Nvidia recreates PAC-MAN using AI to celebrate its 40th anniversary from scratch

Written by Metal Messiah

Now, this is something very interesting.  In case you weren’t aware the Arcade classic “PAC-MAN” just turned 40, so in order to celebrate this anniversary, Nvidia partnered with Bandai Namco to recreate the game using its AI model known as “GameGAN”.

This version was created without a game engine, as it is a full version of the game purely based on the AI model’s observation of 50,000 games of PAC-MAN being played. Yes, you heard that correct, “without” the Game engine.

Nvidia researchers taught an AI system to recreate the game of Pac-Man simply by watching it being played.

“There was no coding involved, no pre-rendered images for the software to draw on. The AI model is simply fed visual data of the game in action along with the accompanying controller inputs and then recreates it frame by frame from this information. The resulting game is playable by humans, and Nvidia says it will be releasing it online in the near future”.

It learns all of these things just by watching,” NVIDIA’s Rev Lebaredian, vice president of simulation technology, stated in a briefing. “[It’s] similar to how a human programmer can watch many episodes of Pac-Man on YouTube and infer what the rules of the games are and reconstruct them.”

Although it’s not a perfect recreation of the title and all its assets, all the mechanics and gameplay goals are the same. NVIDIA even believes this is how AI will be applied to game creation in the future. Lebaredian also notes the experiment was done in collaboration with Bandai Namco as it celebrates the “40th anniversary” of the classic arcade game.

The artificial intelligence program is called GameGAN, with GAN standing for “generative adversarial network,” which is a common architecture used in machine learning. GAN works by attempting to replicate input data while also comparing its work to the original source. If the two don’t match, the data is rejected and the program looks for improvements and tries again.

Although AI programs have generated virtual gaming spaces before, GameGAN is able to use a “memory module” that allows the program to store an internal map of the digital space it’s trying to recreate, leading to a more consistent copy.

Sanja Fidler, director of Nvidia’s Toronto research lab states that GameGAN was trained on over 50,000 episodes in order to recreate Pac-Man, but the AI agent was so good at the game that it almost hardly ever died. “That made it hard for the AI trying to recreate the game to learn the concept of dying,” said Fidler.

NVIDIA says it will be releasing the recreated game online in the near future. The basic principle of a GAN is that it works in two halves. The first half of the GAN tries to replicate the input data, while the second half compares this to the original source. If they don’t match, the generated data is rejected and the generator tweaks its work and resubmits it.

But how exactly did all of this work? Well, GameGAN, in NVIDIA’s own words is “the first neural network model that mimics a computer game engine by harnessing generative adversarial networks, or GANs. Made up of two competing neural networks, a generator and a discriminator, GAN-based models learn to create new content that’s convincing enough to pass for the original. You may have experienced GANs by using NVIDIA GauGAN, a deep learning model developed by NVIDIA Research that turns rough doodles into photorealistic masterpieces with breathtaking ease“.

The first neural network, known as the generator, produces the data that will then be reviewed by the second neural network, the discriminator. The generator is essentially trying to trick the discriminator as frequently as possible. Once it accomplishes its threshold, the discriminator can be retrained in an effort to further improve the results of the GAN.

NVIDIA said that it used 4 x Tesla V100 GPUs to power the AI-made recreation of PAC-MAN, and had 4 days of training for the AI to work its magic. NVIDIA’s researchers added that the AI is similar to a child, where it gives the AI a simulated environment to work from, an environment which NVIDIA can control. As it learns, it adapts and gets used to its environment, just like a child will.

There’s obviously more GANs can do in games. One application we have already seen it used for is as a method for 4K upscaling of older titles.

So basically what NVIDIA is doing here is not exactly recreating the game (because it’s not taking any code of the game), it is just rather looking at it visually, and recreating it visually. There’s no “game” being “recreated” though.

The AI version is by no means a perfect facsimile though. The imagery is blurry and it doesn’t seem like the AI managed to capture the exact behavior of the game’s ghosts, each of which is programmed with a specific personality that dictates its movement. But the basic dynamics of Pac-Man are all there: eat pellets, avoid ghosts, and try not to die.

Using AI to generate virtual worlds like video games has been done before.  But Nvidia’s researchers introduced several new aspects, including a “memory module” that allowed the system to store an internal map of the game world. This leads to greater consistency in the game world, a key characteristic when recreating the mazes of Pac-Man. They also allow for the static elements of the game world (like the maze) to be separated from the dynamic ones (like the ghosts), which suits the company’s goal of using AI to generate new levels.