Connection and Reconnect
UPulseOnlineConnectionSubsystem (module PulseOnlineSession, game instance) reports how good the connection is and brings players back into their game after a crash or a lost connection.
Connection status
GetStatus() returns FPulseOnlineConnectionStatus:
| Field | Meaning |
|---|---|
State | Offline (menu, standalone), Hosting (this game instance is the server), Good, Degraded, Bad (connected; from ping and packet loss), Lost (connection to the server lost). |
PingMs | Round trip time to the server, -1 without a server connection. |
PacketLoss | Share of incoming packets lost (0..1). |
NatType | Open, Moderate, Strict or Unknown (from the network service: EOS through PulseOnlineEOS, Mock). |
bOnlineServicesAvailable | The first local user is logged in online. |
The status is checked every Connection Check Interval Seconds; thresholds are Degraded Ping Ms, Bad Ping Ms, Degraded Packet Loss and Bad Packet Loss. Changes fire OnConnectionStatusChanged; state changes also send the message Pulse.Message.Online.Connection.Changed (FPulseOnlineConnectionMessage), e.g. for a HUD hint. RefreshNatType queries the NAT type again (once at start and after a backend change by default, Query Nat Type).
Reconnect
Every game session a local user joins or hosts is remembered as FPulseOnlineLastSession (session key, lobby or dedicated server, host, owner, time), also across restarts (save game slot PulseOnlineLastSession; PIE instances get their own slots). Leaving on purpose (leave request, return to the menu) marks it, so it is not offered again.
- After a crash: at the start screen check
CanRejoin()and offer “Rejoin”;RejoinLastSession(Player)finds the session by its key and joins it (UPulseOnlineRejoinSessionRequest).ForgetLastSessiondrops it if the player declines. Hosts never rejoin; the rejoin window isRejoin Window Seconds. - After a lost connection: a client rejoins on its own (
Auto Rejoin On Connection Lost,Auto Rejoin Attempts,Auto Rejoin Delay Seconds).OnAutoRejoin(bStarted, bSucceeded)reports start and end;CancelAutoRejoinstops it. - Kicks and bans do not count as lost connections: the server administration (
PulseOnlineServer) tells the client before it kicks (NotifyRemovedByServer). Games that kick on their own callNotifyRemovedByServeron the client too, otherwise the client may rejoin.OnRemovedByServer(Reason)reports it, e.g. for a message (the bridgePulseOnlineHUDBridgeshows one through the UI host, by default the Pulse HUD).
UPulseOnlineRejoinSessionRequest also works with an explicit SessionKey (and bIsLobby), e.g. for a favourite server; the server browser uses it for bookmarks.
Testing
- Specs:
PulseOnline.Server(connection rating, rejoin window, last session and rejoin with the Mock backend, NAT type). - Cheats:
PulseOnlineConnection(status, NAT type, last session),PulseOnlineRejoin.