Skip to content

feat(spectator): let late joiners watch the running round - #443

Merged
theEvilReaper merged 4 commits into
mainfrom
feat/late-join-spectator
Oct 28, 2026
Merged

theEvilReaper merged 4 commits into
mainfrom
feat/late-join-spectator

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Contributor

Proposed changes

Until now, a player who connected while a round was running was turned away with "the game has already started". They could not play and could not watch the round either, and had to wait for the restart. This PR implements the proposal from #442: a late joiner becomes a spectator.

  • Joining late: In every phase after the lobby (preparation, game, end), a joining player gets a spectator place instead of a refusal. They spawn in the running map with the existing spectator mode. That means they are invisible to the living players, can fly, have the overview of the survivors, appear struck through in the tab list and have their own spectator chat. They get a short message that they are watching.
  • The living hear nothing: The living players get no join message, so a late joiner gives nothing away.
  • Limit: The new round setting maxSpectators (default 8) limits the places. Only late joiners count against it; players who died in the round already had a player slot. When the places are full, the player is turned away with "All spectator places are taken." maxSpectators=0 brings back the old refusal. maxPlayers now applies in the lobby only.
  • No participant: A late joiner gets no statistics row, no pity progress and no Slender pass, and does not count as a living survivor. Leaving again frees their place and does nothing to the round. The existing code already kept them out of statistics, pity and passes; tests now pin that down.
  • Preparation phase: Roles are handed out at the end of the roughly three-second preparation phase, to everyone who is online. Someone who joined in that window would have become a spectator first and a survivor or even the Slender right after. The role allocation and the wake-up animation now skip spectators.

Turning a player away still happens only once they are in the play state, never during configuration, so the proxy crash with duplicate registry entries stays fixed.

The proposal (#442) is not merged yet. This PR contains no file under openspec/.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING.md
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

./gradlew build passes, with 1565 tests in :game and no failures. Not yet tested live with a second client during a running round. That can be done on staging.

To get the old behaviour back, set maxSpectators=0. The GameConfig.Round record has a new fifth field; a four-argument constructor with the default keeps existing callers working.

A player who connects while a round runs is no longer refused. Late
joiners take one of the maxSpectators places and spawn as spectators in
the running map. The lobby limit does not apply to them, and a full set
of places is refused with a message of its own.
Players who join a running round are tagged as spectators, but the
role allocation and the wake-up camera still used every online player.
A late joiner could be drawn as the Slender or handed a survivor role.
The allocation now skips spectators, and the wake-up camera opens only
for the players who take part in the round.
@github-actions github-actions Bot added area: game Everything related to the the game module area: common labels Oct 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test results

  879 files    879 suites   7m 26s ⏱️
2 328 tests 2 326 ✅ 2 💤 0 ❌
6 984 runs  6 977 ✅ 7 💤 0 ❌

Results for commit f9b9586.

@theEvilReaper
theEvilReaper merged commit 5fd4932 into main Oct 28, 2026
9 checks passed
@theEvilReaper theEvilReaper added this to the v2.21.0 milestone Oct 29, 2026
@theEvilReaper
theEvilReaper deleted the feat/late-join-spectator branch October 29, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: common area: game Everything related to the the game module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants