Nebula
Client

NebulaClient

The game client.

generated from the sources
public sealed class NebulaClient : MonoBehaviour, IRpcSink

The game client. Talks only to the gateway, sends inputs, receives snapshots tagged (tick, epoch, owner) and predicts its own player. It is never a party to the handover protocol: which worker produced a snapshot is metadata used for epoch filtering and the debug overlay, nothing else.

Properties

Config

public NebulaConfig Config { get; }

ConnectionState

public State ConnectionState { get; }

ClientId

public uint ClientId { get; }

PlayerName

public string PlayerName { get; } = "";

LocalPlayer

public NetworkIdentity LocalPlayer { get; }

RttMs

public int RttMs { get; } = -1;

EstimatedServerTick

public double EstimatedServerTick { get; }

PredictedTick

public uint PredictedTick { get; }

InputLeadTicks

public int InputLeadTicks { get; }

InputLeadAdjustTicks

public int InputLeadAdjustTicks { get; }

Adaptive part of InputLeadTicks. Half the RTT plus a fixed margin is a guess that ignores the gateway's and worker's frame loops; the worker reports how early inputs really land and this closes the gap.

LastReportedInputLead

public int LastReportedInputLead { get; }

Worst input lead the worker reported most recently (ticks). Diagnostics.

InputLeadIncreases

public int InputLeadIncreases { get; }

EntityCount

public int EntityCount { get; }

Entities

public IEnumerable<NetworkIdentity> Entities { get; }

AuthorityChangesSeen

public int AuthorityChangesSeen { get; }

LastError

public string LastError { get; } = "";

Last connection failure or disconnect reason, for the title screen. Empty while healthy.

WantsConnection

public bool WantsConnection { get; }

Whether the client is trying to be connected (set by Connect/ConnectTo, cleared by Disconnect).

Events

EntitySpawned

public event Action<NetworkIdentity> EntitySpawned;

EntityDespawned

public event Action<NetworkIdentity> EntityDespawned;

LocalPlayerSpawned

public event Action<NetworkIdentity> LocalPlayerSpawned;

EntityAuthorityChanged

public event Action<NetworkIdentity, ushort, ushort> EntityAuthorityChanged;

ContainerOwnershipChanged

public event Action ContainerOwnershipChanged;

ConnectionStateChanged

public event Action<State> ConnectionStateChanged;

Methods

Initialize

public void Initialize(NebulaConfig config, bool autoConnect = true);
ParameterDescription
autoConnectConnect to NebulaConfig.GatewayAddress at once (bots, scripted clients); false leaves the client idle until ConnectTo is called from the title screen.

ConnectTo

public void ConnectTo(string address, ushort port, string playerName);

Connect to a gateway chosen at runtime (title screen). Replaces the configured address for reconnects.

Connect

public void Connect();

Disconnect

public void Disconnect();

Leave the gateway and stop reconnecting; the title screen comes back.

Find

public NetworkIdentity Find(ulong netId);

Nested types

State

public enum State

Members

NameValueDescription
Disconnected
Connecting
Connected
InGame

On this page