Unigine.Plugins.Syncker.Master Class
Inherits from: | Syncker |
This class represents the master interface of the Syncker.
Syncker plugin must be loaded.
Master Class
Enums
CALLBACK_INDEX#
Callback types.SYNC_MASK#
Node synchronization mask.DEFAULT_SYNC_NODES#
Types of nodes that will be synchronized automatically after world loading.Name | Description |
---|---|
LIGHT_WORLD = 1 | World light. See the LightWorld class. |
WATER_GLOBAL = 1 << 1 | Global water. See the ObjectWaterGlobal class. |
CLOUD_LAYER = 1 << 2 | Cloud layer. See the ObjectCloudLayer class. |
OBJECT_PARTICLES = 1 << 3 | Particle system. See the ObjectParticles class. |
Properties
int NumSyncMaterials#
The total number of materials in the synchronization queue.
int NumSyncNodes#
The total number of nodes in the synchronization queue.
byte DefaultSyncNodes#
The Current mask defining types of nodes that will be synchronized automatically after world loading.
bool SyncWorldLoad#
The true if synchronization of world loading is enabled; otherwise, false.
bool SyncRender#
The A value indicating if synchronization of all render parameters is enabled.
When all slaves use the same rendering settings, synchronization of render parameters can be disabled.
bool SyncViewOffset#
The true if synchronization of view offset for projections is enabled; otherwise, false.
bool SyncPlayer#
The true if synchronization of the current player is enabled; otherwise, false.
int NumSlaves#
The total number of the slaves connected to the master.
bool AllowExtraSlaves#
The true if new Slaves can connect to the Master after starting the session; otherwise, false.
float SendRate#
The Frequency of sending packets to Slaves.
Members
string GetSlaveAddress ( int num ) #
Returns the network address of the given slave computer.Arguments
- int num - Slave number.
Return value
Network address of the slave computer.int GetSlavePort ( int num ) #
Returns the UDP port used by the slave with the specified number.Arguments
- int num - Slave number.
Return value
UDP port of the specified slave computer. 0 - means any unused port available.long GetSlaveID ( int num ) #
Returns the ID of the slave with the specified number. A unique Slave ID consists of two parts: IP (32 bits) + port (16 bits)Arguments
- int num - Slave number.
Return value
ID of the slave with the specified number.string GetSlaveWorldName ( int num ) #
Returns the name of the world file currently loaded on the specified slave.Arguments
- int num - Slave number.
Return value
Name of the world file currently loaded on the specified slave.void AddSyncNode ( Node node, byte sync_mask = SYNC_MASK::NODE_FLAGS | SYNC_MASK::TRANSFORM ) #
Enables synchronization of parameters of the given node via the UDP protocol.Scene nodes are not synchronized by default, this method is used to add a particular node to the synchronization queue.
Arguments
void AddSyncNodes ( Node[] nodes, byte sync_mask = SYNC_MASK::NODE_FLAGS | SYNC_MASK::TRANSFORM ) #
Enables synchronization of parameters of given nodes via the UDP protocol.Scene nodes are not synchronized by default, this method is used to add particular nodes to the synchronization queue.
Arguments
- Node[] nodes - List of nodes to synchronize.
- byte sync_mask - Synchronization mask, one of the SYNC_MASK values.
void SetSyncNodeMask ( Node node, byte sync_mask ) #
Sets a new synchronization mask for the specified node. Synchronization mask can be used for optimization reasons limiting the amount of data to be synchronized and thus reducing network load. For example, for moving parts of a helicopter we can set a mask to synchronize only node transformations:master.SetSyncNodeMask(fan_small, Unigine.Plugins.Syncker.Master.SYNC_MASK.TRANSFORM);
master.SetSyncNodeMask(fan_big, Unigine.Plugins.Syncker.Master.SYNC_MASK.TRANSFORM);
Arguments
- Node node - Node for which a new synchronization mask is to be set.
- byte sync_mask - New synchronization mask to be set for the specified node.
bool IsSyncNode ( Node node ) #
Returns a value indicating if synchronization of the given node is enabled. Using this method you can quickly check if a node is monitored by the Syncker (node's states are dispatched to Slaves over the network).Arguments
- Node node - Node to be checked.
Return value
true if synchronization of the given node is enabled; otherwise, false.Node GetSyncNode ( int num ) #
Returns the synchronized node with the given number.Arguments
- int num - Node number in the synchronization queue.
Return value
Synchronized node.void RemoveSyncNode ( int num ) #
Removes the specified node from the synchronization queue.Arguments
- int num - Node number in the synchronization queue.
void RemoveSyncNode ( Node node ) #
Removes the specified node from the synchronization queue.Arguments
- Node node - Node to be removed from synchronization.
void RemoveSyncNodeID ( int node_id ) #
Removes the specified node from the synchronization queue by its ID.Arguments
- int node_id - ID of the node to be removed from the synchronization queue.
void RemoveSyncNodes ( Node[] nodes ) #
Removes the specified nodes from the synchronization queue.Arguments
- Node[] nodes - List of nodes to be removed from the synchronization queue.
void ClearSyncNodes ( ) #
Removes all nodes from the synchronization queue.void AddSyncMaterial ( Material material ) #
Enables synchronization of the given material via the UDP protocol.Scene materials are not synchronized by default, this method is used to add a particular material to the synchronization queue.
Arguments
- Material material - Material to synchronize.
void AddSyncMaterials ( Material[] materials ) #
Enables synchronization of given materials via the UDP protocol.Scene materials are not synchronized by default, this method is used to add particular materials to the synchronization queue.
Arguments
- Material[] materials - List of materials to synchronize.
bool IsSyncMaterial ( Material mat ) #
Returns a value indicating if synchronization of the given material is enabled. Using this method you can quickly check if a material is monitored by the Syncker (material's states are dispatched to Slaves over the network).Arguments
- Material mat - Material to be checked.
Return value
true if synchronization of the given material is enabled; otherwise, false.Material GetSyncMaterial ( int num ) #
Returns the synchronized material with the given number.Arguments
- int num - Material number in the synchronization queue.
Return value
Synchronized material.void RemoveSyncMaterial ( int num ) #
Removes the material with the given number from the synchronization queue.Arguments
- int num - Material number in the synchronization queue.
void RemoveSyncMaterial ( Material material ) #
Removes the specified material from the synchronization queue.Arguments
- Material material - Material to be removed from the synchronization queue.
void RemoveSyncMaterials ( Material[] materials ) #
Removes the specified materials from the synchronization queue.Arguments
- Material[] materials - List of materials to be removed from the synchronization queue.
void ClearSyncMaterials ( ) #
Removes all materials from the synchronization queue.bool CreateNode ( Node node, byte sync_mask = 0 ) #
Synchronizes creation of the given node on all Slaves. This method is to be called after node creation on the Master.It is recommended to use the loadNode() or loadNodereference() methods whenever possible as this approach allows adding nodes of all types, unlike the createNode() method that supports only a limited number of them.
Node node = new NodeDummy();
master.CreateNode(node);
Arguments
Return value
true if the node was created successfully; otherwise, false.void DeleteNode ( Node node ) #
Synchronizes deletion of the given node (with all its children) on the Master and all Slaves. Similar to calling deleteLater() for the node.Arguments
- Node node - Node to delete.
bool IsNodeCreatedBySyncker ( Node node ) #
Returns a value indicating if the given node was created via the createNode() method. Using this method you can quickly check if a node is in the run-time objects creation buffer.Arguments
- Node node - Node to be checked.
Return value
true if the given node was created via the createNode() method; otherwise, false.void SetCustomPlayer ( string name, Player player ) #
Sets the specified player for the view, view group, or computer with the specified name.Synchronization of the main master camera is disabled.
Arguments
- string name - Name of a view, a view group, or a computer to set the custom player for.The specified name will be checked in the following order: view, view group, computer. The specified player will be set for the first element found.
- Player player - Player to be set.
void SetViewOffset ( vec3 offset ) #
Sets a new player's head position on the Master.Arguments
- vec3 offset - New player's head position coordinates to be set.
void LoadWorld ( string name ) #
Loads a world from the specified file on the Master and all Slaves. Syncker is able to automatically synchronize the current world, but it works as follows: Slaves shall only start loading a new world after it is completely loaded on the Master. This method provides a 2x speedup of world loading process, as it forces all hosts to start loading the world almost simultaneously.Arguments
- string name - Path to the *.world file to be loaded.
Node LoadNode ( string name, byte sync_mask = 0, mat4 init_transform ) #
Loads a node from the specified file to the world on the Master and all Slaves and places it to the specified ititial transformation. This is a network analogue of the loadNode() method of the World class. By default, the loaded node is not synchronized, which is suitable for static objects at run time and at the same time saves performance. For dynamic objects to be synchronized, the suitable synchronization mask should be set.Arguments
- string name - Path to the *.node file.
- byte sync_mask - Synchronization mask, one of the SYNC_MASK values.
- mat4 init_transform - Initial transformation of the node.
Return value
Loaded node or nullptr if an error has occurred.Node LoadNode ( string name, byte sync_mask = 0 ) #
Loads a node from the specified file to the world on the Master and all Slaves and places it at the origin with the default transformation. This is a network analogue of the loadNode() method of the World class. By default, the loaded node is not synchronized, which is suitable for static objects at run time and at the same time saves performance. For dynamic objects to be synchronized, the suitable synchronization mask should be set.Arguments
- string name - Path to the *.node file.
- byte sync_mask - Synchronization mask, one of the SYNC_MASK values.
Return value
Loaded node or nullptr if an error has occurred.NodeReference LoadNodeReference ( string name, byte sync_mask = 0, mat4 init_transform ) #
Loads a node reference from the specified file to the world on the Master and all Slaves and places it to the specified ititial transformation. This is a network analogue of the NodeReference class constructor. By default, the loaded node is not synchronized, which is suitable for static objects at run time and at the same time saves performance. For dynamic objects to be synchronized, the suitable synchronization mask should be set.Arguments
- string name - Path to the *.node file.
- byte sync_mask - Synchronization mask, one of the SYNC_MASK values.
- mat4 init_transform - Initial transformation of the node.
Return value
Node Reference instance if it was loaded successfully; otherwise nullptr.NodeReference LoadNodeReference ( string name, byte sync_mask = 0 ) #
Loads a node reference from the specified file to the world on the Master and all Slaves and places it to the origin with default transformation. This is a network analogue of the NodeReference class constructor. By default, the loaded node is not synchronized, which is suitable for static objects at run time and at the same time saves performance. For dynamic objects to be synchronized, the suitable synchronization mask should be set.Arguments
- string name - Path to the *.node file.
- byte sync_mask - Synchronization mask, one of the SYNC_MASK values.
Return value
Node Reference instance if it was loaded successfully; otherwise nullptr.bool IsNodeLoadedBySyncker ( Node node ) #
Returns a value indicating if the given node was loaded by the Syncker via the loadNode() or the loadNodeReference() method.Arguments
- Node node - Node to be checked.
Return value
true if the given node was created via the createNode() method; otherwise, false.IntPtr addCallback ( Master.CALLBACK_INDEX callback, CallbackDelegate func ) #
Adds a callback of the specified type. Callback functions can be used to determine actions to be performed when sending or receiving user messages, as well as when changing settings on the Master or a Slave. The signature of the callback function can be one of the following:// for the Syncker.Master.SESSION_STARTED type
void callback_function_name(void);
// for the Syncker.Master.SESSION_FINISHED type
void callback_function_name(void);
// for the Syncker.Master.SLAVE_CONNECTED type
void callback_function_name(int slave_num);
// for the Syncker.Master.SLAVE_DISCONNECTED type
void callback_function_name(int slave_num);
// for the Syncker.Master.MASTER_SETUP_CHANGED type
void callback_function_name(void);
// for the Syncker.Master.SLAVE_SETUP_CHANGED type
void callback_function_name(int slave_num);
Arguments
- Master.CALLBACK_INDEX callback - Callback type. One of the following values:
- CallbackDelegate func - Callback function.
Return value
Number of the last added callback of the specified type, if the callback was added successfully; otherwise, -1.bool removeCallback ( Master.CALLBACK_INDEX callback ) #
Removes a given callback from the list of callbacks of the specified type. Callback functions can be used to determine actions to be performed when sending or receiving user messages, as well as when changing settings on the Master or a Slave.Arguments
- Master.CALLBACK_INDEX callback - Callback type. One of the following values:
Return value
true if the position callback with the given ID was removed successfully; otherwise false.void clearCallbacks ( Master.CALLBACK_INDEX callback ) #
Clears all added callbacks of the specified type. Callback functions can be used to determine actions to be performed when sending or receiving user messages, as well as when changing settings on the Master or a Slave.Arguments
- Master.CALLBACK_INDEX callback - Callback type. One of the following values:
int AddMessageToBuffer ( string channel, Blob message ) #
Adds a message to the buffer to be received by additional slaves as soon as they connect.Arguments
- string channel - Channel name. Multiple systems may use Syncker's network simultaneously (e.g. IG and user's application). For convenience, all messages are sent and received via named channels.
- Blob message - Buffer containing the user message.
Return value
Message ID.int GetNumBufferedMessages ( string channel ) #
Returns the total number of buffered messages.Arguments
- string channel - Channel name. Multiple systems may use Syncker's network simultaneously (e.g. IG and user's application). For convenience, all messages are sent and received via named channels.
Return value
Total number of buffered messages.int GetBufferedMessageID ( string channel, int index ) #
Returns the ID of the buffered message by its index.Arguments
- string channel - Channel name. Multiple systems may use Syncker's network simultaneously (e.g. IG and user's application). For convenience, all messages are sent and received via named channels.
- int index - Message index number.
Return value
Message ID.Blob GetBufferedMessage ( string channel, int id ) #
Returns the buffer containing the message.Arguments
- string channel - Channel name. Multiple systems may use Syncker's network simultaneously (e.g. IG and user's application). For convenience, all messages are sent and received via named channels.
- int id - Message ID.
Return value
Buffer containing the user message.void RemoveBufferedMessage ( string channel, int id ) #
Removes the specified message from the buffer.Arguments
- string channel - Channel name. Multiple systems may use Syncker's network simultaneously (e.g. IG and user's application). For convenience, all messages are sent and received via named channels.
- int id - Message ID.
void ClearBufferedMessages ( string channel ) #
Removes all messages from the buffer.Arguments
- string channel - Channel name. Multiple systems may use Syncker's network simultaneously (e.g. IG and user's application). For convenience, all messages are sent and received via named channels.
string GetSlaveComputerName ( int num ) #
Returns the name of the slave computer with the specified index. If no name has been specified for the slave computer using the -computer_name startup argument, the system name is returned.Arguments
- int num - Slave index.
Return value
Slave computer name.Node CloneNode ( Node node, byte sync_mask = 0 ) #
Clones the specified node and synchronizes its cloning on all Slaves.Arguments
Return value
Cloned node.Node CloneNode ( Node node, byte sync_mask, mat4 init_transform ) #
Clones the specified node with the specified transformation and synchronizes its cloning on all Slaves.Arguments
- Node node - Node to clone.
- byte sync_mask - Synchronization mask, one of the SYNC_MASK values.
- mat4 init_transform - Cloned node position and rotation (if not specified, the source node transformation is used).
Return value
Cloned node.Last update:
2024-08-16
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)