Skip to content

feat(gameplay): implement persistent runs, time-weighted scoring, and resume UX - #26

Merged
merlik787-droi merged 2 commits into
Riddlrealm:mainfrom
rudra496:feat/issue-9-persistent-gameplay-runs
Aug 27, 2026
Merged

merlik787-droi merged 2 commits into
Riddlrealm:mainfrom
rudra496:feat/issue-9-persistent-gameplay-runs

Conversation

@rudra496

Copy link
Copy Markdown
Contributor

Closes #9

Summary of Changes

  1. Durable Run State Model & Redux Slice:

    • Defined GameplayRun, GameplayCompletionRecord, and QuestionAnswerRecord types with runtime validation guard isGameplayRun.
    • Implemented gameplaySlice.ts to manage run lifecycle (startRun,
      ecordAnswer, �bandonRun, clearRun).
    • Integrated gameplayReducer into store.ts.
  2. Time-Weighted Scoring & Reward Accumulator:

    • Implemented calculateQuestionScore in scoring.ts accounting for mode maxScore, total questions, and elapsed response time ( imeUsed).
    • Wired handleAnswerSubmit in Gameplay.tsx to receive imeUsed from QuestionContainer and update run progression and rewards.
  3. Session Persistence & Resume UX:

    • Persisted active in-progress runs under STORAGE_KEYS.GAMEPLAY_RUN in localStorage.
    • Added Resume affordance on /gameplay allowing players to continue interrupted runs or start fresh.
    • Cleared and recorded completions on win/loss without auto-resuming finished runs.
  4. Testing & Verification:

    • Added unit test suites for gameplaySlice and scoring under Vitest.
    • Verified clean production build (
      pm run build), linting (
      pm run lint), and 100% test pass rate (
      pm test, 15/15 test suites, 63/63 tests passing).

Copilot AI lite review requested due to automatic review settings August 24, 2026 14:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rudra496

Copy link
Copy Markdown
Contributor Author

Heads up: the failing test check here isn't from this branch's code. Main's package-lock.json has been broken since #24 — npm ci exits with EUSAGE (missing make-dir/html-escaper/semver and coverage-stack entries), so CI dies at Install before tests even run. Same root cause behind #27's red check.

I opened #30 with a minimal lockfile repair (12 restored entries, zero version changes). Once that merges, this PR's check should run clean.

@merlik787-droi
merlik787-droi merged commit dcca5ca into Riddlrealm:main Aug 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Persistent Gameplay Runs With Score And Reward Recording

3 participants