Timed Dialogue Choices
Timed dialogue choices give the player a short time to answer. Start the clock only when the answers are on screen, give long lines more time, stop it when the game pauses, let a press on the last frame win, and take a default answer, or silence, when the time runs out.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Timed Dialogue Choices" to my game.
What it should do: A countdown makes a conversation tense: the player has to answer on instinct, and saying nothing becomes a choice with a cost. It only works if the time feels fair, which means enough time to read, a clock that never runs while the player cannot act, and a way for players who need longer to get it.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> idle
idle: No question yet
reading: Line is spoken
open: Answers open
urgent: Time running low
paused: Paused
chosen: Player answered
timedout: Time ran out
idle --> reading: first question starts
reading --> open: answers appear
open --> urgent: time runs low
open --> chosen: player picks
open --> paused: game pauses
open --> timedout: time runs out
urgent --> chosen: player picks
urgent --> paused: game pauses
urgent --> timedout: time runs out
paused --> open: game resumes
paused --> urgent: game resumes
chosen --> reading: next question starts
timedout --> reading: next question starts
chosen --> idle: conversation ends
timedout --> idle: conversation ends
```
Use these starting values:
- baseSeconds: 4 s
- secondsPerWord: 0.25 s
- maxSeconds: 20 s
- timeScale: 1
- warnFraction: 0.25
- timerOn: 1
Watch out for these common mistakes:
- The clock starts with the line: Tell your AI: start the clock when the answers appear, not when the line starts.
- The clock runs while the game is paused: Tell your AI: stop the clock when the game pauses, and do not let the player pick while it is paused.
- A press and the end of time on the same frame: Tell your AI: handle the press first, then the clock.
- Nothing to say: Tell your AI: let running out of time be its own result, silence, and write a reply for it.
- A slow frame jumps past zero: Tell your AI: when the time reaches zero or below, take the default once and stop the clock.
- A default that is not one of the answers: Tell your AI: if the default is not one of the answers, treat it as none.
- Players who cannot use a clock: Tell your AI: add a setting that stretches the time and one that turns the clock off, and keep the warnings.
Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
What it does
A countdown makes a conversation tense: the player has to answer on instinct, and saying nothing becomes a choice with a cost. It only works if the time feels fair, which means enough time to read, a clock that never runs while the player cannot act, and a way for players who need longer to get it.
How it runs, as a diagram
Everything it can be in, and what moves it on. Your AI builds from exactly this.
How it runs, as a diagram
- No question yet → Line is spoken: first question starts
- Line is spoken → Answers open: answers appear
- Answers open → Time running low: time runs low
- Answers open → Player answered: player picks
- Answers open → Paused: game pauses
- Answers open → Time ran out: time runs out
- Time running low → Player answered: player picks
- Time running low → Paused: game pauses
- Time running low → Time ran out: time runs out
- Paused → Answers open: game resumes
- Paused → Time running low: game resumes
- Player answered → Line is spoken: next question starts
- Time ran out → Line is spoken: next question starts
- Player answered → No question yet: conversation ends
- Time ran out → No question yet: conversation ends
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| baseSeconds | 4 s | The time every question gets, however short. Four seconds is enough to take in three short answers and decide on instinct, which is the point of a clock. |
| secondsPerWord | 0.25 s | Extra time for each word the player has to read, counting the answers. A quarter of a second a word is a little slower than reading aloud fast, so a slow reader is not punished. |
| maxSeconds | 20 s | The most time before scaling. A very long page of text would otherwise give a minute and the pressure would be gone. Under the base time, this limit wins. |
| timeScale | 1 | Multiplies every time. This is the setting for players who need longer. One is the intended speed, and four is for players who still want the countdown to feel like one. |
| warnFraction | 0.25 | The last share of the time that counts as running low, for the colour or sound that warns the player. A quarter is long enough to react to and short enough to mean something. Zero turns the warning off. |
| timerOn | 1 | One runs the clock, zero lets the player take as long as they like. Offer it as an option: some players cannot answer under a clock at all. |
What usually goes wrong
The clock starts with the line
If the clock runs while the line is still being spoken, a long line eats the time and the player gets the answers with a few seconds left, or none.
Fix: Tell your AI: start the clock when the answers appear, not when the line starts.
The clock runs while the game is paused
A pause menu, a cutscene or a lost window that does not stop the clock makes the player lose the choice without being able to act.
Fix: Tell your AI: stop the clock when the game pauses, and do not let the player pick while it is paused.
A press and the end of time on the same frame
When the player presses on the very frame the clock runs out, the answer can be lost to the default, and the player is sure they were fast enough.
Fix: Tell your AI: handle the press first, then the clock.
Nothing to say
A question with no default has no good outcome when time runs out, and the game freezes or picks the first answer.
Fix: Tell your AI: let running out of time be its own result, silence, and write a reply for it.
A slow frame jumps past zero
After a stutter the clock can jump from three seconds left to below zero in one step, and the default can be taken more than once.
Fix: Tell your AI: when the time reaches zero or below, take the default once and stop the clock.
A default that is not one of the answers
A default answer number outside the list makes the game take an answer that does not exist.
Fix: Tell your AI: if the default is not one of the answers, treat it as none.
Players who cannot use a clock
A countdown that cannot be changed shuts out players who read slowly, use a screen reader or have a motor limit.
Fix: Tell your AI: add a setting that stretches the time and one that turns the clock off, and keep the warnings.
How to check it works
- A question with a 12 word line and a clock. The line is spoken, and then the answers appear: No time passes while the line is spoken, and the clock starts at 7 seconds when the answers appear.
- Lines of 0, 12 and 40 words. Their times are worked out: They get 4, 7 and 14 seconds.
- A line of 100 words. Its time is worked out: It gets 20 seconds, and a limit set under the base time wins over the base.
- A question with 7 seconds and the second answer as default. The 7 seconds pass: The second answer is taken, by time, and the clock reads zero.
- A question with no default, or a default that is not one of the answers. The time runs out: Silence is taken: no answer, ended by time.
- A question with a hundredth of a second left. The player picks the third answer, and more time passes: The third answer stands, taken by the player, and no more time runs.
- A question whose time has run out, or whose line is still being spoken. The player tries to pick: It is refused and the answer already taken stays.
- A question with 5 seconds left that gets paused. 200 seconds pass and the game resumes: There are still 5 seconds left.
- A paused question. The player tries to pick: It is refused and nothing is taken.
- A question of 7 seconds with the warning in the last quarter. 5.25 seconds have passed: It counts as running low; at 5 seconds it does not, and a warning set to zero never shows.
- The clock is turned off. A thousand seconds pass: The answers stay open and the player can still pick.
- A time scale of 2 and a 12 word line. The time is worked out: It is 14 seconds instead of 7, and 3.5 seconds at a scale of 0.5.
- Open answers. Time of zero, below zero or not a number passes, or an answer that does not exist is picked: Nothing changes.
- A question with 7 seconds left. A single step of 500 seconds comes in, twice: The default is taken once and the second step changes nothing.
- A question that was answered. The next one is shown: No answer is taken yet and the clock is full.
Works well with
- Branching Choices: The default answer of a timed question is one of the scene's choices, so the story needs no extra scene for it. Silence needs its own. Show the scene's choices, then start the clock.
- Dialogue System: The dialogue decides when the line is done. The clock reads that moment and does not guess it. Finish the spoken line before the answers appear.
- Difficulty Settings: Make the setting easy to find before the first timed question, not after the player has failed one. Offer the time scale and the clock switch among the settings.
Common questions
how do i add a timer to dialogue choices
Paste this: Add timed dialogue choices. Start a clock when the answers appear, not when the line starts, with 4 seconds plus a quarter of a second for each word the player reads, up to 20. Stop the clock while the game is paused. When the time runs out, take the default answer, or silence if there is none. Handle the player's press before the clock on the same frame. Add settings to stretch the time and to turn the clock off.
how long should a timed dialogue choice last
Long enough to read the answers once and decide on instinct: about four seconds plus a little for each word. Under that, players feel cheated. Over twenty seconds, the pressure is gone.
what should happen when the timer runs out
Take a default answer or let silence be the result. Silence is often the most interesting outcome, because the other character reacts to it. Never freeze and never pick the first answer by accident.
should a game let players turn the dialogue timer off
Yes. Some players read slowly, use assistive tools or have motor limits. Offer a setting that stretches the time and one that turns the clock off, and keep the story the same.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 18 tests pass on the reference code.
- The state diagram was checked against the code, at the default values and at every listed low and high value.
Your AI gets the code
Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it