Match-End Rehost Flow (House Listen Server)¶
This document captures the current match-end rehost flow and the key nuances that future systems must respect. It is intended for features that execute around end-of-match or travel to House_Level.
Quick Summary¶
- Host client disconnects from the dedicated server, leaves the EOS session (but not lobby), and rehosts as listen on
House_Level. - Host publishes lobby member attributes to signal
rehostingthenready. - Non-hosts wait for the host's ready signal and then
ClientTravelto the host. - If host fails or times out, non-hosts fall back to local reinit (disconnect + travel).
Actors & Services¶
UOnlineManagerSubsystem- Owns
MatchEndServiceandEosHouseService. - Exposes
HandleMatchEndHouseRehost(...)and broadcasts success/failure. FOnlineMatchEndService- Orchestrates host/client flow, readiness, timeouts, and fallback.
FEosHouseService- EOS lobby/session and listen-server readiness gate.
Key EOS Lobby Member Attributes¶
house_state:"rehosting"then"ready".house_ready_seq: int64 sequence used to prevent stale signals.house_map: map name (defaults toHouse_Level).
Host Flow (Match End)¶
1) HandleMatchEndHouseRehost(...) called on host.
2) Set bSkipLobbyAutoInitAfterRehost = true to suppress auto-lobby creation.
3) Publish member attrs: house_state = rehosting.
4) Disconnect from dedicated server.
5) Force NetDriver shutdown to allow listen server creation.
6) Leave EOS session (keep lobby).
7) ServerTravel to House_Level?listen.
8) On PostLoadMap:
- If NetDriver already exists, treat as ready.
- Otherwise, call EnableListenServer(true) and treat success as ready.
9) Publish member attrs: house_state = ready, house_ready_seq, house_map.
10) Broadcast OnMatchEndHouseRehostSuccess.
Non-Host Flow (Match End)¶
1) HandleMatchEndHouseRehost(...) called on client.
2) Start timeout timer.
3) Resolve lobby owner PUID for target host.
4) Wait for lobby member attr changes.
5) When house_state == ready and house_ready_seq >= expected:
- Resolve connect string or build EOS travel URL.
- ClientTravel(..., TRAVEL_Absolute) to host.
- Broadcast success.
6) Failure modes trigger fallback:
- Timeout
- Host leaves lobby
- Unable to resolve travel
- EOS/networking prep fails
Fallback: disconnect, leave session/lobby, open House locally.
Readiness Gate¶
The ready signal is armed before travel and only fired once the listen server is confirmed:
- ArmHouseReadySignal(...) stores pending ready info.
- HandleListenServerReady() checks bHouseReadySignalArmed and then publishes ready attrs.
- Listen readiness is determined in PostLoadMapWithWorld to avoid LoadMap NetDriver asserts.
Auto-Init Guard¶
To avoid unintended lobby creation during rehost:
- bSkipLobbyAutoInitAfterRehost is set for the match-end flow.
- Guarded in:
- CleanupAndCreateEosLobby
- EnableListenServerOnCurrentMap
- ATankPlayerController::OnNakamaLoginComplete
Future systems that auto-init the lobby must respect this guard.
NetDriver / Travel Nuances¶
ClientTravel(TRAVEL_Absolute)does NOT guarantee the old NetDriver is gone.- You must wait for NetDriver to clear or explicitly shut it down before listen server creation.
- Listen enable must NOT happen during
LoadMap(asserts if NetDriver exists). PostLoadMapWithWorldis the safe hook for listen enable.
Failure Modes & Fallback¶
Common failure points: - NetDriver never clears - Listen server not enabled - Lobby ready attrs not published - Host leaves lobby - Ready seq mismatch or missing
Fallback behavior is intentionally aggressive to prevent clients from hanging:
- Disconnect from DS
- Leave EOS session/lobby
- Hard travel to House_Level
Debugging Tips¶
Watch for these logs in order:
- HandleMatchEndHouseRehost: Host flow starting
- UpdateMyMemberAttrs_HouseReady: State=rehosting
- TryOpenListenServer: ...
- OpenLevelAsListenServer: Pending listen enable set
- OnPostLoadMapWithWorld: ...
- HandleListenServerReady: Armed=1
- UpdateMyMemberAttrs_HouseReady: State=ready
- HandleLobbyMemberAttrsChanged: Host ready signal received
- TravelToHouseHost: Traveling to host
Design Guidance for Future Systems¶
- If your system runs during match end, ensure it does not auto-create lobbies or listen servers.
- Bind delegates using weak pointers where travel can recreate UI/controllers.
- Avoid work in
OnPostWorldInitializationthat creates a NetDriver. - Never assume lobby member attrs are stable; always check
house_ready_seq.