reckfellENGINE

SceneMultiplayer

The high-level network context for an Entity hierarchy.

On this page
class SceneMultiplayerReckfellSharpInherits MultiplayerApi

Handles RPC and configured replication relative to a network root. RootPath defines relative-path space; matching code/configuration must address corresponding entities on peers.

Do not enable AllowObjectDecoding just to accept arbitrary external data. Peer connectivity, user authentication, gameplay rights, sequence and request bounds are separate concerns. Defer tree API-table mutation out of network callbacks to a suitable main-thread phase.

Practical guide.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

SceneMultiplayerConstructor
# SceneMultiplayer
C#
public SceneMultiplayer();

Properties8

AllowObjectDecodingProperty
# AllowObjectDecoding
C#
public bool AllowObjectDecoding { get; set; }

Object-decoding permission. Keep false for a simple external protocol; this is not universal safe network-identity serialization.

AuthCallbackProperty
# AuthCallback
C#
public Callable AuthCallback { get; set; }

The callback to execute when receiving authentication data sent via SceneMultiplayer.SendAuth. If the Callable is empty (default), peers will be automatically accepted as soon as they connect.

AuthTimeoutProperty
# AuthTimeout
C#
public double AuthTimeout { get; set; }

If set to a value greater than 0.0, the maximum duration in seconds peers can stay in the authenticating state, after which the authentication will automatically fail. See the SceneMultiplayer.PeerAuthenticating and SceneMultiplayer.PeerAuthenticationFailed signals.

MaxDeltaPacketSizeProperty
# MaxDeltaPacketSize
C#
public int MaxDeltaPacketSize { get; set; }

Maximum size of each delta packet. Higher values increase the chance of receiving full updates in a single frame, but also the chance of causing networking congestion (higher latency, disconnections). See MultiplayerSynchronizer.

MaxSyncPacketSizeProperty
# MaxSyncPacketSize
C#
public int MaxSyncPacketSize { get; set; }

Maximum size of each synchronization packet. Higher values increase the chance of receiving full updates in a single frame, but also the chance of packet loss. See MultiplayerSynchronizer.

RefuseNewConnectionsProperty
# RefuseNewConnections
C#
public bool RefuseNewConnections { get; set; }

If true, the MultiplayerAPI's MultiplayerApi.MultiplayerPeer refuses new incoming connections.

RootPathProperty
# RootPath
C#
public EntityPath RootPath { get; set; }

Network root for relative Entity paths. Corresponding RPC objects must match relative to each participant's root.

ServerRelayProperty
# ServerRelay
C#
public bool ServerRelay { get; set; }

Controls relay between clients through the server. The guide lobby sets false for client/server-only exchange. The checked build exhibited a native failure with true during simultaneous client disconnects; this example does not establish correct operation of that mode.

Methods24

Clearvoid
# Clear
C#
public void Clear();

Clears the current SceneMultiplayer network state (you shouldn't call this unless you know what you are doing).

CompleteAuthError
# CompleteAuth
C#
public Error CompleteAuth(int id);

Mark the authentication step as completed for the remote peer identified by id. The MultiplayerApi.PeerConnected signal will be emitted for this peer once the remote side also completes the authentication. No further authentication messages are expected to be received from this peer. If a peer disconnects before completing authentication, either due to a network issue, the SceneMultiplayer.AuthTimeout expiring, or manually calling SceneMultiplayer.DisconnectPeer, the SceneMultiplayer.PeerAuthenticationFailed signal will be emitted instead of MultiplayerApi.PeerDisconnected.

Parameters
NameTypeDefault
idint—
Returns Error
DisconnectPeervoid
# DisconnectPeer
C#
public void DisconnectPeer(int id);

Disconnects the peer identified by id, removing it from the list of connected peers, and closing the underlying connection with it.

Parameters
NameTypeDefault
idint—
GetAuthCallbackCallable
# GetAuthCallback
C#
public Callable GetAuthCallback();
Returns Callable
GetAuthTimeoutdouble
# GetAuthTimeout
C#
public double GetAuthTimeout();
Returns double
GetAuthenticatingPeersint[]
# GetAuthenticatingPeers
C#
public int[] GetAuthenticatingPeers();

Returns the IDs of the peers currently trying to authenticate with this MultiplayerApi.

Returns int[]
GetMaxDeltaPacketSizeint
# GetMaxDeltaPacketSize
C#
public int GetMaxDeltaPacketSize();
Returns int
GetMaxSyncPacketSizeint
# GetMaxSyncPacketSize
C#
public int GetMaxSyncPacketSize();
Returns int
GetRootPathEntityPath
# GetRootPath
C#
public EntityPath GetRootPath();
Returns EntityPath
IsObjectDecodingAllowedbool
# IsObjectDecodingAllowed
C#
public bool IsObjectDecodingAllowed();
Returns bool
IsRefusingNewConnectionsbool
# IsRefusingNewConnections
C#
public bool IsRefusingNewConnections();
Returns bool
IsServerRelayEnabledbool
# IsServerRelayEnabled
C#
public bool IsServerRelayEnabled();
Returns bool
SendAuth2 overloads
# SendAuth · 1/2
C#
public Error SendAuth(int id, byte[] data);

Sends the specified data to the remote peer identified by id as part of an authentication message. This can be used to authenticate peers, and control when MultiplayerApi.PeerConnected is emitted (and the remote peer accepted as one of the connected peers).

Parameters
NameTypeDefault
idint—
databyte[]—
Returns Error
# SendAuth · 2/2
C#
public Error SendAuth(int id, ReadOnlySpan<byte> data);

Sends the specified data to the remote peer identified by id as part of an authentication message. This can be used to authenticate peers, and control when MultiplayerApi.PeerConnected is emitted (and the remote peer accepted as one of the connected peers).

Parameters
NameTypeDefault
idint—
dataReadOnlySpan<byte>—
Returns Error
SendBytes2 overloads
# SendBytes · 1/2
C#
public Error SendBytes(byte[] bytes, int id = 0, MultiplayerPeer.TransferModeEnum mode = MultiplayerPeer.TransferModeEnum.Reliable, int channel = 0);

Sends the given raw bytes to a specific peer identified by id (see MultiplayerPeer.SetTargetPeer). Default ID is 0, i.e. broadcast to all peers.

Parameters
NameTypeDefault
bytesbyte[]—
idint0
modeMultiplayerPeer.TransferModeEnumMultiplayerPeer.TransferModeEnum.Reliable
channelint0
Returns Error
# SendBytes · 2/2
C#
public Error SendBytes(ReadOnlySpan<byte> bytes, int id, MultiplayerPeer.TransferModeEnum mode, int channel);

Sends the given raw bytes to a specific peer identified by id (see MultiplayerPeer.SetTargetPeer). Default ID is 0, i.e. broadcast to all peers.

Parameters
NameTypeDefault
bytesReadOnlySpan<byte>—
idint—
modeMultiplayerPeer.TransferModeEnum—
channelint—
Returns Error
SetAllowObjectDecodingvoid
# SetAllowObjectDecoding
C#
public void SetAllowObjectDecoding(bool enable);
Parameters
NameTypeDefault
enablebool—
SetAuthCallbackvoid
# SetAuthCallback
C#
public void SetAuthCallback(Callable callback);
Parameters
NameTypeDefault
callbackCallable—
SetAuthTimeoutvoid
# SetAuthTimeout
C#
public void SetAuthTimeout(double timeout);
Parameters
NameTypeDefault
timeoutdouble—
SetMaxDeltaPacketSizevoid
# SetMaxDeltaPacketSize
C#
public void SetMaxDeltaPacketSize(int size);
Parameters
NameTypeDefault
sizeint—
SetMaxSyncPacketSizevoid
# SetMaxSyncPacketSize
C#
public void SetMaxSyncPacketSize(int size);
Parameters
NameTypeDefault
sizeint—
SetRefuseNewConnectionsvoid
# SetRefuseNewConnections
C#
public void SetRefuseNewConnections(bool refuse);
Parameters
NameTypeDefault
refusebool—
SetRootPathvoid
# SetRootPath
C#
public void SetRootPath(EntityPath path);
Parameters
NameTypeDefault
pathEntityPath—
SetServerRelayEnabledvoid
# SetServerRelayEnabled
C#
public void SetServerRelayEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—

Signals and events3

PeerAuthenticatingEvent
# PeerAuthenticating
C#
public event SceneMultiplayer.PeerAuthenticatingEventHandler PeerAuthenticating;

Emitted when this MultiplayerAPI's MultiplayerApi.MultiplayerPeer connects to a new peer and a valid SceneMultiplayer.AuthCallback is set. In this case, the MultiplayerApi.PeerConnected will not be emitted until SceneMultiplayer.CompleteAuth is called with given peer id. While in this state, the peer will not be included in the list returned by MultiplayerApi.GetPeers (but in the one returned by SceneMultiplayer.GetAuthenticatingPeers), and only authentication data will be sent or received. See SceneMultiplayer.SendAuth for sending authentication data.

Handler parameters
NameTypeDefault
idlong—
PeerAuthenticationFailedEvent
# PeerAuthenticationFailed
C#
public event SceneMultiplayer.PeerAuthenticationFailedEventHandler PeerAuthenticationFailed;

Emitted when this MultiplayerAPI's MultiplayerApi.MultiplayerPeer disconnects from a peer for which authentication had not yet completed. See SceneMultiplayer.PeerAuthenticating.

Handler parameters
NameTypeDefault
idlong—
PeerPacketEvent
# PeerPacket
C#
public event SceneMultiplayer.PeerPacketEventHandler PeerPacket;

Emitted when this MultiplayerAPI's MultiplayerApi.MultiplayerPeer receives a packet with custom data (see SceneMultiplayer.SendBytes). ID is the peer ID of the peer that sent the packet.

Handler parameters
NameTypeDefault
idlong—
packetbyte[]—
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.