Skip to content

NetworkSyncer Node

likeich edited this page Feb 15, 2021 · 7 revisions

Description

The Network Syncer node is attached to an object that has properties that will be synced over the network.

This node is the backbone of the plugin and handles all of the networking with little to no code required.

This node must be the child of the node it is networking. A single object can theoretically have infinite Network Syncer nodes as long as their root node is assigned to a uniquely named object. An example of where this would be useful can be found in my personal game where, as you can see below, the main player object has a NetworkSyncer node and the player weapon manager has it's own NetworkSyncer node as well.

til

Properties

Type Name Default
NodePath Root Node null
bool Server Owned false
PoolStringArray Synced Properties empty
PoolStringArray Synced Booleans empty
int Updates Per Second 60
int Updates Required 100
bool Print Latency false

Property Descriptions

  • Root Node - NodePath

This is the root of the Network Syncer node. The "root" is the node of the scene that will be uniquely named. This is NOT the node that will be networked, which is the parent of the NetworkSyncer node. The purpose of the root node is to be uniquely named so that the NetworkSyncer nodes can be cached to a unique path. If this is not set correctly, the syncing will break.


  • Server Owned - Boolean

This sets who owns the object and will be in control of its variables. If true, the server will own this node and handle that. This is useful when creating world objects that the server will handle.


  • Synced Properties - PoolStringArray

This is an array where the properties to be synced will be typed. Any value that the parent has can be synced in this manner. Examples of properties that can be synced are: translations, transforms, velocity, or any other custom properties.


  • Synced Booleans - PoolString Array

This is used in a similar way to the Synced Properties property. The name of the boolean variable can be typed in the array and will be synced automatically. This can be used to sync animations, keyboard inputs, or any other booleans. Booleans can also be synced in the Synced Properties array, but the Synced Booleans array is specifically designed to use less bandwidth. The number of synced booleans can be up to 64, any more will cause undefined behavior (to overcome this limit, a LongBool can be sent as a property in the synced properties list with a custom net_set_ function).


  • Updates Per Second - int

This determines how many times a second an object will be updated. This can be changed to reduce bandwidth requirements for non-essential objects. Synced players should update 60 times per second, but non-essential objects could be synced 10 times a second or less depending on your game requirements.


  • Update Percent Required - int

This determines how often an object will sync over the network when its properties have not changed. This is an optimization to reduce bandwidth requirements. If set to 100, all of the updates per second are guaranteed to be synced. For example, an object for aesthetic purposes is synced 10 times per second, if this is set to 100, then the object will sync 10 times per second, guaranteed. If set to 0, the object will only ever sync if its properties have changed.


  • Print Latency - Boolean

Prints the latency of the object to the console for debug purposes.

Clone this wiki locally