[GH-ISSUE #592] [Issue]: Game Mode skill checks and Combat init ignore character sheet attributes #274

Closed
opened 2026-10-20 17:27:03 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Romuromylus on GitHub (May 9, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/592

Originally assigned to: @Romuromylus on GitHub.

Summary

The character sheet's RPG attributes (STR/DEX/CON/INT/WIS/CHA) are mechanically inert: in Game Mode the AI hallucinates skill-check modifiers instead of applying the sheet's values, and in Combat Mode the encounter-init LLM never even sees the player's character-card attributes when generating combat stat blocks.

This came out of investigating #556 (which is about the Roleplay-mode side panel). Filing this separately because the Game Mode and Combat Mode paths are mechanically broken, not just display issues.

Expected behavior

  • The Game Mode character sheet should show each attribute's modifier next to the score (e.g. STR 17 (+3)), using the same floor((score - 10) / 2) formula the server already implements.
  • A Strength-governed skill check on a character with STR 20 should apply a deterministic +5 attribute modifier.
  • A combat encounter init prompt should be told the player's character-sheet attributes so it can scale generated attack/defense/speed/hp to match the player's intended build (high STR → high attack, etc.).

Actual behavior

  • The character sheet shows raw scores only, no modifier indicator.
  • The GM emits [skill_check: skill="..." dc="..." rolls="..." modifier="..." total="..." result="..."] with all numbers filled in by the model. The modifier value bears no relation to the player's sheet attributes.
  • The deterministic server-side resolver at routes/game.routes.ts:4714 is reachable but rarely runs, and even when it does it reads from playerStats.attributes which is null for every chat — modifier always resolves to 0.
  • The combat encounter init prompt at routes/encounter.routes.ts:208-228 would inject the player's attributes as context, but it reads from the same playerStats.attributes field which is null. The LLM generates attack/defense/hp without ever seeing the player's STR/DEX/CON.

Steps to reproduce

Game Mode skill checks

  1. Start a Game Mode session and open the character sheet (Edit Sheet).
  2. Enable RPG Attributes and set STR to 20 (or 1 for the opposite extreme). Save.
  3. Take an action the GM should resolve as a Strength check.
  4. Inspect the resulting [skill_check: ...] tag in the message.
  5. Compare the modifier= field to the expected +5 (or -5).

Combat Mode init

  1. Same as above — set distinct attribute values on the character sheet.
  2. Trigger a combat encounter ([state: combat] from the GM).
  3. Inspect the generated party member's attack/defense/hp. They reflect the LLM's defaults rather than the character sheet.

Environment

  • Marinara Engine version: v1.5.8
  • Install type: docker (EasyPanel)
  • OS + version: any
  • Browser or app shell: any

Logs, screenshots, or video

Four converging code paths produce the bug:

  1. PlayerStats.attributes is always null. Every initializer in routes/generate.routes.ts (e.g. line 6925) and routes/generate/retry-agents-route.ts (line 815) defaults attributes: null. Nothing in the create/setup/start flow seeds it from the character card's rpgStats.attributes. So routes/game.routes.ts:4726 always falls into the ?? 10 branch and routes/encounter.routes.ts:213-228 skips the attribute line entirely.
  2. GM prompt fills in roll math itself. services/game/gm-prompts.ts:691,695 instructs the GM to emit rolls, modifier, total, result directly. The client at components/game/GameSurface.tsx:3098-3116 only falls back to the deterministic server route when those fields are absent — which the prompt makes rare.
  3. Two divergent shapes. Sheet stores gameCard.rpgStats.attributes: Array<{name, value}> with free-form names. Engine wants RPGAttributes: { str, dex, con, int, wis, cha }. No mapper exists between them.
  4. Combat init never receives sheet attributes. routes/encounter.routes.ts:208 reads playerStats.attributes only — same null source. There is no fallback to the player's gameCharacterCards[0].rpgStats.attributes, even though the encounter route already has access to chat metadata. The LLM then invents combat stats with no character-build hint.

Additional context

A fix should:

  • Show the modifier on the read-only attributes grid in GameCharacterSheet.tsx (mirrors the server formula).
  • Add a case-insensitive name mapper from sheet Array<{name, value}> to strict RPGAttributes, and fall back to the player's character-card rpgStats.attributes in the /skill-check route when playerStats.attributes is null. No DB migration needed.
  • Update the GM prompt to emit sparse [skill_check: skill="..." dc="..."] so the deterministic server path runs. Extend /skill-check to accept a preRolledD20 so a player-submitted [dice:1d20] still gets the modifier applied.
  • In routes/encounter.routes.ts, apply the same lazy fallback when building game-state context: when playerStats.attributes is null, map and emit the player's character-card attributes so combat init sees them. Add a brief prompt note that the LLM should scale attack/defense/hp to reflect the player's RPG attributes.

Out of scope: HP / AC / saves modifier breakdowns from #556 (no data model for those today); Roleplay-mode changes; persisting playerStats.attributes server-side (the lazy fallback is enough for both routes).

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @Romuromylus on GitHub (May 9, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/592 Originally assigned to: @Romuromylus on GitHub. ## Summary The character sheet's RPG attributes (`STR/DEX/CON/INT/WIS/CHA`) are mechanically inert: in Game Mode the AI hallucinates skill-check modifiers instead of applying the sheet's values, and in Combat Mode the encounter-init LLM never even sees the player's character-card attributes when generating combat stat blocks. This came out of investigating #556 (which is about the Roleplay-mode side panel). Filing this separately because the Game Mode and Combat Mode paths are mechanically broken, not just display issues. ## Expected behavior - The Game Mode character sheet should show each attribute's modifier next to the score (e.g. `STR 17 (+3)`), using the same `floor((score - 10) / 2)` formula the server already implements. - A Strength-governed skill check on a character with `STR 20` should apply a deterministic `+5` attribute modifier. - A combat encounter init prompt should be told the player's character-sheet attributes so it can scale generated `attack/defense/speed/hp` to match the player's intended build (high STR → high attack, etc.). ## Actual behavior - The character sheet shows raw scores only, no modifier indicator. - The GM emits `[skill_check: skill="..." dc="..." rolls="..." modifier="..." total="..." result="..."]` with all numbers filled in by the model. The `modifier` value bears no relation to the player's sheet attributes. - The deterministic server-side resolver at `routes/game.routes.ts:4714` is reachable but rarely runs, and even when it does it reads from `playerStats.attributes` which is `null` for every chat — modifier always resolves to `0`. - The combat encounter init prompt at `routes/encounter.routes.ts:208-228` *would* inject the player's attributes as context, but it reads from the same `playerStats.attributes` field which is null. The LLM generates `attack/defense/hp` without ever seeing the player's STR/DEX/CON. ## Steps to reproduce ### Game Mode skill checks 1. Start a Game Mode session and open the character sheet (`Edit Sheet`). 2. Enable RPG Attributes and set `STR` to `20` (or `1` for the opposite extreme). Save. 3. Take an action the GM should resolve as a Strength check. 4. Inspect the resulting `[skill_check: ...]` tag in the message. 5. Compare the `modifier=` field to the expected `+5` (or `-5`). ### Combat Mode init 1. Same as above — set distinct attribute values on the character sheet. 2. Trigger a combat encounter ([state: combat] from the GM). 3. Inspect the generated party member's `attack/defense/hp`. They reflect the LLM's defaults rather than the character sheet. ## Environment - Marinara Engine version: v1.5.8 - Install type: docker (EasyPanel) - OS + version: any - Browser or app shell: any ## Logs, screenshots, or video Four converging code paths produce the bug: 1. **`PlayerStats.attributes` is always null.** Every initializer in `routes/generate.routes.ts` (e.g. line 6925) and `routes/generate/retry-agents-route.ts` (line 815) defaults `attributes: null`. Nothing in the create/setup/start flow seeds it from the character card's `rpgStats.attributes`. So `routes/game.routes.ts:4726` always falls into the `?? 10` branch and `routes/encounter.routes.ts:213-228` skips the attribute line entirely. 2. **GM prompt fills in roll math itself.** `services/game/gm-prompts.ts:691,695` instructs the GM to emit `rolls`, `modifier`, `total`, `result` directly. The client at `components/game/GameSurface.tsx:3098-3116` only falls back to the deterministic server route when those fields are absent — which the prompt makes rare. 3. **Two divergent shapes.** Sheet stores `gameCard.rpgStats.attributes: Array<{name, value}>` with free-form names. Engine wants `RPGAttributes: { str, dex, con, int, wis, cha }`. No mapper exists between them. 4. **Combat init never receives sheet attributes.** `routes/encounter.routes.ts:208` reads `playerStats.attributes` only — same null source. There is no fallback to the player's `gameCharacterCards[0].rpgStats.attributes`, even though the encounter route already has access to chat metadata. The LLM then invents combat stats with no character-build hint. ## Additional context A fix should: - Show the modifier on the read-only attributes grid in `GameCharacterSheet.tsx` (mirrors the server formula). - Add a case-insensitive name mapper from sheet `Array<{name, value}>` to strict `RPGAttributes`, and fall back to the player's character-card `rpgStats.attributes` in the `/skill-check` route when `playerStats.attributes` is null. No DB migration needed. - Update the GM prompt to emit sparse `[skill_check: skill="..." dc="..."]` so the deterministic server path runs. Extend `/skill-check` to accept a `preRolledD20` so a player-submitted `[dice:1d20]` still gets the modifier applied. - In `routes/encounter.routes.ts`, apply the same lazy fallback when building game-state context: when `playerStats.attributes` is null, map and emit the player's character-card attributes so combat init sees them. Add a brief prompt note that the LLM should scale `attack/defense/hp` to reflect the player's RPG attributes. Out of scope: HP / AC / saves modifier breakdowns from #556 (no data model for those today); Roleplay-mode changes; persisting `playerStats.attributes` server-side (the lazy fallback is enough for both routes). ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:27:03 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Romuromylus commented on GitHub (May 9, 2026):

Will work on this

<!-- gh-comment-id:4411983400 --> @Romuromylus commented on GitHub (May 9, 2026): Will work on this
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#274
No description provided.