Class ClientEntityManager
Client entity manager
Inherited Members
Namespace: LiteEntitySystem
Assembly: LiteEntitySystem.dll
Syntax
public sealed class ClientEntityManager : EntityManager
Constructors
ClientEntityManager(EntityTypesMap, AbstractNetPeer, byte, MaxHistorySize)
Constructor
Declaration
public ClientEntityManager(EntityTypesMap typesMap, AbstractNetPeer netPeer, byte headerByte, MaxHistorySize maxHistorySize = MaxHistorySize.Size32)
Parameters
Type | Name | Description |
---|---|---|
EntityTypesMap | typesMap | EntityTypesMap with registered entity types |
AbstractNetPeer | netPeer | Local AbstractPeer |
byte | headerByte | 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
Declaration
public const int InputBufferSize = 64
Field Value
Type | Description |
---|---|
int |
PreferredBufferTimeHighest
Preferred input and incoming states buffer length in seconds lowest bound Buffer automatically decreases to Jitter time + PreferredBufferTimeHighest
Declaration
public float PreferredBufferTimeHighest
Field Value
Type | Description |
---|---|
float |
PreferredBufferTimeLowest
Preferred input and incoming states buffer length in seconds lowest bound Buffer automatically increases to Jitter time + PreferredBufferTimeLowest
Declaration
public float PreferredBufferTimeLowest
Field Value
Type | Description |
---|---|
float |
Properties
AverageJitter
Average jitter
Declaration
public float AverageJitter { get; }
Property Value
Type | Description |
---|---|
float |
CurrentRPCTick
Tick of currently executing rpc (check only in client RPC methods)
Declaration
public ushort CurrentRPCTick { get; }
Property Value
Type | Description |
---|---|
ushort |
IsExecutingRPC
Is server->client rpc currently executing
Declaration
public bool IsExecutingRPC { get; }
Property Value
Type | Description |
---|---|
bool |
LastProcessedTick
Player tick processed by server
Declaration
public ushort LastProcessedTick { get; }
Property Value
Type | Description |
---|---|
ushort |
LastReceivedTick
Last received player tick by server
Declaration
public ushort LastReceivedTick { get; }
Property Value
Type | Description |
---|---|
ushort |
LerpBufferCount
States count in interpolation buffer
Declaration
public int LerpBufferCount { get; }
Property Value
Type | Description |
---|---|
int |
LerpBufferTimeLength
Total states time in interpolation buffer
Declaration
public float LerpBufferTimeLength { get; }
Property Value
Type | Description |
---|---|
float |
LocalPlayer
Our local player
Declaration
public NetPlayer LocalPlayer { get; }
Property Value
Type | Description |
---|---|
NetPlayer |
NetPeer
Client network peer
Declaration
public AbstractNetPeer NetPeer { get; }
Property Value
Type | Description |
---|---|
AbstractNetPeer |
NetworkJitter
Network jitter in milliseconds
Declaration
public float NetworkJitter { get; }
Property Value
Type | Description |
---|---|
float |
PendingToRemoveEntites
Entities that waiting for remove
Declaration
public int PendingToRemoveEntites { get; }
Property Value
Type | Description |
---|---|
int |
RawServerTick
Current state server tick
Declaration
public ushort RawServerTick { get; }
Property Value
Type | Description |
---|---|
ushort |
RawTargetServerTick
Target state server tick
Declaration
public ushort RawTargetServerTick { get; }
Property Value
Type | Description |
---|---|
ushort |
RollBackTick
Current rollback tick (valid only in Rollback state)
Declaration
public ushort RollBackTick { get; }
Property Value
Type | Description |
---|---|
ushort |
ServerInputBuffer
Inputs count in server input buffer
Declaration
public byte ServerInputBuffer { get; }
Property Value
Type | Description |
---|---|
byte |
ServerSendRate
Send rate of server
Declaration
public ServerSendRate ServerSendRate { get; }
Property Value
Type | Description |
---|---|
ServerSendRate |
ServerTick
Current interpolated server tick
Declaration
public ushort ServerTick { get; }
Property Value
Type | Description |
---|---|
ushort |
StateSize
Current state size in bytes
Declaration
public int StateSize { get; }
Property Value
Type | Description |
---|---|
int |
StoredCommands
Stored input commands count for prediction correction
Declaration
public int StoredCommands { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Deserialize(ReadOnlySpan<byte>)
Declaration
public DeserializeResult Deserialize(ReadOnlySpan<byte> inData)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlySpan<byte> | inData | Incoming data including header byte |
Returns
Type | Description |
---|---|
DeserializeResult | Deserialization result |
GetPlayerController<T>()
Return client controller if exist
Declaration
public T GetPlayerController<T>() where T : ControllerLogic
Returns
Type | Description |
---|---|
T | controller if exist otherwise null |
Type Parameters
Name | Description |
---|---|
T | controller type |
OnAliveEntityAdded(InternalEntity)
Declaration
protected override void OnAliveEntityAdded(InternalEntity entity)
Parameters
Type | Name | Description |
---|---|---|
InternalEntity | entity |
Overrides
OnLogicTick()
Declaration
protected override void OnLogicTick()
Overrides
Reset()
Remove all entities and reset all counters and timers
Declaration
public override void Reset()
Overrides
Update()
Update method, call this every frame
Declaration
public override void Update()