Prompt-conditioned generations from a single seed block. MarioGPT is able to create diverse levels solely based on a text prompt in natural language. Credit: arXiv (2023). DOI: 10.48550/arxiv.2302.05981

A team of computer programmers at IT University of Copenhagen has developed a new way to encode and generate Super Mario Bros. levels—called MarioGPT, the new approach is based on the language model GPT-2. The group outlines their work and the means by which others can use their system in a paper on the arXiv pre-print server.

Mario Brothers is a first introduced in 1983—it involves two Italian plumbers emerging from a sewer and attempting to rescue Princess Peach, who has been captured and held by Bowser. To rescue her, the brothers must travel (via input from the game player) across a series of obstacles made of pipes and bricks. As they travel, the terrain changes in accordance with the level they have achieved in the game. In this new effort, the team in Denmark has recreated one aspect of the game—the number of levels that can be traversed.

The researchers used Generative Pre-trained Transformer 2 (GPT-2)—an open-source language created by a team at OpenAI, to translate user requests into graphical representations of Super Mario Brothers game levels. To do so, they created a small bit of Python code to help the language model understand what needed to be done and then trained it using samples from the original Super Mario Bros. game and one of its sequels, "Super Mario Bros.: The Lost Levels."

After prompting for style of play, MarioGPT generates a new level of the game. Responses to prompts can include phrases such as "many pipes, many enemies, little blocks, low elevation." The team posted the code and instructions for encoding and generating levels on GitHub. Users can generate any number of levels they desire.

In related news, a team at New York University Tandon, working with a colleague from the University of the Witwatersrand, conducted similar work that involved using large language models to generate and play versions of the game Sokoban, in which players push boxes around in a warehouse—they describe their work in a paper on the arXiv preprint server.

More information: Shyam Sudhakaran et al, MarioGPT: Open-Ended Text2Level Generation through Large Language Models, arXiv (2023). DOI: 10.48550/arxiv.2302.05981

Graham Todd et al, Level Generation Through Large Language Models, arXiv (2023). DOI: 10.48550/arxiv.2302.05817

MarioGPT: github.com/shyamsn97/mario-gpt

Journal information: arXiv