Network Subsystem Component¶
Overview¶
The Network Subsystem provides specialized handling for components if you want to synchronize them over the network.
The Component you’ll want to use is the SynchronizedComponent<T>.
Example with the Synchronized Component¶
Here is the constructor for this component :
SynchronizedComponent<T>(T &&data);
The SynchronizedComponent<T> class is a subclass of the Component class.
It is used to represent synchronized components in the game.
The SynchronizedComponent<T> class has the following function to get and set the data:
T &getState();
void setState(T &data);
The getState() function is used to get the current state of the component.
The setState() function is used to set the current state of the component.
Syncing an Actor¶
To sync an actor, you’ll have to extend it with the SynchronizedObject<T> class.
This is a generic class that allows you to sync any type of data.
Here is the constructor for this class :
SynchronizedObject<T>(T &&data);
It is used to represent synchronized actors in the game.
The SynchronizedObject<T> class has the following function to get and set the data:
T &getState();
void setState(T &data);
The getState() function is used to get the current state of the actor.
The setState() function is used to set the current state of the actor.