Table of Contents

Class NetickEngine

Namespace
Netick
Assembly
Netick.dll
public sealed class NetickEngine
Inheritance
NetickEngine
Inherited Members

Constructors

NetickEngine()

public NetickEngine()

Fields

ClientSimulationCallbacks

public readonly List<IClientSimulationCallbacks> ClientSimulationCallbacks

Field Value

List<IClientSimulationCallbacks>

SimulatedLossIn

public float SimulatedLossIn

Field Value

float

SimulatedLossOut

public float SimulatedLossOut

Field Value

float

Properties

AuthoritativeTick

public Tick AuthoritativeTick { get; }

Property Value

Tick

Client

public Client Client { get; }

Property Value

Client

ClientSimulation

public ClientSimulation ClientSimulation { get; }

Property Value

ClientSimulation

Config

public NetickConfigData Config { get; }

Property Value

NetickConfigData

ConnectedClients

A list containing all connected clients currently.

Note: if you want the clients + the server, use ConnectedPlayers.

public IReadOnlyList<ServerConnection> ConnectedClients { get; }

Property Value

IReadOnlyList<ServerConnection>

ConnectedPlayers

A list containing all connected clients currently, in addition to the server.

Note: if you only want the clients, use ConnectedClients.

public IReadOnlyList<NetworkPlayer> ConnectedPlayers { get; }

Property Value

IReadOnlyList<NetworkPlayer>

CurrentRpcCaller

public NetworkPlayer CurrentRpcCaller { get; }

Property Value

NetworkPlayer

CurrentRpcSource

public NetworkConnection CurrentRpcSource { get; }

Property Value

NetworkConnection

Entities

public IReadOnlyDictionary<int, Entity> Entities { get; }

Property Value

IReadOnlyDictionary<int, Entity>

FixedDeltaTime

Time period between simulation ticks.

public float FixedDeltaTime { get; }

Property Value

float

InKBps

Incoming data in kilobytes per second (KBps).

public float InKBps { get; }

Property Value

float

InPacketLoss

[Client Only] Estimation of incoming packets that are being lost. Value ranges between 0.0 and 1.0, with 1.0 meaning all packets are being lost.

public float InPacketLoss { get; }

Property Value

float

InputEnabled

public bool InputEnabled { get; set; }

Property Value

bool

InterestManagement

public InterestManagement InterestManagement { get; }

Property Value

InterestManagement

InterpolationDelay

[Client Only] Interpolation delay in seconds.

public float InterpolationDelay { get; }

Property Value

float

IsClient

public bool IsClient { get; }

Property Value

bool

IsConnected

[Client Only] Returns true if this client is currently connected to a server.

public bool IsConnected { get; }

Property Value

bool

IsIMEnabled

public bool IsIMEnabled { get; }

Property Value

bool

IsInvokingNetworkRender

public bool IsInvokingNetworkRender { get; }

Property Value

bool

IsResimulating

Returns true if we are currently resimulating a previous input/tick of the past. On the server, it always returns false since only the clients resimulate.

public bool IsResimulating { get; }

Property Value

bool

IsRunning

public bool IsRunning { get; }

Property Value

bool

IsServer

public bool IsServer { get; }

Property Value

bool

LagCompensation

public INetickComponent LagCompensation { get; }

Property Value

INetickComponent

LocalInterpolation

public LocalInterpolation LocalInterpolation { get; }

Property Value

LocalInterpolation

LocalPeer

public NetworkPeer LocalPeer { get; }

Property Value

NetworkPeer

LocalPlayer

public NetworkPeer LocalPlayer { get; }

Property Value

NetworkPeer

MaxClients

public int MaxClients { get; }

Property Value

int

Monitor

public Monitor Monitor { get; }

Property Value

Monitor

Name

public string Name { get; }

Property Value

string

OnPostNetworkStart

public Action OnPostNetworkStart { get; set; }

Property Value

Action

OnTickEnd

public Action OnTickEnd { get; set; }

Property Value

Action

OnTickStart

public Action OnTickStart { get; set; }

Property Value

Action

OutKBps

Outgoing data in kilobytes per second (KBps).

public float OutKBps { get; }

Property Value

float

OutPacketLoss

[Client Only] Estimation of outgoing packets that are being lost. Value ranges between 0.0 and 1.0, with 1.0 meaning all packets are being lost.

public float OutPacketLoss { get; }

Property Value

float

Port

public int Port { get; }

Property Value

int

PostNetworkFixedUpdate

public Action PostNetworkFixedUpdate { get; set; }

Property Value

Action

PostResimulation

public Action PostResimulation { get; set; }

Property Value

Action

PostRollback

public Action PostRollback { get; set; }

Property Value

Action

PreClientResimulation

public Action PreClientResimulation { get; set; }

Property Value

Action

PreNetworkFixedUpdate

public Action PreNetworkFixedUpdate { get; set; }

Property Value

Action

PreResimulation

public Action PreResimulation { get; set; }

Property Value

Action

PreRollback

public Action PreRollback { get; set; }

Property Value

Action

PredictedTick

public Tick PredictedTick { get; }

Property Value

Tick

RTT

[Client Only] The round-trip time (RTT) of the client in seconds.

public double RTT { get; }

Property Value

double

RemoteInterpolation

public RemoteInterpolation RemoteInterpolation { get; }

Property Value

RemoteInterpolation

Server

public Server Server { get; }

Property Value

Server

ServerEndPoint

[Client Only] The IPEndPoint of the server you are connected to. Returns null if you are not connected to any server, or if you are the server.

public IEndPoint ServerEndPoint { get; }

Property Value

