Skip to content

SceneMultiplayer

eduardgushchin edited this page Oct 5, 2026 · 1 revision

Home | API by Category | Complete API Index | API Status

Field Value
Full name Electron2D.SceneMultiplayer
Namespace Electron2D
Kind class
Category API Networking

Overview

Polls scene peers, typed RPCs, spawning/property replication, authentication and custom packets with server relay.

Syntax

public class Electron2D.SceneMultiplayer

Remarks

The transport remains caller-owned. Packet/authentication spans are borrowed during callbacks. Root paths locate nodes; immutable typed RPC tokens replace reflection. Preparation/path discovery allocates, while repeated ready span/message processing reuses bounded buffers. Calls/disposal require the owner thread.

Inherits: MultiplayerAPI

Detailed engine reference

Members

Member Kind Summary
public SceneMultiplayer() constructor Creates a scene interface with local offline authority.
public event System.Action<System.Int32> PeerAuthenticating event Occurs before admission when a direct peer begins authentication.
public event System.Action<System.Int32> PeerAuthenticationFailed event Occurs after a pending peer fails/disconnects/expires.
public event Electron2D.MultiplayerPacketHandler PeerPacket event Delivers custom bytes with original sender identity; storage is borrowed only during the callback.
public System.Void Clear() method Clears admitted/pending/path state without closing the borrowed transport.
public System.Void CompleteAuth(System.Int32 id) method Commits local authentication and sends its completion; admission waits for remote completion.
public System.Void DisconnectPeer(System.Int32 id) method Removes a direct peer and closes its connection, suppressing this interface's local removal event.
protected override System.Void Dispose(System.Boolean disposing) method
public System.Int32[] GetAuthenticatingPeers() method Returns a caller-owned snapshot of direct peers awaiting bilateral authentication.
public override System.Int32[] GetPeers() method
protected override System.Collections.Generic.IEnumerable<Electron2D.PropertyDescriptor> GetPropertyDescriptors() method
public override System.Int32 GetRemoteSenderID() method
public override System.Int32 GetUniqueID() method
public override System.Void ObjectConfigurationAdd(Electron2D.Node node, Electron2D.MultiplayerSpawner spawner) method
public override System.Void ObjectConfigurationAdd(Electron2D.Node node, Electron2D.MultiplayerSynchronizer synchronizer) method
public override System.Void ObjectConfigurationAdd(System.String rootPath) method
public override System.Void ObjectConfigurationRemove(Electron2D.Node node, Electron2D.MultiplayerSpawner spawner) method
public override System.Void ObjectConfigurationRemove(Electron2D.Node node, Electron2D.MultiplayerSynchronizer synchronizer) method
public override System.Void ObjectConfigurationRemove(System.String rootPath) method
public override System.Void Poll() method
public override System.Void RPC<TNode, T>(System.Int32 peer, TNode node, RPCMethod<TNode, T> method, T arguments) method
public System.Void SendAuth(System.Int32 id, System.ReadOnlySpan<System.Byte> data) method Sends nonempty authentication bytes before either participant completes authentication.
public System.Void SendBytes(System.ReadOnlySpan<System.Byte> bytes, System.Int32 id = 0, Electron2D.TransferMode mode = Reliable, System.Int32 channel = 0) method Sends nonempty custom bytes to admitted peers.
protected override System.Void ValidateDisposal() method
public Electron2D.MultiplayerPacketHandler AuthCallback { get; set; } property Gets or sets a borrowed authentication-data callback; null automatically admits new peers.
public System.Double AuthTimeout { get; set; } property Gets or sets the monotonic authentication deadline in seconds.
public System.Int32 MaxDeltaPacketSize { get; set; } property Gets or sets the maximum whole encoded change-only synchronization packet size.
public System.Int32 MaxPacketBytes { get; set; } property Gets or sets the complete encoded message budget prepared on transport assignment.
public System.Int32 MaxSyncPacketSize { get; set; } property Gets or sets the maximum whole encoded periodic synchronization packet size.
public Electron2D.MultiplayerPeer MultiplayerPeer { get; set; } property Gets or replaces a borrowed connecting/connected transport; replacement clears network/path state.
public System.Boolean RefuseNewConnections { get; set; } property Gets or sets admission policy on the configured transport.
public System.String RootPath { get; set; } property Gets or sets the absolute scene root used by relative node RPC paths.
public System.Boolean ServerRelay { get; set; } property Gets or sets whether supported transports notify clients and relay messages through the server.

Member Details

SceneMultiplayer()

Kind: constructor

public SceneMultiplayer()

Summary

Creates a scene interface with local offline authority.

PeerAuthenticating

Kind: event

public event System.Action<System.Int32> PeerAuthenticating

Summary

Occurs before admission when a direct peer begins authentication.

PeerAuthenticationFailed

Kind: event

public event System.Action<System.Int32> PeerAuthenticationFailed

Summary

Occurs after a pending peer fails/disconnects/expires.

PeerPacket

Kind: event

public event Electron2D.MultiplayerPacketHandler PeerPacket

Summary

Delivers custom bytes with original sender identity; storage is borrowed only during the callback.

Clear()

Kind: method

public System.Void Clear()

Summary

Clears admitted/pending/path state without closing the borrowed transport.

CompleteAuth(System.Int32)

Kind: method

public System.Void CompleteAuth(System.Int32 id)

Summary

Commits local authentication and sends its completion; admission waits for remote completion.

Parameters

  • id: Pending direct identity.

DisconnectPeer(System.Int32)

Kind: method

public System.Void DisconnectPeer(System.Int32 id)

Summary

Removes a direct peer and closes its connection, suppressing this interface's local removal event.

