Skip to content

Server: Allow game to continue without host in FreezeManager#866

Merged
notfood merged 1 commit intorwmt:devfrom
MhaWay:freeze-without-host
Apr 7, 2026
Merged

Server: Allow game to continue without host in FreezeManager#866
notfood merged 1 commit intorwmt:devfrom
MhaWay:freeze-without-host

Conversation

@MhaWay
Copy link
Copy Markdown

@MhaWay MhaWay commented Apr 7, 2026

Problem (standalone server)

When the host disconnects from a standalone/dedicated server, FreezeManager.Tick() returns early (if (!Server.PlayingPlayers.Any(p => p.IsHost)) return;), leaving the server frozen indefinitely. Other connected players cannot continue the game even though they are active.

This is particularly impactful for standalone server deployments where the host may disconnect and reconnect freely while other players remain connected.

Solution

Modified FreezeManager.Tick() to handle the host-absent case:

  • Host present: unchanged behavior - freeze/unfreeze follows the host's frozen state
  • Host absent, players connected: the server unfreezes so the game can continue
  • Host absent, no players: freeze state is left unchanged (the server loop already won't advance the game timer without active players)
  • Host reconnects: normal host-driven freeze/unfreeze behavior resumes seamlessly

Changes

  • Source/Common/FreezeManager.cs: Replaced the early-return guard with a two-branch approach
  • Source/Tests/FreezeManagerTest.cs: 6 new unit tests covering all scenarios
  • Source/Tests/Helper/DummyConnection.cs: Lightweight test double for ConnectionBase

Testing

All 71 tests pass (65 existing + 6 new).

When the host disconnects, the FreezeManager previously returned early,
leaving the server frozen indefinitely. Now when the host is absent:
- If players are still connected, the server unfreezes so the game can continue
- If no players are connected, the freeze state is left unchanged (the server
  loop already won't advance the game timer without players)
- When the host reconnects, normal host-driven freeze/unfreeze behavior resumes
Copilot AI review requested due to automatic review settings April 7, 2026 10:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a server “stuck frozen” condition when the host disconnects by making FreezeManager.Tick() explicitly handle the host-absent case, allowing remaining active players to continue.

Changes:

  • Update FreezeManager.Tick() to follow host freeze state when present, and to unfreeze when the host is absent but players are still playing.
  • Add a lightweight ConnectionBase test double to simplify server/player setup in unit tests.
  • Add 6 unit tests covering host-present, host-absent, and host-reconnect scenarios.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Source/Common/FreezeManager.cs Removes the “no host => return” behavior; adds host-present/host-absent branching to prevent indefinite freezes.
Source/Tests/FreezeManagerTest.cs New tests validating freeze/unfreeze behavior across host disconnect/reconnect situations.
Source/Tests/Helper/DummyConnection.cs Minimal ConnectionBase implementation for test setup without real networking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MhaWay MhaWay changed the title Allow game to continue without host in FreezeManager Server: Allow game to continue without host in FreezeManager Apr 7, 2026
@notfood notfood added fix Fixes for a bug or desync. 1.6 Fixes or bugs relating to 1.6 (Not Odyssey). standalone server Fix or bugs relating to the standalone server. labels Apr 7, 2026
@notfood notfood merged commit 6f8af03 into rwmt:dev Apr 7, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.6 Fixes or bugs relating to 1.6 (Not Odyssey). fix Fixes for a bug or desync. standalone server Fix or bugs relating to the standalone server.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants