Let’s-a Go, MarioGPT!

The Mushroom Kingdom just got a whole lot bigger with the MarioGPT level generator that uses a GPT-2 model to create fun new levels.

Nick Bild
2 years agoMachine Learning & AI
Automated game level design with MarioGPT (📷: S. Sudhakaran et al.)

Admittedly, the concept is a bit strange — an Italian plumber that battles turtle-like creatures to rescue the princess of the Mushroom Kingdom and break the spell cast on the Mushroom People. But to those who know and love Super Mario Bros. — and since it is one of the most played video games of all time, that is pretty much everyone — it makes perfect sense. The beloved characters, simple yet challenging gameplay, and catchy soundtrack still have gamers tapping away at their controllers almost 40 years after Super Mario Bros. was first released for the Nintendo Entertainment System (NES).

But for long-time Mario veterans that have beaten the game dozens of times, well, sometimes they wish there was a World 9 to play after watching Bowser plunge from the bridge and be defeated yet again. Not that there is anything wrong with Mario (blessed be his name) as originally conceived, but after all of these years, something new would be refreshing. A group at IT University of Copenhagen had the same feeling, and set out to do something about it. They developed a method to generate an unlimited number of tile-based game levels using a large language model called MarioGPT. And to generate the levels, a user only needs to describe what they want in plain English.

Automated game level design is not a new idea. A number of techniques, such as procedural content generation and genetic algorithms, have been used in the past, however, these methods tend to struggle when it comes to producing levels that are diverse, original, and playable. The developers of MarioGPT took a different approach to overcome these limitations. They fine-tuned OpenAI’s Generative Pre-trained Transformer 2 (GPT-2) model and trained it to create novel, playable tile-based game levels that can be controlled at a high level by providing simple text prompts, like "many pipes, many enemies, little blocks, low elevation."

The output of MarioGPT is further processed by a novelty search algorithm, which ensures that the system will continually produce diverse level designs. Since a level, no matter how creative, is no fun if it is impossible to complete, the team also added a playability test to the end of their pipeline to discard ill-conceived levels. Using Robin Baumgarten’s A* agent, each level is tested to ensure that it is possible to play through, given the game’s normal constraints. Using this tool showed that MarioGPT is a natural at creating good level designs — over 88% of levels tested out as playable right off the bat.

While it is true that MarioGPT generates an endless supply of new levels, that does not mean you can type a few words, click a button, and head off on another adventure through the Mushroom Kingdom. The output of the model is plain text that describes the elements that compose a level. If you want to play the level, you will still need to translate that design into 6502 assembly code compatible with the NES. If that sounds like something that is right up your alley, or if you just want to look at some new level designs and imagine what could have been, the researchers have released the source code and instructions on GitHub.

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles