AI Text Adventure: Goals, Branches and Win Conditions

By Updated 17 min read

An AI text adventure is a game played in chat: the AI runs the world and you make the moves. To get a game instead of an endless story, set a goal, a turn limit, a win condition and a lose condition before you start, and ask for a status line after every turn. Start your first adventure in aimy.

Calm illustration: a forked mountain trail leads to an observatory, with a glowing speech bubble above the path
Illustration generated with AI

Key takeaways

  • What separates an adventure from ordinary roleplay is a goal and an ending: you know in advance what counts as winning and what counts as losing.
  • Before you start, fill out an adventure brief: hero, goal, turn limit, main obstacle, win condition, lose condition.
  • Language models tend to go along with the player. Write into the rules that losing is possible and that mistakes have a cost.
  • A status line after every turn (turn, location, items, clues) shows you right away when the game master has lost track of something.
  • Asking the AI to pick a secret solution doesn't guarantee it picked one. The clue rule works better: the ending has to explain everything you found.
Contents
  1. How do you play a text adventure with AI?
  2. How is a text adventure different from roleplay and D&D with AI?
  3. How do you set a goal, branches and win conditions?
  4. What prompt should you paste to start the adventure?
  5. Which adventure should you start with?
  6. How do you take turns so the AI doesn't decide for you?
  7. How do you keep the AI from going easy on you and get a fair ending?
  8. How do you keep track of a long adventure?
  9. What should you do if the adventure falls apart?
  10. Where can you play AI text adventures?
  11. Bottom line

How do you play a text adventure with AI?

A text adventure is a game played in chat. The AI describes where you are and what's around you, you write what the hero does, and the world responds to your move. That's how classic text adventures worked too: in Colossal Cave Adventure, every room came with a written description, and the player typed two-word commands like GO NORTH or GET CAGE. The difference is that those games understood a limited set of words and replied from a script someone wrote in advance. Here a language model writes every reply, and you can describe your move in your own words. People also call these games interactive stories with AI, and when there are items, stats and quests involved, an AI text RPG.

Freedom is the biggest plus of this kind of game and its biggest trap. The model doesn't have to stick to a script, so if you don't set rules, the adventure quickly turns into an endless story: nobody knows what counts as losing, the goal gets fuzzy and the ending never arrives. A developer who built a detective game inside ChatGPT described a related problem with the solution in a write-up on Habr, a Russian tech site. Without a structure set in advance, the clues pointed to different culprits, and when he asked directly, the model admitted it had never come up with a solution at all.

So an adventure is built from five parts:

  1. The adventure brief. Hero, goal, turn limit, obstacle, win condition and lose condition.
  2. Rules for the game master. Who runs the world, who plays the hero, whether the player can lose, how long replies should be.
  3. The status line. A short summary after every turn: turn, location, items, clues.
  4. Turns. One turn is one action or one line from the hero. Questions and corrections go separately.
  5. The ending. The game master declares a win or a loss and explains why.

Below is each part with examples you can copy. If you want something simpler, with no hero and no plot, try to play trivia with AI: the AI asks the questions and keeps score. More ideas are in this list of games to play with AI.

How is a text adventure different from roleplay and D&D with AI?

All three formats look alike: you write, the AI answers. The difference is what counts as the game and how it ends.

Roleplay with AI Text adventure D&D with an AI dungeon master
The focus A scene and a relationship with a character A goal and the path to it Rules, stats, dice
The ending Optional A win or a loss The end of an adventure or a campaign
Length As long as you like 10–20 turns, sometimes chapters Sessions and campaigns
What to prepare A hero and an opening line An adventure brief A character sheet and rules

If your scene needs several characters at once, that's a group scene with an AI narrator. If you'd rather have a conversation-driven scene with one character, start with the guide on how to roleplay with AI: it covers turn formatting and out-of-character notes in detail. If you want stats, dice rolls and a long campaign, see the guide to playing with an AI dungeon master. A text adventure sits between the two: fewer rules than a tabletop game, but it has a goal and an ending.

How do you set a goal, branches and win conditions?

An adventure doesn't start with the first line. It starts with the brief: six lines you write before the game begins. Without them, the game master will make up the goal as it goes, which means it can also change it halfway. If you don't have a goal yet, build one step by step with the guide on how to come up with a plot.

Field What to write Example
Hero Who they are, what they can do, what they carry Marta, 31, mountain guide; rope, flashlight
Goal A concrete result you can check Find the missing astronomer and bring him down to the village
Limit Turns or in-world time 12 turns; after turn 12 a blizzard hits
Obstacle What's in the way right now No one answers at the door, there's only one trail down, no cell signal
Win A condition you can check Marta and the astronomer reach the village by turn 12
Loss Also checkable After turn 12, at least one of them isn't in the village, and the adventure is over

Pay attention to the lose condition. It doesn't have to be grim: "ran out of time," "missed the train," "the deal fell through" are all losses. What matters is that you can check it instead of arguing about it.

You don't need to write out the branches in advance; the game master creates them. Your job is to set what they grow from. A good branch is a choice with a cost: the short trail over loose scree or the long one along the ridge, spending a turn searching the room or following the tracks right away. And if you want the world to surprise you midway, plan a plot twist ahead of time: details that first read one way and later turn out to mean something else. Spell it out in the game master's rules: "every important choice has a cost: time, an item or a risk."

One more detail is difficulty. The model doesn't know how hard the game should be unless you tell it. Here are three levels you can explain in one line each:

  • Easy: the game master offers 3 possible actions and gives a hint when you're stuck.
  • Normal: there are options but no hints, and mistakes cost turns.
  • Hard: no options; you write every action yourself, and one mistake can end the game.

The author of that detective game used a similar trick: on the hardest setting, the game stops suggesting what to ask, and the player has to come up with questions on their own.

The brief takes a couple of minutes to fill out. If you want to see how it works right away, run an adventure from your own brief in aimy: paste the brief and the rules from the next section as your first message or into your own character's description.

What prompt should you paste to start the adventure?

A prompt several screens long is awkward to edit on a phone, and rules get lost inside it. For a first run, a brief and a handful of rules are enough. Below is a short starter prompt. Paste it as your first message in an AI chat and adjust it: put your own brief on the "Brief" line. How closely the game master follows the rules depends on the model and the character settings.

((You are the game master of a text adventure. I play the hero; you run the world and everyone else in it.

Brief: the hero is Marta, 31, a mountain guide carrying a rope and a flashlight. Goal: find the missing astronomer at the observatory on the pass and bring him down to the village. Limit: 12 turns. One action or one line from Marta is one turn; any note in double parentheses doesn't change the count. After turn 12 a blizzard hits. Win: Marta and the astronomer reach the village by turn 12. Loss: after turn 12, at least one of them isn't in the village.

Rules:

  1. Don't write Marta's words or actions; I write those.
  2. Losing is possible: if the lose condition is met, call the loss honestly.
  3. Important choices have a cost.
  4. While the adventure is running, reply in one paragraph and end with 3 possible actions as a list, but I can also do something else. On a win or a loss, name the outcome and the reason, print the final status line and stop.
  5. After every reply, print the status line.
  6. Record every clue found in the status line; the ending must explain all of them.

Status line: [Turn 0/12 · Location: … · Items: … · Clues: … · Until the blizzard: …]

Start with Marta walking up to the observatory.))

The game master's reply to this prompt should look roughly like this (it's an illustration of the format, not a transcript of a real game):

The observatory door is ajar, and nobody answers your knock. Inside it's dark and smells of cold coffee. From the doorway you can see an open observation log; the last entry breaks off mid-sentence. A draft rises from the basement, and snow is already falling outside the window.

  1. Read the log.
  2. Go down to the basement.
  3. Call out for the astronomer.

[Turn 0/12 · Location: observatory entrance · Items: rope, flashlight · Clues: — · Until the blizzard: 12 turns]

If the reply is much longer, or the status line is missing, restate the rule in one note in double parentheses.

Why it's set up this way: each rule targets one typical failure. The game master writes for the hero, goes easy on the player, drags out its replies, loses items and clues. A rule doesn't guarantee anything, but once it's written down, a slip is easy to fix with one line. The status line comes as a ready-made template rather than a request to "keep track of items." Anthropic's documentation notes that output is more consistent when you define the exact format you want, and that showing an example works better than an abstract instruction. That helps the game master keep the format, but it doesn't guarantee correct counts of items, clues and turns, so it's still worth checking the line yourself.

The double parentheses here mark notes that are outside the game. For more on these notes, see the explainer on what OOC means in roleplay; for turn formatting in general, see the guide to roleplaying with AI.

Which adventure should you start with?

For a first adventure, pick a short plot with one clear goal. The goal can also be an object: find it, return it, or disarm it. For artifacts with a cost and a catch, browse these magic item ideas. Below are five starters, each with a goal and a loss you can check. Pick one and swap the hero, goal, obstacle, limit, win and loss into the brief. In the status line, change the turn counter and the event you're racing against, and in the last sentence of the prompt, change the starting place.

Genre Goal Loss
Mystery Name who swapped the painting before the exhibition closes after turn 20 The exhibition closed, and there's no theory that explains every clue
Adventure Push through a festival crowd and hand a letter to the captain of the last ferry before it leaves The ferry left, and the captain never got the letter
Sci-fi Restart the station's systems before it falls out of orbit The station left orbit before the systems came back online
Fantasy Buy a map of the pass before the market closes, without giving up your sword The sword is sold, or the market closed and you have no map
Slice of life Pull off a surprise for a friend by evening without giving it away Your friend figured out the plan, or evening came and the surprise isn't ready

Notice that in every starter the goal is an action, not a mood. "Explore the city" isn't a goal: there's no telling when it's done. "Hand the letter to the captain before the ferry leaves" is a goal: at the end it's clear whether you made it. If the mystery starter is your favorite and you'd like a whole whodunit with suspects, see how a murder mystery game is put together.

If you want a different kind of setup (meet-cutes, romance plots, everyday stories), there's a big collection of roleplay plot ideas. Any of them can become an adventure: add a goal, a limit and a lose condition to the setup.

How do you take turns so the AI doesn't decide for you?

In an adventure you send three kinds of messages: the hero's action, the hero's line, and an out-of-game question to the game master. Only the first two move the turn counter. AI Dungeon, one of the best-known AI text adventure services, has separate input modes: Do for actions, Say for dialogue and Story for narration. A regular chat has no modes, so you separate your turns yourself, for example like this:

Message type How to write it Example
Action In asterisks, one concrete action *Marta checks the astronomer's desk*
Line Plain text Is anybody here?
Question to the game master In double parentheses ((How many turns until the blizzard?))

Asterisks and parentheses are just one convention; whatever you pick, keep it for the whole game.

A few rules that keep the adventure on track:

One turn, one decision. "I check the desk, grab the log, go down to the basement and find the astronomer" isn't a turn; it's a summary of what you wish would happen. All the game master can do is agree. Take the first action and see how the world answers.

Specifics, not generalities. The AI Dungeon help center advises writing turns with concrete details: an input like "You go in." leaves the AI too much freedom over what happens next, and it can take the story somewhere you didn't want. "*Marta shines her flashlight under the stairs*" gives the game master something to work with; "*I look for something*" doesn't.

Options are a hint, not a menu. The game master offers three actions, but the turn is yours. Your own idea is often more interesting, and the game master should respond to it instead of steering you back to the list.

Don't ask permission. Ask "Can I open the door?" and the model will most likely say yes. Write the action instead ("*Marta yanks the door*") and let the world decide whether it's locked.

If the game master starts writing Marta's actions, remind it in one line: ((Only I write Marta's actions)). If that doesn't help, repeat the rule and ask it to rewrite its last reply. There's a full breakdown of this problem in the guide on how to stop the AI from talking for you.

To feel the difference between a vague turn and a specific one, take one adventure turn with a single concrete detail: examine one object, not the whole room.

How do you keep the AI from going easy on you and get a fair ending?

Language models have a known tendency to agree with the person they're talking to. In a study by Sharma and colleagues at Anthropic, five AI assistants from 2023 consistently tailored their answers to the user's views across several different tasks. The authors suggest this is partly a side effect of training on human ratings: people more often prefer responses that agree with them. The study didn't look at games, but in an adventure the same trait looks like this: every idea the player has works, every door is unlocked, and the astronomer is waiting around the very first corner. Where this tendency comes from and how to push back on it is covered in the article on why AI agrees with everything.

What helps:

  • Losing in the rules. The line "losing is possible; call it honestly" is a required part of the prompt. Without it, the game master may keep telling the story even after you've failed.
  • A cost for every choice. The rule "important choices have a cost" asks the game master to take away turns, items or time. Check whether that actually shows up in the status line.
  • A world that pushes back. Add a rule: "Not everything Marta tries works. Decide based on the circumstances, not on what I want."
  • The counter. A status line with "Turn 7/12" helps you notice when the game master stops tracking the turns you have left.

The mystery and the solution. This is where you need honesty. Asking "think of a solution in advance but don't tell me" doesn't guarantee the game master actually chose one. If the solution isn't written down anywhere, there's no way to check: the game master can invent it at the end, and it may not match the clues. That's exactly what the author of the detective game ran into.

There are two ways around it:

  1. The clue rule. Don't ask the model to secretly "pick" a solution in advance. Ask for something else: every clue you find goes into the status line and counts as fact, and the ending must explain every clue in the line. Then it's easy to check the solution against what you found, and any contradiction is obvious.
  2. The written-down secret. Ask the game master to write the solution in one short line at the end of its first reply, don't read it until the finale, then compare it with the ending. This takes willpower.

The first way is simpler, because you aren't hiding anything from yourself. The clue line lets you check whether the ending explains everything you found. If two theories both fit, though, the line won't tell you which one the game master had in mind first.

How do you keep track of a long adventure?

In a long adventure, contradictions can creep in: the astronomer is "missing" again even though you found him, or the flashlight is back in your pack after it broke. A close example comes from a technical report by Tsai and colleagues, in which ChatGPT played the classic text adventure Zork I, as the player, not the game master. Without hints, it scored slightly better than one earlier game-playing system, but it couldn't build a model of the game world as it played and couldn't work out the goal of each step as the game went on. When the model was reminded of its earlier moves, it did better.

You can borrow the same idea for your own adventure: keep the game state written out where you can see it. That leads to three habits.

A status line after every turn. It's already in the prompt above. If the game master skips it, ask for it back: ((Add the status line)). If there's a mistake in the line, fix it right away so the game master builds on the corrected version.

Chapters. A 40-turn adventure works better as three chapters of 12 to 15 turns. At the end of a chapter, ask for a recap: ((Chapter summary: where we are, what we found, what's left, how many turns)). Start the next chapter with the brief, the rules and that recap, in a new chat if the old one has grown too long. Why a model forgets the start of a long conversation, and what to do about it, is covered in detail in the article on why AI chatbots forget.

Shorter replies. The longer each of the game master's paragraphs, the faster the chat grows. On a phone, a short paragraph, up to three options and the status line are enough.

The easiest way to try all of this is with a ready-made starter: the goal, the limit and the loss are already set, and all that's left is your first move.

Before your second turn, check the basics: compare your items and remaining turns in the status line against what has actually happened. If there's no status line, ask the game master to add it.

What should you do if the adventure falls apart?

Here are common breakdowns and what you can write to the game master. Find your situation in the left column and send the line from the right one: a single line is usually enough.

What happened What to write to the game master
A win was declared before the goal was met ((We found the astronomer, but we're not in the village yet. No win so far; continue from the current turn))
The game master writes the hero's actions ((Only I write Marta's actions. Describe what Marta sees and stop))
Items or clues went missing ((Fix the status line: the flashlight is broken, Marta has the log))
The same descriptions over and over ((Less weather, more events: what's changing in the observatory?))
The adventure isn't moving toward an ending ((3 turns left. Steer the story toward its ending))
The solution doesn't match the clues ((The ending must explain every clue in the status line. Rewrite it))

If the game master's replies start going in circles, that's a separate problem with clear causes. It's covered in the article on why AI keeps repeating itself.

One more thing. Every service has its own content limits on stories. If your plot runs into them, pick a different turn of events: a good adventure almost always has a second way through.

Where can you play AI text adventures?

Almost any AI chat will do; the difference is convenience.

  • General-purpose chatbots such as ChatGPT, Gemini and similar assistants. You can paste the prompt above into them as is. The downside is that by default the model behaves like an assistant, so set the game master role and the reply format explicitly. A ready-made setup for these chats is in the guide to the ChatGPT roleplay prompt.
  • Text adventure services like AI Dungeon. AI Dungeon has input modes and a Retry button: its help center suggests using Retry when a reply derails the story.
  • Character chat apps. These are handy when you want the game master to be a character with a voice of its own: a narrator, an observatory caretaker, a ferry captain. How to describe a character like that is shown in the guide on how to write an AI character.

aimy is a character chat app too. Free: 100 messages a day and your first AI character of your own. If you're building your own narrator, a long text fits into the character description (with PRO, up to 2,000 characters per field), so the adventure brief and rules fit there. Also, the chat opens with a greeting the character writes itself from its description, and creator beta testers with PRO can also write the first message by hand: for example, "You're at the observatory door. The blizzard hits in 12 turns. What do you do?" Keep in mind that messages go not only to your turns but also to questions for the game master and to corrections, so start with a short adventure. More formats are collected on the AI roleplay page.

Bottom line

An AI text adventure becomes a game when it has a goal and an ending. Fill out the brief (hero, goal, limit, obstacle, win, loss) and paste a short prompt with the rules.

While you play, do three things. Take one concrete action per turn. Ask for the status line after every reply and fix it right away. Don't expect the model to let you lose on its own: write the loss and the clue rule into the prompt, and checking that the ending is fair gets much easier.

Fill out your adventure brief and take the first turn

Roleplay without lectures · one-click sign-in

Free: 100 messages a day and your first AI character of your own

Or with

400,000+ sign-ups · 18+

By continuing, you agree to the Terms and Privacy Policy.

FAQ

Can you actually lose an AI text adventure?

Yes, if the rules say so. Without them there's no way to tell what counts as losing. State a lose condition (you ran out of turns, lost a key item, went the wrong way) and ask the game master to call the loss honestly as soon as that condition is met.

How many turns should an AI text adventure have?

For a first game, 10 to 15 turns is plenty: that fits into a lunch break. A mystery needs more, around 20, so you have time to collect clues. A long story is easier to manage as chapters of 12 to 15 turns with a recap between them.

How is a text adventure different from roleplay with AI?

In roleplay you usually play out a scene with a character, and it doesn't have to end. A text adventure has a goal, a limit and an ending: a win or a loss. The AI runs the world and the obstacles, and you decide what the hero does.

What if the AI forgets what's in my inventory?

Ask the game master to print a status line after every turn: turn, location, items, clues, time left. If an item disappears, correct the line with one out-of-character note and keep playing from the same spot.

Can I play an AI text adventure for free?

Yes. You can paste the prompt from this guide into an AI chat on a free plan. Check the daily message limit before you start: besides your turns, messages also go to the setup, questions to the game master and corrections. For a first game, pick a short adventure of 10 to 15 turns.

Can I play a text adventure on my phone?

Yes, a chat adventure works well on a phone. Keep the game master's replies short (one paragraph, up to three options and a status line) and ask for numbered options, so you can take a turn with a single number or a short phrase.

Sources

  1. Can Large Language Models Play Text Games Well? Current State-of-the-Art and Open Questions — arXiv (Tsai, Zhou, Liu, Li, Yu, Mei),
  2. Towards Understanding Sycophancy in Language Models — arXiv (Sharma et al.),
  3. Increase output consistency — Anthropic documentation
  4. Interactive Fiction and Adventure Games — Engineering and Technology History Wiki (IEEE History Center)
  5. Как я сделал игру на ChatGPT (How I made a game on ChatGPT, in Russian) — Habr,
  6. Playing AI Dungeon — AI Dungeon help center
What changed
  • — First version.

What next

What nextAI Dungeon Master: How to Play D&D Solo (Prompt + Example Session)

Related articles

All articles

Continue in aimy

Free: 100 messages a day and your first AI character of your own

Or with

400,000+ sign-ups · 18+

By continuing, you agree to the Terms and Privacy Policy.