# AI Dungeon

AI Dungeon is a single-player/multiplayer text adventure game which uses artificial intelligence (AI) to generate content and allows players to create and share adventures and custom prompts. The game's first version was made available in May 2019, and its second version (initially called AI Dungeon 2) was released on Google Colaboratory in December 2019. It was later ported that same month to its current cross-platform web application. The AI model was then reformed in July 2020.

## Gameplay

AI Dungeon is a text adventure game that uses artificial intelligence to generate random storylines in response to player-submitted stimuli.
In the game, players are prompted to choose a setting for their adventure (e.g. fantasy, mystery, apocalyptic, cyberpunk, zombies), followed by other options relevant to the setting (such as character class for fantasy settings).
After beginning an adventure, four main interaction methods can be chosen for the player's text input:
* Do: Must be followed by a verb, allowing the player to perform an action.
* Say: Must be followed by dialogue sentences, allowing players to communicate with other characters.
* Story: Can be followed by sentences describing something that happens to progress the story, or that players want the AI to know for future events.
* See: Must be followed by a description, allowing the player to perceive events, objects, or characters. Using this command creates an AI generated image, and does not affect gameplay.
The game adapts and responds to most actions the player enters. Providing blank inputs can be used to prompt the AI to generate further content, and the game also provides players with options to undo or redo or modify recent events to improve the game's narrative. Players can also tell the AI what elements to "remember" for reference in future parts of their playthrough.

### User-generated content

In addition to AI Dungeon's pre-configured settings, players can create custom "adventures" from scratch by describing the setting in text format, which the AI will then generate a setting from.
These custom adventures can be published for others to play, with an interface for browsing published adventures and leaving comments under them.

### Multiplayer

AI Dungeon includes a multiplayer mode in which different players each have their own character and take turns interacting with the AI within the same game session. Multiplayer supports both online play across multiple devices or local play using a shared device.
The game's hosts are able to supervise the AI and modify its output.
Unlike the single-player game, in which actions and stories use second person narration, multiplayer game stories are presented using third-person narration.

### Worlds

AI Dungeon allows players to set their adventures within specific "Worlds" that give context to the broader environment where the adventure takes place. This feature was first released with two different worlds available for selection: Xaxas, a "world of peace and prosperity"; and Kedar, a "world of dragons, demons, and monsters".

## Development
### AI Dungeon Classic (Early GPT-2)

The first version of AI Dungeon (sometimes referred to as AI Dungeon Classic) was designed and created by Nick Walton of Brigham Young University's "Perception, Control, and Cognition" deep learning laboratory in March 2019 during a hackathon. Before this, Walton had been working as an intern for several companies in the field of autonomous vehicles.
This creation used an early version of the GPT-2 natural-language-generating neural network, created by OpenAI, allowing it to generate its original adventure narratives. During his first interactions with GPT-2, Walton was partly inspired by the tabletop game Dungeons & Dragons (D&D), which he had played for the first time with his family a few months earlier:
   "I realized that there were no games available that gave you the same freedom to do anything that I found in [Dungeons & Dragons] ... You can be so creative compared to other games."
This led him to wonder if an AI could function as a dungeon master.
Unlike later versions of AI Dungeon, the original did not allow players to specify any action they wanted. Instead, it generated a finite list of possible actions to choose from.
This first version of the game was released to the public in May 2019. It is not to be confused with another GPT-2-based adventure game, GPT Adventure, created by Northwestern University neuroscience postgraduate student Nathan Whitmore, also released on Google Colab several months after the public release of AI Dungeon.

### AI Dungeon 2 (Full GPT-2)

In November 2019, a new, "full" version of GPT-2 was released by OpenAI. This new model included support for 1.5 billion parameters (which determine the accuracy with which a machine learning model can perform a task), compared with the 126 million parameter version used in the earliest stages of AI Dungeon's development. The game was recreated by Walton, leveraging this new version of the model, and temporarily rebranded as AI Dungeon 2.
AI Dungeon 2's AI was given more focused training compared to its predecessor, using genre-specific text. This training material included approximately 30 megabytes of content web-scraped from chooseyourstory.com (an online community website of content inspired by interactive gamebooks, written by contributors of multiple skill levels, using logic of differing complexity) and multiple D&D rulebooks and adventures.
The new version was released in December 2019 as open-source software available on GitHub. It was accessible via Google Colab, an online tool for data scientists and AI researchers that allows for free execution of code on Google-hosted machines. It could also be run locally on a PC, but in both cases, it required players to download the full model, around 5 gigabytes of data. Within days of the initial release, this mandatory download resulted in bandwidth charges of over $20,000, forcing the temporary shut-down of the game until a peer-to-peer alternative solution was established. Due to the game's sudden and explosive growth that same month, however, it became closed-source, proprietary software and was relaunched by Walton's start-up development team, Latitude (with Walton taking on the role of CTO). This relaunch constituted mobile apps for iOS and Android (built by app developer Braydon Batungbacal) on December 17. Other members of this team included Thorsten Kreutz for the game's long-term strategy and the creator's brother, Alan Walton, for hosting infrastructure.
At this time, Nick Walton also established a Patreon campaign to support the game's further growth (such as the addition of multiplayer and voice support, along with longer-term plans to include music and image content) and turn the game into a commercial endeavor, which Walton felt was necessary to cover the costs of delivering a higher-quality version of the game. AI Dungeon was one of the only known commercial applications to be based upon GPT-2.
Following its first announcement in December 2019, a multiplayer mode was added to the game in April 2020. Hosting a game in this mode was originally restricted to premium subscribers, although any players could join a hosted game.

### Dragon model release (GPT-3)

In July 2020, the developers introduced a premium-exclusive version of the AI model, named Dragon, which uses OpenAI's new API for leveraging the GPT-3 model without maintaining a local copy (released on June 11, 2020). GPT-3 was trained with 570 gigabytes of text content (approximately one trillion words, with a $12 million development cost) and can support 175 billion parameters, compared to the 40 gigabytes of training content and 1.5 billion parameters of GPT-2.
The free model was also upgraded to a less advanced version of GPT-3 and was named Griffin.
Speaking shortly after this release, on the differences between GPT-2 and GPT-3, Walton stated:
   "[GPT-3 is] one of the most powerful AI models in the world... It's just much more coherent in terms of understanding who the characters are, what they're saying, what's going on in the story and just being able to write an interesting and believable story."
In the latter half of 2020, the "Worlds" feature was added to AI Dungeon, providing players with a selection of overarching worlds in which their adventures can take place. In February 2021, it was announced that AI Dungeon's developers, Latitude, had raised $3.3 million in seed funding (led by NFX, with participation from Album VC and Griffin Gaming Partners) to "build games with 'infinite' story possibilities." this funding intended to move AI content creation beyond the purely text-based nature of AI Dungeon as it existed at the time.
After its announcement on August 20, a new 'See' interaction mode was made available for all players and added to the game on August 30, 2022.
AI Dungeon was retired from Steam on March 12, 2024.

## Reception

Approximately two thousand people played the original version of the game within the first month of its May 2019 release. Within a week of its December 2019 relaunch, the game reached over 100,000 players and over 500,000 play-throughs, and reached 1.5 million players by June 2020.
As of December 2019, the game's corresponding Patreon campaign had raised approximately $15,000 per month.

### GPT-2 edition reviews

Review scores :
| Publication | Score |
| Stuff | 4/5 |
| TapSmart | 3/5 |
| 148Apps | 4/5 |
In his January 2020 review of the GPT-2-powered version of AI Dungeon (known at the time as AI Dungeon 2), Craig Grannell of Stuff Magazine named it "App of the Week" and awarded it 4 out of 5 stars. Grannell praised the game's flexibility and its custom story feature, but criticized the abrupt shifts in content that were common in the GPT-2 edition of the game:
   "[AI Dungeon is] an endless world of dreamlike storytelling, and a fascinating glimpse into the future of AI."
Campbell Bird of 148Apps also awarded this edition of the game 4 out of 5 stars in his review, also praising its creativity whilst criticizing the lack of memory for previous content:
   "AI Dungeon is like doing improv with a partner who is equal parts enthusiastic and drunk... [It] is a game that's charming, occasionally frustrating, but mostly just impressive in its raw creativity and spirit."
Jon Mundy of TapSmart awarded it a 3 out of 5-star rating, similarly, praising its variety and the "magical" custom adventure option, but described its adventure narratives as "often too passive and vague" and lacking in resolution.

### GPT-3 edition reviews

The AI's tendency to create graphic and sexual content despite not being prompted by players was noted by reviewers, including Lindsay Bicknell. Latitude CEO Nick Walton and researcher Suchin Gururangan responded to such concerns, stating that the behavior was unexpected and reasoning that such a thing occurs due to a lack of strict constraints placed on the GPT-3 model. They stated that they did not do enough to prevent it from behaving this way "in the wild".

### Creating non-game content

In addition to those who used AI Dungeon for its primary purpose as a game, other users experimented with using its language generation interface to create other forms of content that would not be found in traditional games (primarily via the custom adventure option). Although the game was primarily trained using text adventures, training content for the GPT models themselves included large amounts of web content (including the entirety of the English-language Wikipedia), thereby allowing the game to adapt to areas outside of this core focus. Examples of AI Dungeon being used in this way include:
* Co-writing an article discussing GPT-3 itself.
* Responding to philosophical essays written on GPT-3.
* Having a discussion with a psychologist.
* Fabricating an interview discussion on ethics.
* Participating in its own therapy session.
* Allowing interaction with fictional versions of celebrities.
* Posting content to a fictional version of Instagram.
* Creating erotic and pornographic content.

### Content moderation and user privacy

In April 2021, AI Dungeon implemented a new algorithm for content moderation to prevent instances of text-based simulated child pornography created by users. The moderation process involved a human moderator reading through private stories. The filter frequently flagged false positives due to wording (terms like "eight-year-old laptop" misinterpreted as the age of a child), affecting both pornographic and non-pornographic stories. Controversy and review bombing of AI Dungeon occurred as a result of the moderation system, citing false positives and a lack of communication between Latitude and its user base following the change.

### Addition of advertisements

In June 2022, AI Dungeon added advertisements to replace the past "energy" system, in which users would need to wait for energy to refill to generate more content. The advertisement system would allow for infinite tries of AI output, but would occasionally interrupt gameplay with advertisements. This addition received backlash from users, and Latitude would add a beta system in response, allowing storing of actions through watching advertisements. The advertisement system was removed by the end of 2022.