GameService: question sequence + server timer #42

Open
opened 2026-04-19 07:23:39 +00:00 by forgejo-lila · 0 comments
Owner

Context

When a lobby game starts, the server generates questions and manages the per-question timer. Timer behavior varies by game mode.

Files to create/change

  • apps/api/src/services/multiplayerGameService.ts — new file.
  • Reuse existing gameService.ts for question generation.

Timer behavior per mode

  • TV Quiz Show: timer per question. First buzz pauses. Wrong buzz resumes for others.
  • Race to the Top: timer per question. Simultaneous. Ends when someone hits target.
  • Chain Link: timer per player turn. Stricter timeout = elimination.
  • Elimination: timer per question. Simultaneous. Wrong = eliminated.

Acceptance criteria

  • Question sequence generated once per game, stored in Valkey
  • Timer runs on server (not client)
  • Timer broadcasts remaining time periodically
  • On timeout: treat as wrong answer (or skip, per mode)
  • Timer duration configurable in lobby settings
  • Questions never sent with correct answer (server-side evaluation)

Notes

Existing gameService.ts handles question generation and answer evaluation. Multiplayer version wraps it with timing and coordination. See documentation/game-modes.md.

## Context When a lobby game starts, the server generates questions and manages the per-question timer. Timer behavior varies by game mode. ## Files to create/change - `apps/api/src/services/multiplayerGameService.ts` — new file. - Reuse existing `gameService.ts` for question generation. ## Timer behavior per mode - **TV Quiz Show**: timer per question. First buzz pauses. Wrong buzz resumes for others. - **Race to the Top**: timer per question. Simultaneous. Ends when someone hits target. - **Chain Link**: timer per player turn. Stricter timeout = elimination. - **Elimination**: timer per question. Simultaneous. Wrong = eliminated. ## Acceptance criteria - Question sequence generated once per game, stored in Valkey - Timer runs on server (not client) - Timer broadcasts remaining time periodically - On timeout: treat as wrong answer (or skip, per mode) - Timer duration configurable in lobby settings - Questions never sent with correct answer (server-side evaluation) ## Notes Existing `gameService.ts` handles question generation and answer evaluation. Multiplayer version wraps it with timing and coordination. See `documentation/game-modes.md`.
forgejo-lila added the
multiplayer
label 2026-04-19 07:23:39 +00: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: forgejo-lila/lila#42
No description provided.