[GH-ISSUE #6215] [Feature]: Finish rolled Game turns in one request without showing the Game Master the dice #3466

Closed
opened 2026-10-21 06:03:24 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @kolacheee on GitHub (Sep 14, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6215

Originally assigned to: @kolacheee on GitHub.

What problem does this solve?

A Game turn that rolls dice costs two full provider requests. The Game Master writes a draft with a sparse check or [dice:] tag in it, the engine rolls, and then the whole prompt goes back to the model so it can rewrite the narration with the real numbers. The second request resends every message, so on a long chat a single skill check roughly doubles the input tokens of that turn, and on a provider without prompt caching it doubles the bill.

The only lever today is Narrate dice outcomes immediately. Turning it off keeps the turn at one request, but the outcome is not narrated until the next turn, so the player reads the attempt, sees the die, and waits.

A pre-rolled dice pool was the first idea for closing this. It works, but it puts a number in front of the model before it decides what the check is and how hard it is, and nothing in the engine can tell whether a difficulty suits the fiction. A model that can see a 19 can pick a DC the 19 clears. That trade-off should be a deliberate opt-in, not the default.

Proposed solution

A per-chat switch in Chat Settings, Function Calling: Finish rolled turns in one request, off by default. While it is on, the Game Master is asked to write a check in one of three forms and to pick by what the outcome actually is. The engine rolls after the writing is done, and the model never sees a number before it commits its prose on the default path.

  1. A branch block for an outcome that splits two ways. The check is written without numbers with a branch="label" attribute, followed by [branch: label] [on success] ... [on failure] ... [/branch]. The engine rolls through the existing check resolver, keeps the half the roll selected, and deletes the other before anything reads the turn. The discarded half's commands are gone before the spatial and package-verb parsers run.
  2. A placeholder for an outcome that is only a number. [[roll: 2d6+3]] in the middle of a sentence. The engine rolls it with crypto.randomInt at parse time and substitutes the total. [[roll: 1d8+STR]] adds a character-sheet modifier by name, offered only when the chat has names to resolve; a name that does not resolve refuses the placeholder rather than defaulting to zero. The rolls appear in the dice history and the session log, and the substituted number carries a hover with the dice behind it.
  3. The shipped sparse tag for a number that has to choose between three or more endings. The engine rolls and records it, the turn ends without the outcome, and the next turn narrates it. This is also the fallback for anything written in none of the forms, so nothing is left unresolved and nothing is invented.

Failure contract: a placeholder the engine cannot read becomes a visible "(roll unavailable)" notice, a branch block it cannot read keeps the recorded roll and drops both halves, and a pass that throws saves the turn with the affected tags left sparse. In none of those cases is a second request made. The stream holds a placeholder or a branch block back while the draft streams, so the player never watches a raw tag turn into a number.

Under the switch, an opt-in sub-option, also off by default: Let the Game Master see one die of each size. The engine throws one die of each standard size before the turn and shows the next value of each, so a three-way outcome can be narrated in the same pass. The engine keeps the queue, hands values out in order, never repeats one, recomputes every number in the record, bounds the DC, and rethrows a size that goes unspent for a few turns. Its help text says plainly that the Game Master can steer outcomes it can see, which the blind forms do not allow.

Two things still cost an extra request and are stated in the docs: a roll_dice tool call when Enable Tool Use is on and the tool is in the chat's list, and a separate Game tool connection, which always makes its own planning request. Neither is the narration rewrite this removes.

Alternatives considered

  • The pool as the primary mechanism. Rejected as the default for the peeking reason above. It is kept as the opt-in for the one case the blind forms cannot serve.
  • Placeholders only. Covers numbers but not a forked outcome, which is the common skill check. Both blind forms are needed.
  • Calling roll_dice instead. A tool call is a full extra round of the tool loop and is only available on connections with native tools.
  • A {{roll:}} macro spelling. Collides with the macro expander, which already claims that shape.
  • Sending only a tail of the prompt on the rewrite. Changes what the model sees on the second request and does not remove it.

Additional context

The Engine change is ready and its PR is opened alongside this issue. Everything is opt-in per chat and nothing changes how an already-saved transcript reads. The prompt-caching findings gathered while measuring this are deliberately out of scope and will come as a separate PR.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Sep 14, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6215 Originally assigned to: @kolacheee on GitHub. ## What problem does this solve? A Game turn that rolls dice costs two full provider requests. The Game Master writes a draft with a sparse check or `[dice:]` tag in it, the engine rolls, and then the whole prompt goes back to the model so it can rewrite the narration with the real numbers. The second request resends every message, so on a long chat a single skill check roughly doubles the input tokens of that turn, and on a provider without prompt caching it doubles the bill. The only lever today is **Narrate dice outcomes immediately**. Turning it off keeps the turn at one request, but the outcome is not narrated until the next turn, so the player reads the attempt, sees the die, and waits. A pre-rolled dice pool was the first idea for closing this. It works, but it puts a number in front of the model before it decides what the check is and how hard it is, and nothing in the engine can tell whether a difficulty suits the fiction. A model that can see a 19 can pick a DC the 19 clears. That trade-off should be a deliberate opt-in, not the default. ## Proposed solution A per-chat switch in Chat Settings, Function Calling: **Finish rolled turns in one request**, off by default. While it is on, the Game Master is asked to write a check in one of three forms and to pick by what the outcome actually is. The engine rolls after the writing is done, and the model never sees a number before it commits its prose on the default path. 1. **A branch block for an outcome that splits two ways.** The check is written without numbers with a `branch="label"` attribute, followed by `[branch: label] [on success] ... [on failure] ... [/branch]`. The engine rolls through the existing check resolver, keeps the half the roll selected, and deletes the other before anything reads the turn. The discarded half's commands are gone before the spatial and package-verb parsers run. 2. **A placeholder for an outcome that is only a number.** `[[roll: 2d6+3]]` in the middle of a sentence. The engine rolls it with `crypto.randomInt` at parse time and substitutes the total. `[[roll: 1d8+STR]]` adds a character-sheet modifier by name, offered only when the chat has names to resolve; a name that does not resolve refuses the placeholder rather than defaulting to zero. The rolls appear in the dice history and the session log, and the substituted number carries a hover with the dice behind it. 3. **The shipped sparse tag for a number that has to choose between three or more endings.** The engine rolls and records it, the turn ends without the outcome, and the next turn narrates it. This is also the fallback for anything written in none of the forms, so nothing is left unresolved and nothing is invented. Failure contract: a placeholder the engine cannot read becomes a visible "(roll unavailable)" notice, a branch block it cannot read keeps the recorded roll and drops both halves, and a pass that throws saves the turn with the affected tags left sparse. In none of those cases is a second request made. The stream holds a placeholder or a branch block back while the draft streams, so the player never watches a raw tag turn into a number. Under the switch, an opt-in sub-option, also off by default: **Let the Game Master see one die of each size**. The engine throws one die of each standard size before the turn and shows the next value of each, so a three-way outcome can be narrated in the same pass. The engine keeps the queue, hands values out in order, never repeats one, recomputes every number in the record, bounds the DC, and rethrows a size that goes unspent for a few turns. Its help text says plainly that the Game Master can steer outcomes it can see, which the blind forms do not allow. Two things still cost an extra request and are stated in the docs: a `roll_dice` tool call when **Enable Tool Use** is on and the tool is in the chat's list, and a separate **Game tool connection**, which always makes its own planning request. Neither is the narration rewrite this removes. ## Alternatives considered - **The pool as the primary mechanism.** Rejected as the default for the peeking reason above. It is kept as the opt-in for the one case the blind forms cannot serve. - **Placeholders only.** Covers numbers but not a forked outcome, which is the common skill check. Both blind forms are needed. - **Calling `roll_dice` instead.** A tool call is a full extra round of the tool loop and is only available on connections with native tools. - **A `{{roll:}}` macro spelling.** Collides with the macro expander, which already claims that shape. - **Sending only a tail of the prompt on the rewrite.** Changes what the model sees on the second request and does not remove it. ## Additional context The Engine change is ready and its PR is opened alongside this issue. Everything is opt-in per chat and nothing changes how an already-saved transcript reads. The prompt-caching findings gathered while measuring this are deliberately out of scope and will come as a separate PR. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3466
No description provided.