Netick
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------
-------------------------------
A rolling sequence counter for ordering values. Repeats indefinitely
with 1022 possible unique values (0 is treated as invalid internally).
Consumes 10 bits when encoded for transmission.
Constructs a NotServerException
Constructs a NotServerException with a message
The exception message
Constructs a NotServerException with a message and a inner exception
The exception message
The inner exception
Constructs a NotClientException
Constructs a NotClientException with a message
The exception message
Constructs a NotClientException with a message and a inner exception
The exception message
The inner exception
Constructs a BadPacketException
Represents a networked struct identifier for a .
A snapshot of the state of a collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
A networked collection.
Gets the number of elements contained in the queue.
Removes all elements from the queue.
Adds an item to the end of the queue if there is capacity.
The item to add.
true if the item was added; otherwise, false if the queue is full.
Removes and returns the item at the beginning of the queue.
The item removed from the beginning of the queue.
Thrown if the queue is empty.
Attempts to remove and return the item at the beginning of the queue.
When this method returns, contains the object removed from the queue, or the default value if the queue is empty.
true if an item was dequeued; otherwise, false.
Returns the item at the beginning of the queue without removing it.
The item at the beginning of the queue.
Thrown if the queue is empty.
Attempts to return the item at the beginning of the queue without removing it.
When this method returns, contains the object at the beginning of the queue, or the default value if the queue is empty.
true if an item was found; otherwise, false.
Adds an item to the underlying original queue. Used for local operations.
The item to add.
Configuration data for Netick.
Interpolation time in seconds.
Time in seconds.
A struct that is used to obtain interpolation data for a network variable.
Tries to obtain interpolation data for this frame.
Returns true if there was interpolation data for this frame.
Tries to obtain interpolation data for this frame. This is the array version.
Returns true if there was interpolation data for this frame.
A class representing an abstract interpolation interface, which is implemented by and
A class representing the local interpolation of this instance . This should be used whenever you want to use Predicted Timeline on the client.
Time in seconds.
A class representing the remote interpolation of this instance . This should be used whenever you want to use Remote Timeline on the client.
Interpolation time in seconds.
Time in seconds.
Returns true if this OnChanged callback is due to a mismatch between the state of this variable before rollback, and the state after rollback and resimulation.
Gets a snapshot of the previous state of a NetworkDictionary collection.
Gets a snapshot of the previous state of a NetworkHashSet collection.
Gets a snapshot of the previous state of a NetworkLinkedList collection.
Gets a snapshot of the previous state of a NetworkUnorderedList collection.
Gets a snapshot of the previous state of a NetworkQueue collection.
Gets a snapshot of the previous state of a NetworkStack collection.
Gets previous value for the changed network property.
Note: this must only be used with non-array network properties. For arrays, use instead.
Gets a pointer to the previous value
Gets the index of the changed element of the array.
Gets the value of the changed element of the array. This is an unsafe method, use it carefully and make sure to never go outside range to avoid a crash.
Gets the index of the changed element of the array.
A snapshot of the state of a collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
Determines whether the dictionary contains the specified key.
The key to locate in the dictionary.
true if the dictionary contains an element with the specified key; otherwise, false.
Determines whether the dictionary contains a specific value.
The value to locate in the dictionary.
true if the value is found; otherwise, false.
A networked collection.
Removes all keys and values from the dictionary.
Gets or sets the value associated with the specified key.
The key whose value to get or set.
The value associated with the specified key.
Thrown when the key does not exist in the dictionary.
Gets the number of elements contained in the dictionary.
Adds the specified key and value to the dictionary.
The key of the element to add.
The value of the element to add.
true if the key/value pair was added; false if the key already exists or the dictionary is full.
Removes the value with the specified key from the dictionary.
The key of the element to remove.
true if the element is successfully removed; otherwise, false.
Tries to get the value associated with the specified key.
The key whose value to get.
When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter.
true if the key was found; otherwise, false.
Sets the value associated with the specified key if it exists in the dictionary.
If the key is found, updates its value.
true if the key was found and updated; otherwise, false
Determines whether the dictionary contains the specified key.
The key to locate in the dictionary.
true if the dictionary contains an element with the specified key; otherwise, false.
Determines whether the dictionary contains a specific value.
The value to locate in the dictionary.
true if the value is found; otherwise, false.
Represents a group used for interest management in the Netick.
An InterestManagementGroup contains a collection of entities and manages which clients are interested in those entities,
typically for the purpose of optimizing network traffic by only sending relevant updates to clients.
Use this attribute on a property to make it networked. It will be synchronized across the network.
* Use the parameter "size" to specify the max capacity of a network array/collection.
* Use the parameter "relevancy" to specify who will receive this variable.
* Use the parameter "precision" to specify the precision of a float-based variable.
* Use the parameter "ensureSafety" to specify if it will always be safe to access this variable (for instance, when Netick is not running).
Use this attribute on a method you want to call when a specific property value changes. Example: [OnChanged(nameof(PropertyName)]
Use this attribute on any method you want to make an RPC. Must have the return type of void.
* Use the parameter "source" to specify who is allowed to send this RPC.
* Use the parameter "target" to specify who is allowed to receive and execute this RPC.
* Use the parameter "isReliable" to specify if this Rpc should be reliable or not, meaning it won't be lost (due to packet loss).
* Use the parameter "localInvoke" to specify if this Rpc should be executed on the machine it was called from.
A helper struct that can be used to as a timer for various gameplay purposes.
A snapshot of the state of a collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
Determines whether the hashset snapshot contains a specific value.
The object to locate in the snapshot.
true if item is found; otherwise, false.
A networked collection.
Gets the number of elements contained in the set.
Adds an item to the set.
The element to add.
true if the element is added to the set; false if the element is already present or the set was full.
Removes the specified item from the set.
The element to remove.
true if the element is successfully removed; otherwise, false.
Determines whether the set contains a specific value.
The object to locate in the set.
true if item is found; otherwise, false.
Removes all item from the set.
Represents an networked entity (object) in the simulation.
A snapshot of the state of a collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
Gets the number of elements in the stack.
A networked collection.
Gets the number of items contained in the stack.
Removes all items from the stack.
Pushes an item onto the top of the stack.
The item to push onto the stack.
True if the item was pushed; false if the stack is full.
Removes and returns the item at the top of the stack.
The item removed from the top of the stack, or default if the stack is empty.
Attempts to remove and return the item at the top of the stack.
The item removed from the top of the stack, or default if the stack is empty.
True if an item was removed; otherwise, false.
Returns the item at the top of the stack without removing it.
The item at the top of the stack, or default if the stack is empty.
Attempts to return the item at the top of the stack without removing it.
The item at the top of the stack, or default if the stack is empty.
True if an item was returned; otherwise, false.
Adds an item to the original stack (used for internal state).
The element to add.
A snapshot of the state of a collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
Gets the first node in the linked list snapshot.
Gets the last node in the linked list snapshot.
Gets the node at the specified index in the snapshot.
Index of this node within the collection.
Index of the next node.
Index of the previous node.
A networked linked list collection. This is an ordered list meaning that the elements insertion order is maintained when iterating through the collection.
Gets the first node in the linked list.
Gets the last node in the linked list.
Gets the number of items contained in the linked list.
Adds an item to the end of the linked list.
The item to add.
True if the item was added; otherwise, false.
Adds an item as the first node in the linked list.
The item to add.
The node that was added.
True if the item was added; otherwise, false.
Adds an item as the last node in the linked list.
The item to add.
The node that was added.
True if the item was added; otherwise, false.
Adds an item before the specified node in the linked list.
The node before which to insert the new item.
The item to add.
The node that was added.
True if the item was added; otherwise, false.
Adds an item after the specified node in the linked list.
The node after which to insert the new item.
The item to add.
The node that was added.
True if the item was added; otherwise, false.
Removes the first occurrence of the specified item from the linked list.
The item to remove.
True if the item was removed; otherwise, false.
Removes the specified node from the linked list.
The node to remove.
True if the node was removed; otherwise, false.
Removes all items from the linked list.
Gets an enumerable collection of all nodes in the linked list.
The NetickEngine class is the core of Netick, managing networking, simulation, interpolation, replication, etc.
A list containing all connected clients currently.
Note: if you want the clients + the server, use .
A list containing all connected clients currently, in addition to the server.
Note: if you only want the clients, use .
[Client Only] The of the server you are connected to. Returns null if you are not connected to any server, or if you are the server.
[Client Only] Returns true if this client is currently connected to a server.
Time period between simulation ticks.
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.
Incoming data in kilobytes per second (KBps).
Outgoing data in kilobytes per second (KBps).
[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.
[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.
[Client Only] Interpolation delay in seconds.
[Client Only] The round-trip time (RTT) of the client in seconds.
[Client Only] Disconnects this client from the server.
Returns the size of the entirety of the game's networked state snapshot size, in bytes. This includes the sizes of all allocated blocks.
Attaches a to the simulation.
Detaches a from the simulation.
Updates Netick logic.
Call this to invoke NetworkRender on simulated entities. This might not be needed if you are running a headless build.
Represents a network player, which can be either a local player (representing this player) or a remote connection (representing a connected client)).
The networked index of this player.
Note: it returns -1 on the client for the local player when not connected to a server.
Note: the server player always has Id 0.
Use this to associate an object with this player. This is a local variable that is not synced.
Represents a network tick.
This interface is used to internal Netick systems.
This interface is used to integrate Netick with a game engine.
Implements this to inform Netick about the size (in 32 bit words) of your connection meta data.
Implements this to inform Netick about the size (in 32 bit words) of your entity meta data.
This is called when a new entity has been added to the simulation.
This is called when an entity has been removed from the simulation.
This is called when an unliked entity has been removed from the simulation.
This is used to populate the user meta data for an entity.
This method is called on the client when it receives new entity meta data. This must be used to create/setup network entities on the client. It can be called many times not only when the data has changed.
Note: user entity meta data can be used for custom user data that might be used in creating entities.
This is called before sending packets to the target connection.
This is called when a full packet has been received.
A script which can be added to Netick internal simulation loop.
Used to initialize the user script and assign Engine.
Called when this script has been added to the simulation.
Called when this script has been removed from the simulation.
Called every frame. Executed before NetworkFixedUpdate.
Called every fixed-time network update/tick. Any changes/updates to the network state must happen here.
On the client, if you are the Input Source or if this Entity.PredictionMode is set to Global, it will be called several times in one update/tick during resimulations. To check for resimulations, use [].
Called every frame. Executed after NetworkUpdate and NetworkFixedUpdate.
A script which can have networked properties and rpcs.
This interface is used to integrate Netick with a game engine entity.
Used to initialize the user entity and assign Engine and Entity.
A snapshot of the state of a collection. Note this must not be used outside the scope of an OnChanged call or a NetworkRender call.
A networked list collection. This is an unordered list meaning that the order of the elements during iteration is undefined.
Gets the number of items contained in the list.
Removes all elements from the list.
Adds an item to the list.
The item to add.
True if the item was added; otherwise, false.
Removes an item from the list.
The item to add.
True if the item was removed; otherwise, false.
Manages interest groups and area of interest (AoI) layers.
Contains information about an RPC call.
The source of this RPC call (the player that originally called it).
Represents an RPC. Used internally only.
Internal method. Never call this.
Internal method. Never call this.
Internal method. Never call this.
Internal method. Never call this.
Always use NetworkBool instead of bool, for networked properties and RPC parameters.
----------------------------------------------------
The longest inward packet loss burst (more than 2 packets lost in a row) in the last 10 seconds.
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.
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.
Sends data to this connection.
Note: the low-level transport must implement for this method to have an effect.
Represents a fixed-size network-serializable string with a maximum length of 8 characters.
Represents a fixed-size network-serializable string with a maximum length of 16 characters.
Represents a fixed-size network-serializable string with a maximum length of 32 characters.
Represents a fixed-size network-serializable string with a maximum length of 64 characters.
Represents a fixed-size network-serializable string with a maximum length of 128 characters.
Represents a fixed-size network-serializable string with a maximum length of 256 characters.