Class ClientEntityManager
Client entity manager
Inherited Members
Namespace: LiteEntitySystem
Assembly: LiteEntitySystem.dll
Syntax
public sealed class ClientEntityManager : EntityManager
Constructors
ClientEntityManager(EntityTypesMap, InputProcessor, AbstractNetPeer, byte, byte)
Constructor
Declaration
public ClientEntityManager(EntityTypesMap typesMap, InputProcessor inputProcessor, AbstractNetPeer netPeer, byte headerByte, byte framesPerSecond)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityTypesMap | typesMap | EntityTypesMap with registered entity types |
| InputProcessor | inputProcessor | Input processor (you can use default InputProcessor/ |
| AbstractNetPeer | netPeer | Local AbstractPeer |
| byte | headerByte | Header byte that will be used for packets (to distinguish entity system packets) |
| byte | framesPerSecond | Fixed framerate of game logic |
Fields
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
CurrentRPCTick
Tick of currently executing rpc (check only in client RPC methods)
Declaration
public ushort CurrentRPCTick { get; }
Property Value
| Type | Description |
|---|---|
| ushort |
IsExecutingRPC
Is 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
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 |
StoredCommands
Stored input commands count for prediction correction
Declaration
public int StoredCommands { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Create<TInput>(EntityTypesMap, AbstractNetPeer, byte, byte)
Simplified constructor
Declaration
public static ClientEntityManager Create<TInput>(EntityTypesMap typesMap, AbstractNetPeer netPeer, byte headerByte, byte framesPerSecond) where TInput : unmanaged
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) |
| byte | framesPerSecond | Fixed framerate of game logic |
Returns
| Type | Description |
|---|---|
| ClientEntityManager |
Type Parameters
| Name | Description |
|---|---|
| TInput | Main input packet type |
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()