Table of Contents

Class ClientEntityManager

Namespace
LiteEntitySystem
Assembly
LiteEntitySystem.dll

Client entity manager

public sealed class ClientEntityManager : EntityManager
Inheritance
object
ClientEntityManager
Inherited Members

Constructors

ClientEntityManager(EntityTypesMap, AbstractNetPeer, byte, MaxHistorySize)

Constructor

public ClientEntityManager(EntityTypesMap typesMap, AbstractNetPeer netPeer, byte headerByte, MaxHistorySize maxHistorySize = MaxHistorySize.Size32)

Parameters

typesMap EntityTypesMap

EntityTypesMap with registered entity types

netPeer AbstractNetPeer

Local AbstractPeer

headerByte byte

Header byte that will be used for packets (to distinguish entity system packets)

maxHistorySize MaxHistorySize

Maximum size of lag compensation history in ticks

Fields

InputBufferSize

Maximum stored inputs count

public const int InputBufferSize = 64

Field Value

int

PreferredBufferTimeHighest

Preferred input and incoming states buffer length in seconds lowest bound Buffer automatically decreases to Jitter time + PreferredBufferTimeHighest

public float PreferredBufferTimeHighest

Field Value

float

PreferredBufferTimeLowest

Preferred input and incoming states buffer length in seconds lowest bound Buffer automatically increases to Jitter time + PreferredBufferTimeLowest

public float PreferredBufferTimeLowest

Field Value

float

Properties

AverageJitter

Average jitter

public float AverageJitter { get; }

Property Value

float

CurrentRPCTick

Tick of currently executing rpc (check only in client RPC methods)

public ushort CurrentRPCTick { get; }

Property Value

ushort

IsExecutingRPC

Is server->client rpc currently executing

public bool IsExecutingRPC { get; }

Property Value

bool

LastProcessedTick

Player tick processed by server

public ushort LastProcessedTick { get; }

Property Value

ushort

LastReceivedTick

Last received player tick by server

public ushort LastReceivedTick { get; }

Property Value

ushort

LerpBufferCount

States count in interpolation buffer

public int LerpBufferCount { get; }

Property Value

int

LerpBufferTimeLength

Total states time in interpolation buffer

public float LerpBufferTimeLength { get; }

Property Value

float

LocalPlayer

Our local player

public NetPlayer LocalPlayer { get; }

Property Value

NetPlayer

NetPeer

Client network peer

public AbstractNetPeer NetPeer { get; }

Property Value

AbstractNetPeer

NetworkJitter

Network jitter in milliseconds

public float NetworkJitter { get; }

Property Value

float

PendingToRemoveEntites

Entities that waiting for remove

public int PendingToRemoveEntites { get; }

Property Value

int

RawServerTick

Current state server tick

public ushort RawServerTick { get; }

Property Value

ushort

RawTargetServerTick

Target state server tick

public ushort RawTargetServerTick { get; }

Property Value

ushort

ServerInputBuffer

Inputs count in server input buffer

public byte ServerInputBuffer { get; }

Property Value

byte

ServerSendRate

Send rate of server

public ServerSendRate ServerSendRate { get; }

Property Value

ServerSendRate

ServerTick

Current interpolated server tick

public ushort ServerTick { get; }

Property Value

ushort

StateSize

Current state size in bytes

public int StateSize { get; }

Property Value

int

StoredCommands

Stored input commands count for prediction correction

public int StoredCommands { get; }

Property Value

int

Methods

Deserialize(ReadOnlySpan<byte>)

public DeserializeResult Deserialize(ReadOnlySpan<byte> inData)

Parameters

inData ReadOnlySpan<byte>

Incoming data including header byte

Returns

DeserializeResult

Deserialization result

GetDiagnosticData(Dictionary<int, LESDiagnosticDataEntry>)

public void GetDiagnosticData(Dictionary<int, LESDiagnosticDataEntry> diagnosticDataDict)

Parameters

diagnosticDataDict Dictionary<int, LESDiagnosticDataEntry>

GetPlayerController<T>()

Return client controller if exist

public T GetPlayerController<T>() where T : HumanControllerLogic

Returns

T

controller if exist otherwise null

Type Parameters

T

controller type

OnLogicTick()

protected override void OnLogicTick()

Reset()

Remove all entities and reset all counters and timers

public override void Reset()

Update()

Update method, call this every frame

public override void Update()