IEndPoint

ServerSimulation

public ServerSimulation ServerSimulation { get; }

Property Value

ServerSimulation

Simulate

public bool Simulate { get; set; }

Property Value

bool

Simulation

public Simulation Simulation { get; }

Property Value

Simulation

SimulationTick

public Tick SimulationTick { get; }

Property Value

Tick

SnapshotTick

public Tick SnapshotTick { get; }

Property Value

Tick

StartMode

public NetickStartMode StartMode { get; }

Property Value

NetickStartMode

Tick

public Tick Tick { get; }

Property Value

Tick

Timer

public SimulationClock Timer { get; }

Property Value

SimulationClock

Transport

public NetworkTransport Transport { get; }

Property Value

NetworkTransport

UserObject

public object UserObject { get; set; }

Property Value

object

Methods

AttachBehaviour(INetickScript)

Attachs a INetickScript to the simulation.

public void AttachBehaviour(INetickScript behaviour)

Parameters

behaviour INetickScript

ClientAddEntity(INetickEntity, int, int, NetworkPlayer, bool, NetickEntityMeta)

public void ClientAddEntity(INetickEntity entity, int id, int worldIndex, NetworkPlayer player, bool wasUnliked, NetickEntityMeta meta)

Parameters

entity INetickEntity
id int
worldIndex int
player NetworkPlayer
wasUnliked bool
meta NetickEntityMeta

ClientAddUnlinkedEntity(Entity, int, int)

public void ClientAddUnlinkedEntity(Entity entity, int id, int worldIndex)

Parameters

entity Entity
id int
worldIndex int

Connect(int, string, byte[], int)

public void Connect(int port, string ip, byte[] connectionData = null, int connectionDataLength = 0)

Parameters

port int
ip string
connectionData byte[]
connectionDataLength int

CreateAndLinkEntityLocal(INetickEntity)

public Entity CreateAndLinkEntityLocal(INetickEntity userEntity)

Parameters

userEntity INetickEntity

Returns

Entity

CreateEntity(int)

public Entity CreateEntity(int stateSizeWords)

Parameters

stateSizeWords int

Returns

Entity

DeattachBehaviour(INetickScript)

Deattachs a INetickScript from the simulation.

public void DeattachBehaviour(INetickScript behaviour)

Parameters

behaviour INetickScript

DestroyEntity(Entity, bool, bool)

public void DestroyEntity(Entity entity, bool instant, bool freeMemory)

Parameters

entity Entity
instant bool
freeMemory bool

DisconnectFromServer()

[Client Only] Disconnects this client from the server.

public void DisconnectFromServer()

DisconnectHost()

public void DisconnectHost()

FetchInput<T>(out T, ref bool, Entity, int)

public bool FetchInput<T>(out T input, ref bool isDuplicated, Entity entity, int localPlayerIndex) where T : unmanaged

Parameters

input T
isDuplicated bool
entity Entity
localPlayerIndex int

Returns

bool

Type Parameters

T

~NetickEngine()

protected ~NetickEngine()

GetBehaviourOrder(Type)

public int GetBehaviourOrder(Type type)

Parameters

type Type

Returns

int

GetEntityMeta(Entity)

public NetickEntityMeta* GetEntityMeta(Entity entity)

Parameters

entity Entity

Returns

NetickEntityMeta*

GetEntityUserMeta(Entity)

public byte* GetEntityUserMeta(Entity entity)

Parameters

entity Entity

Returns

byte*

GetInput<T>(int)

public T GetInput<T>(int index = 0) where T : unmanaged

Parameters

index int

Returns

T

Type Parameters

T

InvokeOnPlayerConnectedForHost()

public void InvokeOnPlayerConnectedForHost()

Kick(ServerConnection)

public void Kick(ServerConnection connection)

Parameters

connection ServerConnection

LinkEntity(INetickEntity, Entity)

public Entity LinkEntity(INetickEntity userEntity, Entity entity)

Parameters

userEntity INetickEntity
entity Entity

Returns

Entity

Render()

Call this to invoke NetworkRender on simulated entities. This might not be needed if you are running a headless build.

public void Render()

ResetForSceneSwitch()

public void ResetForSceneSwitch()

ServerAddEntity(NetworkPlayer, INetickEntity)

public void ServerAddEntity(NetworkPlayer inputSource, INetickEntity obj)

Parameters

inputSource NetworkPlayer
obj INetickEntity

SetEntityMetaDirty(Entity)

public void SetEntityMetaDirty(Entity entity)

Parameters

entity Entity

SetEntityUserMetaDirty(Entity, int*)

public void SetEntityUserMetaDirty(Entity entity, int* userData)

Parameters

entity Entity
userData int*

SetInput<T>(T, int)

public void SetInput<T>(T input, int index = 0) where T : unmanaged

Parameters

input T
index int

Type Parameters

T

Shutdown()

public void Shutdown()

Start(string, int, NetickStartMode, IGameEngine, NetickConfigData, NetworkTransport, ReflectionData, INetickLogger, IMemoryAllocator)

public void Start(string name, int serverPort, NetickStartMode startMode, IGameEngine gameEngine, NetickConfigData config, NetworkTransport transport, ReflectionData reflectionData, INetickLogger logger, IMemoryAllocator allocator)

Parameters

name string
serverPort int
startMode NetickStartMode
gameEngine IGameEngine
config NetickConfigData
transport NetworkTransport
reflectionData ReflectionData
logger INetickLogger
allocator IMemoryAllocator

Update(float, float)

Update Netick's logic.

public void Update(float deltaTime, float timeScale)

Parameters

deltaTime float
timeScale float