Networking using game object extensions
Game objects have two methods of communicating over the network: RMIs and network serialization via Aspects
. Essentially, RMIs allow for event-based data transmission over the network, whereas an aspect continuously synchronizes data as it is invalidated.
Prior to being able to communicate over the network, each game object has to be bound to the network by using the IGameObject::BindToNetwork
function. This can be called from your Init
implementation by IGameObjectExtension
.
Remote Method Invocation (RMI)
Remote Method Invocation (RMI) is used to invoke functions on a remote client or server. This is very useful for synchronizing a state over the network, for example, to let all clients know that the player named "Dude" just spawned, and should be moved to a specific location and orientation.
RMI structure
To declare an RMI, we can make use of the macros listed as shown:
DECLARE_SERVER_RMI_NOATTACH
DECLARE_CLIENT_RMI_NOATTACH
DECLARE_SERVER_RMI_PREATTACH
DECLARE_CLIENT_RMI_PREATTACH...