PlayerJoinedMessage

Network-serializable message struct broadcast by the session host to all existing clients when a new player joins the session. Carries the joining player's identity and client information.

Definition

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

public struct PlayerJoinedMessage : INetworkSerializable

Implements: INetworkSerializable

Remarks

This message is sent by the host inside NetworkSession.OnPlayerJoined() after a new client completes the connection approval process. On the receiving end, NetworkSession.OnPlayerJoinedMessage() deserializes the message and adds the player to the local player set.

The message manually serializes the NetworkPlayer's three fields (UserID, UserName, ClientID) rather than using automatic serialization, because NetworkPlayer is a record containing non-serializable references (NetworkClient). On deserialization, the NetworkClient is resolved from NetworkManager.API.ConnectedClients.

Properties

Player

public NetworkPlayer Player { get; }

The player that joined the session.

Constructor

Parameter
Type
Description

player

NetworkPlayer

The player that joined

Methods

NetworkSerialize<T>

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

Write order:

  1. player.UserID (string)

  2. player.UserName (string)

  3. player.ClientID (ulong)

Read reconstruction: Creates a NetworkUser from the deserialized ID and name, then looks up the NetworkClient via NetworkManager.API.ConnectedClients[clientId] to construct a full NetworkPlayer.

See Also

Last updated