[PR #3340] [MERGED] feat(dice): animated dice components + wire into chat and game surfaces #5887

Closed
opened 2026-10-23 04:04:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/3340
Author: @Gunterlie
Created: 7/7/2026
Status: ✅ Merged
Merged: 7/7/2026
Merged by: @SpicyMarinara

Base: staging ← Head: dicey-stuff


📝 Commits (6)

  • 5e5d665 feat(dice): animated dice components + wire into chat and game surfaces
  • 002f7ab Merge branch 'staging' into dicey-stuff
  • f8c700c fix(dice): address code review findings
  • 89a7e63 Merge branch 'staging' into dicey-stuff
  • 368c2f3 fix(schema): revert extra schema restriction — type used by server-internal callers
  • 299a7d4 fix(dice): coin flip animation instead of lateral roll

📊 Changes

19 files changed (+1269 additions, -90 deletions)

View changed files

📝 packages/client/src/components/chat/ChatMessage.tsx (+6 -3)
📝 packages/client/src/components/chat/ConversationMessageBubble.tsx (+3 -0)
📝 packages/client/src/components/chat/ConversationMessageLine.tsx (+3 -0)
📝 packages/client/src/components/chat/ConversationMessageShared.tsx (+7 -0)
➕ packages/client/src/components/dice/AnimatedDiceRoll.tsx (+171 -0)
➕ packages/client/src/components/dice/AnimatedSkillCheckResult.tsx (+66 -0)
➕ packages/client/src/components/dice/DiceGlyph.tsx (+98 -0)
➕ packages/client/src/components/dice/dice-shapes.ts (+165 -0)
➕ packages/client/src/components/dice/dice-visual-profiles.ts (+54 -0)
➕ packages/client/src/components/dice/dice.css (+672 -0)
📝 packages/client/src/components/game/GameDiceResult.tsx (+2 -22)
📝 packages/client/src/components/game/GameSkillCheckResult.tsx (+2 -42)
📝 packages/client/src/components/game/GameSurface.tsx (+2 -0)
📝 packages/client/src/hooks/use-chats.ts (+1 -1)
📝 packages/client/src/lib/slash-commands.ts (+11 -2)
📝 packages/client/src/styles/globals.css (+0 -19)
📝 packages/server/src/services/storage/chats.storage.ts (+2 -1)
📝 packages/shared/src/schemas/chat.schema.ts (+1 -0)
📝 packages/shared/src/types/chat.ts (+3 -0)

📄 Description

Linked issue

Closes #

Why this change

  • Dice roll and skill check results were rendered with plain inline JSX and a bouncing emoji; there was no visual hierarchy or animation to convey the drama of a roll outcome.
  • The new animated dice components give rolls a proper physical look (3-D die glyph per die type) and a short flip/settle animation so results feel impactful in both game surfaces and chat messages.

What changed

  • packages/client/src/components/dice/ — new component directory:
    • DiceGlyph.tsx — renders a die face (d4 / d6 / d8 / d10 / d12 / d20 / d100) with the rolled value
    • dice-shapes.ts — SVG path data for each die polygon
    • dice-visual-profiles.ts — per-die-type colour and size config
    • AnimatedDiceRoll.tsx — animated wrapper for a DiceRollResult; supports "game" and "chat" display modes
    • AnimatedSkillCheckResult.tsx — animated wrapper for a SkillCheckResult with critical-success / critical-failure states
    • dice.css — keyframe animations and die styles
  • GameDiceResult.tsx and GameSkillCheckResult.tsx — replaced their inline display blocks with the new animated components
  • Chat message components (ChatMessage, ConversationMessageBubble/Line/Shared) — wired dice results through so rolls appear inline in conversation messages
  • Shared schema / types (chat.schema.ts, chat.ts) — added fields to carry dice result payloads through the message model
  • use-chats.ts, slash-commands.ts, chats.storage.ts — plumbing to surface dice results in chat context

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

  • Manually verify dice roll results animate correctly in game surface (trigger a /roll command in an active game)
  • Manually verify skill check overlays show correct label (SUCCESS / FAILURE / CRITICAL SUCCESS / CRITICAL FAILURE)
  • Manually verify dice results appear inline in chat message bubbles
  • Manually verify dismiss button closes overlays in both game and chat contexts
  • Check light mode and dark mode for die glyph contrast

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Bildschirmfoto 2026-07-07 um 21 00 26 Bildschirmfoto 2026-07-07 um 20 59 42

also coins (d2), but they translate to numbers, as we don't have a purpose yet
Bildschirmfoto 2026-07-07 um 21 47 24

Summary by CodeRabbit

  • New Features

    • Added animated dice-roll and skill-check result displays across chat and game screens.
    • Dice results now render with richer visuals, including dice animations, roll breakdowns, and improved styling.
    • Messages can now carry extra metadata so dice roll results are shown inline when present.
  • Bug Fixes

    • Dice roll results are now preserved and displayed consistently after being sent.
    • Rolling actions now clear old result displays when a new turn is submitted.

🔄 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/3340 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 7/7/2026 **Status:** ✅ Merged **Merged:** 7/7/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `dicey-stuff` --- ### 📝 Commits (6) - [`5e5d665`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5e5d6652b9dba4a44c29621efdcdb167d4ded4ac) feat(dice): animated dice components + wire into chat and game surfaces - [`002f7ab`](https://github.com/Pasta-Devs/Marinara-Engine/commit/002f7abe3245782847c456ca54db60238b55d40d) Merge branch 'staging' into dicey-stuff - [`f8c700c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f8c700cf1fe43dce37b82017e59cd06534eb8854) fix(dice): address code review findings - [`89a7e63`](https://github.com/Pasta-Devs/Marinara-Engine/commit/89a7e63ad2282fac81c388324160ffb4016b746e) Merge branch 'staging' into dicey-stuff - [`368c2f3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/368c2f3b383e61d049ea0e9c67af83dae409e15f) fix(schema): revert extra schema restriction — type used by server-internal callers - [`299a7d4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/299a7d43c5087c7551fe9a535b2de1c17f4a9cf0) fix(dice): coin flip animation instead of lateral roll ### 📊 Changes **19 files changed** (+1269 additions, -90 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+6 -3) 📝 `packages/client/src/components/chat/ConversationMessageBubble.tsx` (+3 -0) 📝 `packages/client/src/components/chat/ConversationMessageLine.tsx` (+3 -0) 📝 `packages/client/src/components/chat/ConversationMessageShared.tsx` (+7 -0) ➕ `packages/client/src/components/dice/AnimatedDiceRoll.tsx` (+171 -0) ➕ `packages/client/src/components/dice/AnimatedSkillCheckResult.tsx` (+66 -0) ➕ `packages/client/src/components/dice/DiceGlyph.tsx` (+98 -0) ➕ `packages/client/src/components/dice/dice-shapes.ts` (+165 -0) ➕ `packages/client/src/components/dice/dice-visual-profiles.ts` (+54 -0) ➕ `packages/client/src/components/dice/dice.css` (+672 -0) 📝 `packages/client/src/components/game/GameDiceResult.tsx` (+2 -22) 📝 `packages/client/src/components/game/GameSkillCheckResult.tsx` (+2 -42) 📝 `packages/client/src/components/game/GameSurface.tsx` (+2 -0) 📝 `packages/client/src/hooks/use-chats.ts` (+1 -1) 📝 `packages/client/src/lib/slash-commands.ts` (+11 -2) 📝 `packages/client/src/styles/globals.css` (+0 -19) 📝 `packages/server/src/services/storage/chats.storage.ts` (+2 -1) 📝 `packages/shared/src/schemas/chat.schema.ts` (+1 -0) 📝 `packages/shared/src/types/chat.ts` (+3 -0) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> Closes # ## Why this change - Dice roll and skill check results were rendered with plain inline JSX and a bouncing emoji; there was no visual hierarchy or animation to convey the drama of a roll outcome. - The new animated dice components give rolls a proper physical look (3-D die glyph per die type) and a short flip/settle animation so results feel impactful in both game surfaces and chat messages. ## What changed - **`packages/client/src/components/dice/`** — new component directory: - `DiceGlyph.tsx` — renders a die face (d4 / d6 / d8 / d10 / d12 / d20 / d100) with the rolled value - `dice-shapes.ts` — SVG path data for each die polygon - `dice-visual-profiles.ts` — per-die-type colour and size config - `AnimatedDiceRoll.tsx` — animated wrapper for a `DiceRollResult`; supports `"game"` and `"chat"` display modes - `AnimatedSkillCheckResult.tsx` — animated wrapper for a `SkillCheckResult` with critical-success / critical-failure states - `dice.css` — keyframe animations and die styles - **`GameDiceResult.tsx`** and **`GameSkillCheckResult.tsx`** — replaced their inline display blocks with the new animated components - **Chat message components** (`ChatMessage`, `ConversationMessageBubble/Line/Shared`) — wired dice results through so rolls appear inline in conversation messages - **Shared schema / types** (`chat.schema.ts`, `chat.ts`) — added fields to carry dice result payloads through the message model - **`use-chats.ts`**, **`slash-commands.ts`**, **`chats.storage.ts`** — plumbing to surface dice results in chat context ## 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 - Manually verify dice roll results animate correctly in game surface (trigger a `/roll` command in an active game) - Manually verify skill check overlays show correct label (SUCCESS / FAILURE / CRITICAL SUCCESS / CRITICAL FAILURE) - Manually verify dice results appear inline in chat message bubbles - Manually verify dismiss button closes overlays in both game and chat contexts - Check light mode and dark mode for die glyph contrast ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) <img width="1389" height="979" alt="Bildschirmfoto 2026-07-07 um 21 00 26" src="https://github.com/user-attachments/assets/d65ec9e1-6089-497f-9190-6faf4bb1446e" /> <img width="1702" height="982" alt="Bildschirmfoto 2026-07-07 um 20 59 42" src="https://github.com/user-attachments/assets/c7e55bfb-6b7b-4c03-bde7-ecc9789149c6" /> also coins (d2), but they translate to numbers, as we don't have a purpose yet <img width="221" height="94" alt="Bildschirmfoto 2026-07-07 um 21 47 24" src="https://github.com/user-attachments/assets/eb018b0a-1eb5-442d-89dd-f34329caf3cd" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added animated dice-roll and skill-check result displays across chat and game screens. * Dice results now render with richer visuals, including dice animations, roll breakdowns, and improved styling. * Messages can now carry extra metadata so dice roll results are shown inline when present. * **Bug Fixes** * Dice roll results are now preserved and displayed consistently after being sent. * Rolling actions now clear old result displays when a new turn is submitted. <!-- 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-23 04:04:50 +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#5887
No description provided.