Skip to main content

Network Types

This page documents the core enumerations, structs, and configuration types used throughout the networking plugin.

plNetworkRoleEnum​

Defines the role of the local machine in the network session.

ValueDescription
UndefinedNo role assigned yet
ServerDedicated server (no local player)
ClientConnected to a remote server
HostServer and client combined (listen server)
BothAlias for Host

plNetworkModeEnum​

High-level network mode.

ValueDescription
OfflineNo networking active
ClientRunning as a client
ServerRunning as a server

plNetworkChannelTypeEnum​

Controls the delivery guarantee for a message or component replication.

ValueDescription
NoneInvalid channel
UnreliableMessage may be lost or arrive out of order
UnreliableOrderedMessage may be lost but will arrive in order
ReliableMessage will always be received but may be out of order
ReliableOrderedMessage will always be received and will be in order

Guidance: Use Unreliable for frequent state updates (transforms, positions) where only the latest value matters. Use ReliableOrdered for important events (RPCs, spawn/despawn, game state changes).

plNetworkObjectRole​

Defines the authority model for a networked object.

ValueDescription
NoneNot a networked object
OwnedAuthoritativeThe owning client has full authority over this object
ReplicatedThe server has authority; clients receive read-only state
ReplicatedSimulatedServer-authoritative with client-side prediction

plNetworkConnectionState​

The connection lifecycle state.

ValueDescription
OfflineNot connected
ConnectingConnection attempt in progress
ConnectedSuccessfully connected
DisconnectingDisconnect in progress
DisconnectedConnection terminated

plNetworkDisconnectReason​

Reason codes for disconnection, used with Stop() and KickClient().

ValueDescription
UnknownNo specific reason
ClientQuitClient initiated graceful disconnect
ServerShutdownServer is shutting down
KickedClient was kicked by the server
TimeoutConnection timed out
VersionMismatchProtocol or game version mismatch
AuthenticationFailedAuthentication failure
ServerFullServer has no available slots
RateLimitedClient exceeded rate limits
BannedClient is banned

plNetworkConfig​

Configuration struct for network connections. Set this on the plNetworkWorldModule before calling StartServer(), StartClient(), or StartHost().

PropertyTypeDefaultDescription
m_DriverTypeplDriverTypeEnumENetNetwork transport driver
m_uiConnectionLimitplUInt1632Maximum number of connections
m_sServerAddressplString"127.0.0.1"Server address to connect to
m_uiServerPortplUInt167777Server port
m_uiMessageSizeplUInt161500Maximum message size in bytes
m_uiMessagePoolSizeplUInt162048Size of the internal message pool

plNetworkMessageIDs​

Defines the message ID ranges for the network protocol.

Core Protocol (0 - 63)​

IDNameDescription
0UndefinedInvalid
1HandshakeClient connection request
2HandshakeReplyServer response to handshake
3ObjectReplicateComponent state replication
4ObjectReplicatePartPartial replication (large objects)
5ObjectSpawnSpawn a networked object
6ObjectSpawnPartPartial spawn data
7ObjectDespawnDespawn a networked object
8ObjectRoleAuthority/ownership change
9ObjectRpcRemote procedure call
10TimeSyncClient requests time synchronization
11TimeSyncResponseServer time sync response
12DisconnectGraceful disconnect with reason
13ReconnectClient reconnection attempt
14ReconnectResponseServer reconnection response
15ServerRewindLag compensation rewind request
16LevelLoadServer tells clients to load a level
17LevelLoadCompleteClient reports level load finished
18LevelStartServer signals gameplay can begin

Engine Component Messages (64 - 127)​

Reserved for built-in engine component communication.

IDNameDescription
64TransformStateReplicated transform state (used by plNetworkedTransformComponent)

User/Game Messages (128 - 255)​

Reserved for game-specific messages. Use plNetworkMessageIDs::UserMessageStart (128) as the starting point for your custom message IDs, and register a handler via SetUserMessageCallback() on the world module.

plNetworkConnection​

Represents a network connection with a unique ID:

struct plNetworkConnection
{
plUInt32 m_uiConnectionID;
};

plNetworkStats​

Network statistics for a connection:

FieldTypeDescription
m_fRountTripTimefloatCurrent round-trip time in seconds
m_uiPacketsLostplUInt32Packets lost in the current period
m_uiTotalPacketsSentplUInt64Total packets sent since connection
m_uiTotalPacketsLostplUInt32Total packets lost since connection
m_uiTotalBytesSentplUInt64Total bytes sent
m_uiTotalBytesReceivedplUInt64Total bytes received

See Also​