Diarkis Field Module - How To Synchronize With Other User Clients

Diarkis Field module allows you to synchronize with other user clients based on X and Y coordinates.

Z coordinates represents "world". What it means is that different Z coordinate means different "parallel world". If you are in the different Z, "world", you will NOT see other user clients with the same coordinates with different Z.

How Diarkis Field Synchronize Works

Diarkis Field module synchronizes with other remote user clients by having all user clients to report their X and Y coordinates and Z space along with synchronize data (byte array) that they wish for the other user clients in sight to "see" (receive).

Steps:

  1. When entering Diarkis Field, you must invoke "SyncInt" first to receive synchronize data from the other user clients in your sight.
  2. Start invoking "Sync" with synchronize data that you with other user clients to receive when they are in sight.
  3. Repeat step 2 as you move about.

C# Code Example For SyncInit:

// this event receives the synchronization data from other user clients in sight
field.OnSyncInitResponse += (List<byte[]> synchronizeDataList) =>
{
// we do something here with synchronizeDataList
};

uint syncLimit = 40; // maximum number of user clients to synchronize with

uint customFilterID = 0; // passing 0 means no customFilter to be executed on the server

byte[] synchronizeData; // data to be synchronized with other user clients

field.SyncInit(x, y, z, syncLimit, customFilterID, synchronizeData);

C# Code Example For Sync:

// this event receives the synchronization data from the other user clients in sight
field.OnSync += (byte[] synchronizeData) =>
{
// we do something nice here with synchronizeData
};

uint syncLimit = 40; // maximum number of user clients to synchronize with

uint customFilterID = 0; // passing 0 means no customFilter to be executed on the server

byte[] synchronizeData; // data to be synchronized with other user clients

bool reliable = false; // if you are using UDP client, setting this flag to true will turn this into RUDP communication

field.Sync(x, y, z, syncLimit, customFilterID, synchronizeData, reliable);

How Diarkis Field Manages The World Map

Diarkis Field automatically divides the world map into grids and assign these grids to servers within the Diarkis server cluster.

These grids are re-calculated and re-assigned whenever the number of servers change within the Diarkis cluster.

The user clients are also moved around according to their coordinates.