Answer evaluation + broadcast results #45

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

Context

After all players answer (or timeout), evaluate and broadcast results.

Files to change

  • apps/api/src/ws/handlers/gameHandlers.ts

Behavior

  1. Evaluate each player's answer.
  2. Update scores in Valkey.
  3. Broadcast game:answer_result with correctOptionId, per-player results, eliminated players.
  4. Brief delay (3s) for players to see results.
  5. Send next question OR trigger game end.

Mode-specific

  • Elimination: remove eliminated. 1 remaining = game ends.
  • Race to the Top: check target score. Hit = game ends.
  • Chain Link: wrong answer = game ends.
  • TV Quiz Show: score only buzzing player.

Acceptance criteria

  • All players receive correct answer and per-player results
  • Scores accumulated correctly
  • Mode-specific win/elimination conditions checked
  • Brief pause between result and next question

Notes

Consider a strategy pattern where each game mode implements evaluateRound() to avoid deep nesting.

## Context After all players answer (or timeout), evaluate and broadcast results. ## Files to change - `apps/api/src/ws/handlers/gameHandlers.ts` ## Behavior 1. Evaluate each player's answer. 2. Update scores in Valkey. 3. Broadcast `game:answer_result` with correctOptionId, per-player results, eliminated players. 4. Brief delay (3s) for players to see results. 5. Send next question OR trigger game end. ## Mode-specific - **Elimination**: remove eliminated. 1 remaining = game ends. - **Race to the Top**: check target score. Hit = game ends. - **Chain Link**: wrong answer = game ends. - **TV Quiz Show**: score only buzzing player. ## Acceptance criteria - All players receive correct answer and per-player results - Scores accumulated correctly - Mode-specific win/elimination conditions checked - Brief pause between result and next question ## Notes Consider a strategy pattern where each game mode implements `evaluateRound()` to avoid deep nesting.
forgejo-lila added the
multiplayer
label 2026-04-19 07:23:40 +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#45
No description provided.