How To Synchronize With Remote Clients In The Field Of View

Using Sync function, you are able to synchronize with remote clients that are within the field of view.

// This event is raised when a remote client in the field of view uses Sync
REG_EVENT(field->GetSyncEvent(), [this](void*, const vector<vector<uint8_t>>& list)

// Player character coordinate data
int64_t x = localCharacter->x;
int64_t y = localCharacter->y;
int64_t z = localCharacter->z;

// Maximum number of remote clients to synchronize with
uint16_t syncLimit = 50;

// If there is a custom filter defined on the server,
// setting this to the matching custom filter ID will have the server execute custom filter operation
// Setting this to 0 will disable custom filter
uint8_t customFilterId = 1;

// Setting this flag to true will make the message as an RUDP message if you are using UDP client
bool reliable = false;

field->Sync(x, y, z, syncLimit, customFilterId, bytesMessage, reliable);

Last updated