[PR #393] [MERGED] fix(game): swap full-body sprite per dialogue emotion for GoEmotions packs #4603

Closed
opened 2026-10-22 04:09:05 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/393
Author: @Romuromylus
Created: 5/4/2026
Status: ✅ Merged
Merged: 5/4/2026
Merged by: @SpicyMarinara

Base: main ← Head: fix/game-mode-emotion-sprite-swap


📝 Commits (3)

  • a854d9b fix(game): pass per-character sprite expressions into GM prompt
  • 9a9b621 fix(game): use emitted dialogue expression as full-body pose candidate
  • cb2e40f Merge branch 'main' into fix/game-mode-emotion-sprite-swap

📊 Changes

2 files changed (+18 additions, -4 deletions)

View changed files

📝 packages/client/src/lib/game-full-body-pose.ts (+1 -1)
📝 packages/server/src/services/game/gm-prompts.ts (+17 -3)

📄 Description

Linked issue

Closes #392

Why this change

In Game Mode, the big VN-style character sprite never swaps with dialogue beats when the character's pack uses emotion-style filenames (e.g. SillyTavern GoEmotions: full_admiration.png, full_anger.png, full_joy.png, …). Whatever the GM emits as the dialogue expression, the sprite stays locked on the alphabetically first pose (admiration) for the whole chat.

Two compounding issues cause this:

  1. The GM prompt only exposes character.fullBody (custom full-body aliases) per character. character.expressions — the actual emotion sprite filenames — is dropped, so the model never learns the real catalog and emits names from the hard-coded Default expressions list (happy, angry, crying, …). Those names don't match GoEmotion filenames (joy, anger, grief, …), so the picker can't resolve them.

  2. resolveDialogueFullBodyPose only special-cases thinking and laughing; for every other emotion it goes straight to pickFirstAvailable(availablePoses, "idle"). Emotion packs ship no full_idle.png, so the lookup misses, falls through to "first available pose alphabetically", and locks on admiration.

Fixing one without the other doesn't help: the prompt fix gets the model emitting correct names, but the resolver still ignores them. The resolver fix lets it honor whatever the model emits, but if the model is emitting [happy] against a joy.png-style pack the names won't line up. Both edits are needed and they're tightly coupled.

What changed

  • packages/server/src/services/game/gm-prompts.ts — customSpriteLines now includes both expressions and fullBody per character, with a header instructing the model to use the listed names exactly when present. Characters with expressions but no fullBody aliases (the common case for SillyTavern packs) are no longer filtered out.
  • packages/client/src/lib/game-full-body-pose.ts — resolveDialogueFullBodyPose now passes normalizedExpression as the first candidate to pickFirstAvailable, so the resolver attempts to honor the GM-emitted emotion before falling back to idle and the alphabetical default. Action-pose packs (full_idle, full_walk, full_attack, …) are unaffected: the existing tail (idle → battle_stance → first available) still kicks in for non-pose emissions like [happy].

No new code paths, no API changes, no version bump.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

pnpm check passes locally on the cherry-picked branch. The fix has been deployed and exercised in a real Game Mode chat against the EasyPanel image build of this branch:

  • A character with a SillyTavern GoEmotions sprite pack (full_admiration.png, full_amusement.png, …, full_joy.png, full_anger.png, no full_idle.png) was selected.
  • Multiple Game Mode turns were sent. Before the fix the big VN sprite stayed on full_admiration.png for every line. After the fix the sprite swaps per dialogue beat to match the GM-emitted emotion ([joy] → full_joy.png, [anger] → full_anger.png, etc.).
  • Verified that a fresh chat and continued chat both show correct swapping.
  • Verified no regression for characters whose packs have no expression sprites at all (dialogue-avatar fallback path is unchanged).
  • Action-pose packs were not exercised in the live test, but the resolver tail (idle → battle_stance → first available) is preserved by construction — the change only adds the emitted expression as the first candidate.

Suggested reviewer-side checks:

  1. Open a Game Mode chat with a character that has a full_<emotion> pack and confirm the sprite swaps per turn.
  2. Open a Game Mode chat with a character that has an action-pose pack (full_idle, full_walk, …) and confirm [happy]/[crying] style emissions still default to idle.
  3. Confirm the dialogue-avatar (small in-bubble portrait) is unaffected for characters with non-full_-prefixed expression sprites.

Docs and release impact

  • No docs changes needed

Summary by CodeRabbit

  • Bug Fixes
    • Improved character pose resolution during dialogue by checking available animations for intended expressions before falling back to defaults.
    • Enhanced sprite expression handling to provide more accurate character representation options during gameplay.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/393 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 5/4/2026 **Status:** ✅ Merged **Merged:** 5/4/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `fix/game-mode-emotion-sprite-swap` --- ### 📝 Commits (3) - [`a854d9b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a854d9b7ec6663228d95beaad1a4c0d06515d16d) fix(game): pass per-character sprite expressions into GM prompt - [`9a9b621`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9a9b6211befe42841f6c2ae3e192b4f94aa19b0c) fix(game): use emitted dialogue expression as full-body pose candidate - [`cb2e40f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cb2e40f5f17cd5a26ced0013e84cffcb0924b33c) Merge branch 'main' into fix/game-mode-emotion-sprite-swap ### 📊 Changes **2 files changed** (+18 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/lib/game-full-body-pose.ts` (+1 -1) 📝 `packages/server/src/services/game/gm-prompts.ts` (+17 -3) </details> ### 📄 Description ## Linked issue Closes #392 ## Why this change In Game Mode, the big VN-style character sprite never swaps with dialogue beats when the character's pack uses emotion-style filenames (e.g. SillyTavern GoEmotions: `full_admiration.png`, `full_anger.png`, `full_joy.png`, …). Whatever the GM emits as the dialogue expression, the sprite stays locked on the alphabetically first pose (`admiration`) for the whole chat. Two compounding issues cause this: 1. The GM prompt only exposes `character.fullBody` (custom full-body aliases) per character. `character.expressions` — the actual emotion sprite filenames — is dropped, so the model never learns the real catalog and emits names from the hard-coded `Default expressions` list (`happy, angry, crying, …`). Those names don't match GoEmotion filenames (`joy, anger, grief, …`), so the picker can't resolve them. 2. `resolveDialogueFullBodyPose` only special-cases `thinking` and `laughing`; for every other emotion it goes straight to `pickFirstAvailable(availablePoses, "idle")`. Emotion packs ship no `full_idle.png`, so the lookup misses, falls through to "first available pose alphabetically", and locks on `admiration`. Fixing one without the other doesn't help: the prompt fix gets the model emitting correct names, but the resolver still ignores them. The resolver fix lets it honor whatever the model emits, but if the model is emitting `[happy]` against a `joy.png`-style pack the names won't line up. Both edits are needed and they're tightly coupled. ## What changed - `packages/server/src/services/game/gm-prompts.ts` — `customSpriteLines` now includes both `expressions` and `fullBody` per character, with a header instructing the model to use the listed names exactly when present. Characters with expressions but no fullBody aliases (the common case for SillyTavern packs) are no longer filtered out. - `packages/client/src/lib/game-full-body-pose.ts` — `resolveDialogueFullBodyPose` now passes `normalizedExpression` as the first candidate to `pickFirstAvailable`, so the resolver attempts to honor the GM-emitted emotion before falling back to `idle` and the alphabetical default. Action-pose packs (`full_idle`, `full_walk`, `full_attack`, …) are unaffected: the existing tail (`idle` → `battle_stance` → first available) still kicks in for non-pose emissions like `[happy]`. No new code paths, no API changes, no version bump. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes `pnpm check` passes locally on the cherry-picked branch. The fix has been deployed and exercised in a real Game Mode chat against the EasyPanel image build of this branch: - A character with a SillyTavern GoEmotions sprite pack (`full_admiration.png`, `full_amusement.png`, …, `full_joy.png`, `full_anger.png`, no `full_idle.png`) was selected. - Multiple Game Mode turns were sent. Before the fix the big VN sprite stayed on `full_admiration.png` for every line. After the fix the sprite swaps per dialogue beat to match the GM-emitted emotion (`[joy]` → `full_joy.png`, `[anger]` → `full_anger.png`, etc.). - Verified that a fresh chat and continued chat both show correct swapping. - Verified no regression for characters whose packs have no expression sprites at all (dialogue-avatar fallback path is unchanged). - Action-pose packs were not exercised in the live test, but the resolver tail (`idle` → `battle_stance` → first available) is preserved by construction — the change only **adds** the emitted expression as the first candidate. Suggested reviewer-side checks: 1. Open a Game Mode chat with a character that has a `full_<emotion>` pack and confirm the sprite swaps per turn. 2. Open a Game Mode chat with a character that has an action-pose pack (`full_idle`, `full_walk`, …) and confirm `[happy]`/`[crying]` style emissions still default to `idle`. 3. Confirm the dialogue-avatar (small in-bubble portrait) is unaffected for characters with non-`full_`-prefixed expression sprites. ## Docs and release impact - [x] No docs changes needed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved character pose resolution during dialogue by checking available animations for intended expressions before falling back to defaults. * Enhanced sprite expression handling to provide more accurate character representation options during gameplay. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:09:05 +07:00
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#4603
No description provided.