Network Level Manager
The plNetworkLevelManager handles synchronized level loading across the server and all clients. It ensures all machines have loaded the same level before gameplay begins, with timeout handling and late-joiner support.
Overview
When the server decides to load a level, all clients must load it before gameplay can start. The Level Manager coordinates this:
Server sends a
LevelLoadmessage with the level path.Each client loads the level and sends a
LevelLoadCompleteacknowledgment.When all clients have acknowledged (or the timeout expires), the server sends
LevelStart.All machines begin gameplay simultaneously.
Accessing the Manager
Level States
State | Description |
|---|---|
| No level load in progress |
| Level load requested, waiting for client acknowledgments |
| All clients loaded (or timed out), level is playable |
Server API
Request Level Load
This sends a LevelLoad message to all connected clients and transitions to the Loading state.
Check Loading Status
Late-Joiner Sync
When a new client connects during or after a level load, sync the current level:
This is called automatically by the plNetworkWorldModule during the handshake process. The client receives the LevelLoad message, loads the level, sends its ack, and then receives LevelStart individually.
Client API
Handle Level Load
When a LevelLoad message arrives, the Level Manager broadcasts a plMsgNetworkLevelLoadRequested to all network components. Override the handler in your component to load the level and then notify completion:
Handle Level Start
When the server signals all clients are loaded, a plMsgNetworkLevelStart is broadcast:
Timeout
If a client fails to acknowledge within the timeout period, the server proceeds with LevelStart anyway. This prevents a single slow or disconnected client from blocking everyone.
The timeout is specified per load request:
A timeout of 0.0f disables the timeout (wait forever).
Messages
All level events are delivered as plMessage types to plNetworkComponent subclasses:
Message | Side | When Sent |
|---|---|---|
| Client / Host | Server requests a level load |
| All | Server signals gameplay can begin |
| Server | All clients finished loading (before LevelStart) |
Server-Side Flow
Integration with Session
The Network Session integrates with the Level Manager automatically. When you call pSession->StartGame("Mission01"), it internally calls RequestLevelLoad() on the Level Manager and manages the state transitions.