SynchronizationMessage

Network-serializable message struct sent from the session host to a newly connected client containing the full list of players currently in the session. Used to synchronize the new client's player state immediately after connection.

Definition

Namespace: Paragon.Core.Network Assembly: Paragon.dll

public struct SynchronizationMessage : INetworkSerializable

Implements: INetworkSerializable

Remarks

When a new client connects and passes connection approval, the host sends a SynchronizationMessage containing all current players before broadcasting a PlayerJoinedMessage for the new player. This ensures the joining client has the full player list before any incremental updates arrive.

On the receiving end, NetworkSession.OnSynchronizationMessage() clears the local player set and repopulates it from the message data, then resolves the session owner.

Unlike PlayerJoinedMessage and PlayerLeftMessage which carry a single player, this message serializes an array of players with a length prefix.

Properties

Players

public NetworkPlayer[] Players { get; }

The full array of players currently in the session.

Constructor

Parameter
Type
Description

players

NetworkPlayer[]

All players currently in the session

Methods

NetworkSerialize<T>

Serializes or deserializes the player array to/from a network buffer.

Write format:

  1. players.Length (int) — array length prefix

  2. For each player:

    • player.UserID (string)

    • player.UserName (string)

    • player.ClientID (ulong)

Read reconstruction: Reads the count, allocates a NetworkPlayer[], then for each entry creates a NetworkUser and looks up the NetworkClient via NetworkManager.API.ConnectedClients[clientId].

See Also

Last updated