Project planning for spectator mode
Some checks failed
Monorepo build / build-flake (push) Has been cancelled

This commit is contained in:
2026-03-11 16:13:05 -04:00
parent deccfbedbe
commit aad79c022d
6 changed files with 42 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
---
id: US0018
type: userstory
status: Not Started
status: In Progress
priority: P0
---
## Story
@@ -19,7 +19,7 @@ As a GM, I want to be able to share a spectator link to the game so that onlooke
- [[T0028 Create the spectator view]]
## Planning
- [[US0016-planning]] <!-- link to planning doc (see planning template) -->
- [[US0018-planning]] <!-- link to planning doc (see planning template) -->
## Manual Tests (links)
- [[M000-login-success]]

View File

@@ -15,6 +15,7 @@ The normal URL for the game is the URL for spectators to join the game. If the g
- The GM has a control that opens the game for spectators
- The GM has a view that shows the number of spectators on the game
- The spectator view shows a placeholder for the game
- If the GM disables spectator mode, current spectators are disconnected
## Notes
- code paths, files to touch, tests to add

View File

@@ -9,7 +9,7 @@ assignee:
**Linked User Story:** [[US0018 Spectator Mode]]
## Description
The spectator view will show the tabletop, the list of characters, and the character's current health. Cards are visible and the spectator can zoom in on cards that have extra data.
The spectator view will show the tabletop, the list of characters, and the character's current health. Tabletop cards are visible and the spectator can zoom in on cards that have extra data.
## Definition of Done
- The game link works for spectator view only if the GM has opened the game to spectators.
@@ -17,7 +17,7 @@ The spectator view will show the tabletop, the list of characters, and the chara
- The spectator can see the background image
- The spectator can see the tabletop image
- The spectator can see all of the cards currently on the tabletop
- The spectator can see the characters in the game
- The spectator can see the characters in the game and their current health
## Notes
- code paths, files to touch, tests to add
- Create a new component in the system spec for the spectator sidebar.

View File

@@ -2,7 +2,7 @@
id: T0040
type: task
story: US0028
status: Not Started
status: Done
assignee:
---

View File

@@ -0,0 +1,34 @@
# Spectator Mode
## Overview
If a game is open to spectator mode, other people can use just a URL to join the game.
Spectators should use the same URL that players do. This URL would direct users to the GameView component, which would then direct viewers to the spectator view if they are not logged in.
## Architecture / Design notes
- `game_view.rs`: make the `user_overview` property to `GameView_` optional. Direct to `SpectatorView` if no `user_overview` is available.
- `database.rs`: add a flag to the games table to indicate whether the game is open to spectators
- `app.rs`: add functions to open the game to to spectators and to close the game. When closing the game, drop all `SocketState::Spectator` sockets observing this game. Only the GM can call these functions.
- `app.rs`: add a new `SocketState::Spectator(GameId)` for unauthenticated sockets in game. Create a new branch in `handle_request` to transition from the `Connected` state to the `JoinGame` state if the requested game is open to spectators.
- `router/game_routes.rs`: add two new routes for opening and closing the game to spectators. Each of these delegates to new handlers in `handlers/games.rs`.
- `PUT /{game_id}/spectator`
- `DELETE /{game_id}/spectator`
- `handlers/games.rs`: add new handlers, `open_to_spectators` and `close_to_spectators`, which process the HTTP parameters, authenticate the connection, and then delegate to the new `app.rs` spectator functions.
- `client.rs`:
## Implementation plan (steps)
1. Create a game flag, in the database, which makes the game available to spectators.
2. [[T0027 Create a control that lets the GM open the game to spectators]]
3. [[T0028 Create the spectator view]]
## Risks & Dependencies
- external systems, third-party libs, design decisions
## Estimation
- Rough estimate (hours / story points)
## Acceptance / QA notes
- Anything QA must verify beyond ACs.
## Open questions
- Q1, Q2

View File

@@ -2,7 +2,7 @@
id: D0031
type: defect
story:
status: Not Started
status: In Progress
assignee:
priority: P0
---