Parameters

  • id: Direct remote identity; relayed client peers cannot be closed by another client.

Dispose(System.Boolean)

Kind: method

protected override System.Void Dispose(System.Boolean disposing)

GetAuthenticatingPeers()

Kind: method

public System.Int32[] GetAuthenticatingPeers()

Summary

Returns a caller-owned snapshot of direct peers awaiting bilateral authentication.

Returns

Pending identities, without admitted peers.

GetPeers()

Kind: method

public override System.Int32[] GetPeers()

GetPropertyDescriptors()

Kind: method

protected override System.Collections.Generic.IEnumerable<Electron2D.PropertyDescriptor> GetPropertyDescriptors()

GetRemoteSenderID()

Kind: method

public override System.Int32 GetRemoteSenderID()

GetUniqueID()

Kind: method

public override System.Int32 GetUniqueID()

ObjectConfigurationAdd(Electron2D.Node, Electron2D.MultiplayerSpawner)

Kind: method

public override System.Void ObjectConfigurationAdd(Electron2D.Node node, Electron2D.MultiplayerSpawner spawner)

ObjectConfigurationAdd(Electron2D.Node, Electron2D.MultiplayerSynchronizer)

Kind: method

public override System.Void ObjectConfigurationAdd(Electron2D.Node node, Electron2D.MultiplayerSynchronizer synchronizer)

ObjectConfigurationAdd(System.String)

Kind: method

public override System.Void ObjectConfigurationAdd(System.String rootPath)

ObjectConfigurationRemove(Electron2D.Node, Electron2D.MultiplayerSpawner)

Kind: method

public override System.Void ObjectConfigurationRemove(Electron2D.Node node, Electron2D.MultiplayerSpawner spawner)

ObjectConfigurationRemove(Electron2D.Node, Electron2D.MultiplayerSynchronizer)

Kind: method

public override System.Void ObjectConfigurationRemove(Electron2D.Node node, Electron2D.MultiplayerSynchronizer synchronizer)

ObjectConfigurationRemove(System.String)

Kind: method

public override System.Void ObjectConfigurationRemove(System.String rootPath)

Poll()

Kind: method

public override System.Void Poll()

RPC(System.Int32, TNode, RPCMethod<TNode, T>, T)

Kind: method

public override System.Void RPC<TNode, T>(System.Int32 peer, TNode node, RPCMethod<TNode, T> method, T arguments)

SendAuth(System.Int32, System.ReadOnlySpan<System.Byte>)

Kind: method

public System.Void SendAuth(System.Int32 id, System.ReadOnlySpan<System.Byte> data)

Summary

Sends nonempty authentication bytes before either participant completes authentication.

Parameters

  • id: Pending direct remote identity.
  • data: Borrowed nonempty bytes.

SendBytes(System.ReadOnlySpan<System.Byte>, System.Int32, Electron2D.TransferMode, System.Int32)

Kind: method

public System.Void SendBytes(System.ReadOnlySpan<System.Byte> bytes, System.Int32 id = 0, Electron2D.TransferMode mode = Reliable, System.Int32 channel = 0)

Summary

Sends nonempty custom bytes to admitted peers.

Parameters

  • bytes: Borrowed payload.
  • id: Zero broadcasts, positive targets, negative excludes.
  • mode: Requested transport mode.
  • channel: Nonnegative channel.

ValidateDisposal()

Kind: method

protected override System.Void ValidateDisposal()

AuthCallback

Kind: property

public Electron2D.MultiplayerPacketHandler AuthCallback { get; set; }

Summary

Gets or sets a borrowed authentication-data callback; null automatically admits new peers.

Value

Changes apply to new authentication sessions; pending sessions retain the current callback.

AuthTimeout

Kind: property

public System.Double AuthTimeout { get; set; }

Summary

Gets or sets the monotonic authentication deadline in seconds.

Value

3 initially; finite nonnegative, zero disables expiration.

MaxDeltaPacketSize

Kind: property

public System.Int32 MaxDeltaPacketSize { get; set; }

Summary

Gets or sets the maximum whole encoded change-only synchronization packet size.

Value

65535 initially; at least 128 bytes. Complete synchronizer groups are batched without splitting their properties.

MaxPacketBytes

Kind: property

public System.Int32 MaxPacketBytes { get; set; }

Summary

Gets or sets the complete encoded message budget prepared on transport assignment.

Value

65536 initially; 64 through 64 MiB. Change while no live network transport is configured.

MaxSyncPacketSize

Kind: property

public System.Int32 MaxSyncPacketSize { get; set; }

Summary

Gets or sets the maximum whole encoded periodic synchronization packet size.

Value

1350 initially; at least 128 bytes, bounded by 64 MiB and actual prepared/transport capacity.

MultiplayerPeer

Kind: property

public Electron2D.MultiplayerPeer MultiplayerPeer { get; set; }

Summary

Gets or replaces a borrowed connecting/connected transport; replacement clears network/path state.

Exceptions

  • T:System.InvalidOperationException: A disconnected or disposed peer is supplied.

RefuseNewConnections

Kind: property

public System.Boolean RefuseNewConnections { get; set; }

Summary

Gets or sets admission policy on the configured transport.

Value

False without a peer; setting without a peer fails.

RootPath

Kind: property

public System.String RootPath { get; set; }

Summary

Gets or sets the absolute scene root used by relative node RPC paths.

Value

Empty until SceneTree assignment. Changing it invalidates prepared path discovery.

ServerRelay

Kind: property

public System.Boolean ServerRelay { get; set; }

Summary

Gets or sets whether supported transports notify clients and relay messages through the server.

Value

True initially; changing live topology is caller-controlled.

Clone this wiki locally