Replication and Synchronization Overview

In Strix, each client has its own copy of the game world. Those copies must be kept identical to provide players a shared game world experience. It is called synchronization.

Strix can perform synchronization of objects in the game world and their properties in real-time. This section explains functions for synchronization.

There are several types of synchronization:

Replication

First of all, all copies of a world must appear as containing the same set of objects. To do so, an object created on a client must also be created on other clients, and a deleted object must be deleted on all clients. This type of synchronization is called replication.

The client that created the original object is called owner of that object (though you can transfer the ownership to another client later). Replicated objects are called replicas.

In Strix, replication is handled by its StrixReplicator component.

Movement

Many game objects move in the world, and those movements must also be synchronized.

It is the owner’s responsibility to control the movement of an object at its first place, and Strix synchronizes the movement to other clients. Movement synchronization is also handled by a component, and Strix provides several components that handle movement synchronization under different scenarios.

  • StrixMovementSynchronizer is the most versatile one, and it is capable of most of the movement of typical game objects.

  • StrixTransformSynchronizer is a lightweight version, suitable for objects that only make some simple movement. It can’t handle complex movement, but it works faster than StrixMovementSynchronizer with lower overhead.

  • StrixVehicleSynchronizer is specialized for vehicle-type objects.

Animation

Some game objects, especially creatures, have a set of animations so that they look alive and real. Those animations should be synchronized among clients.

In Strix, StrixAnimationSynchronizer does the job.

Variables/properties

A game object contains a lot of variables in it, and they are generally known as properties. Aspects of an object is controlled by changing those properties.

A Unity game object has a Transform component, and changing its property moves the object. The behavior of StrixTransformSynchronizer can be seen as a synchronization of those properties. Strix’s synchronization components take care of appropriate set of standard properties.

However, there will be other properties in your game objects to facilitate your own game. Those custom properties must be synchronized appropriately, too.

Strix provides several handy ways to synchronize any variables in an object.

RPC

The word RPC stands for remote procedure call, and it allows you to invoke a method of an object on another client. You can use RPC to synchronize anything, most typically actions caused by players inputs.