This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Master Class

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Sim SDK edition to use it.
Inherits from: Syncker

This class represents the master interface of the Syncker.

Notice
Syncker plugin must be loaded.

Master Class

Members


int getNumSlaves ( ) #

Returns the total number of the slaves connected to the Master.

Return value

Total number of slaves connected to the Master.

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.

string getSlaveView ( int num, int display_num ) #

Returns the name of the display or projector stored in the configuration file and assigned to the given display of the given slave computer.

Arguments

  • int num - Slave number.
  • int display_num - Display number.

Return value

Name of the display or projector.

void setSyncPlayer ( int enabled ) #

Enables synchronization of the current player's parameters via the UDP protocol:
  • Its transformation
  • Projection matrix
  • Viewport mask
  • Mask for reflections
  • Applied post-materials (if any)
Notice
Current player synchronization is used only when all slaves use the same camera.

Arguments

  • int enabled - 1 to enable synchronization; 0 - to disable it.

int isSyncPlayer ( ) #

Returns a value indicating if synchronization of the current player is enabled.
Notice
Current player synchronization is used only when all slaves use the same camera.

Return value

1 if synchronization of the current player is enabled; otherwise, 0.

void setSyncRender ( int enabled ) #

Enables synchronization of all render parameters via the UDP protocol: light scattering, occlusion, etc.
Notice
When all slaves use the same rendering settings, synchronization of render parameters can be disabled.

Arguments

  • int enabled - 1 to enable synchronization; 0 - to disable it.

int isSyncRender ( ) #

Returns a value indicating if synchronization of all render parameters is enabled.
Notice
When all slaves use the same rendering settings, synchronization of render parameters can be disabled.

Return value

true if synchronization of all render parameters is enabled; otherwise, false.

void addSyncNode ( Node node, int sync_mask = SYNC_MASK::NODE_FLAGS | SYNC_MASK::TRANSFORM ) #

Enables synchronization of parameters of the given node via the UDP protocol.
Notice
Scene nodes are not synchronized by default, this method is used to add a particular node to the synchronization queue.

Arguments

  • Node node - Node to synchronize.
  • int sync_mask - Synchronization mask.

void addSyncNodes ( Vector<Node> nodes, int sync_mask = SYNC_MASK::NODE_FLAGS | SYNC_MASK::TRANSFORM ) #

Enables synchronization of parameters of given nodes via the UDP protocol.
Notice
Scene nodes are not synchronized by default, this method is used to add particular nodes to the synchronization queue.

Arguments

  • Vector<Node> nodes - List of nodes to synchronize.
  • int sync_mask - Synchronization mask.

void setSyncNodeMask ( Node node, int 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:
Source code (UnigineScript)
master.setSyncNodeMask(fan_small, MASTER_TRANSFORM);
master.setSyncNodeMask(fan_big, MASTER_TRANSFORM);

Arguments

  • Node node - Node for which a new synchronization mask is to be set.
  • int 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.

int getNumSyncNodes ( ) #

Returns the total number of nodes in the synchronization queue.

Return value

Total number of nodes in the synchronization queue.

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 ( Vector<Node> nodes ) #

Removes the specified nodes from the synchronization queue.

Arguments

  • Vector<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.
Notice
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 ( Vector<Material> materials ) #

Enables synchronization of given materials via the UDP protocol.
Notice
Scene materials are not synchronized by default, this method is used to add particular materials to the synchronization queue.

Arguments

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

Return value

true if synchronization of the given material is enabled; otherwise, false.

int getNumSyncMaterials ( ) #

Returns the total number of materials in the synchronization queue.

Return value

Total number of materials in the synchronization queue.

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 ( Vector<Material> materials ) #

Removes the specified materials from the synchronization queue.

Arguments

  • Vector<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, int sync_mask = 0 ) #

Synchronizes creation of the given node on all Slaves. This method is to be called after node creation on the Master.
Notice
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.
Example:
Source code (UnigineScript)
Node node = new NodeDummy(); 
master.createNode(node);

Arguments

  • Node node - Node to create.
  • int sync_mask - Synchronization mask.

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.

int 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

1 if the given node was created via the createNode() method; otherwise, 0.

bool setSlavePlayer ( int num, Player player ) #

Sets the specified player for the specified Slave.
Notice
Synchronization of the main master camera is disabled.

Arguments

Return value

1 if the specified player was successfully set for the specified Slave; otherwise, 0.

void setSendRate ( float rate ) #

Sets the frequency of sending packets to Slaves. Use this method when network load is too high and slows down the whole IG system. It is recommended to use this method with interpolation enabled.

Source code (C++)
//On the Master
master->setSendRate(15.0f); // send packets 15 times per second

//Both on the Master and all Slaves
syncker->setInterpolationPeriod(0.1f); // 100 ms delay

Arguments

  • float rate - Frequency of sending packets to Slaves. The default value is -1 (every frame).
    Notice
    The value should not be less than 1 / getInterpolationPeriod(), otherwise the image shall be "stuttering".

float getSendRate ( ) #

Returns the current frequency of sending packets to Slaves. Use this method when network load is too high and slows down the whole IG system. It is recommended to use this method with interpolation enabled.

Return value

Frequency of sending packets to Slaves.

void setAllowExtraSlaves ( int slaves ) #

Sets a value indicating if new Slaves can connect to the Master after starting the session. This can be used, for example, to connect a Slave which is used as a tool for configuring projections and does not operate as an IG.

Arguments

  • int slaves - 1 to permit new Slaves connecting to the Master after starting the session; 0 - to forbid it.

int isAllowExtraSlaves ( ) #

Returns a value indicating if new Slaves can connect to the Master after starting the session. This can be used, for example, to connect a Slave which is used as a tool for configuring projections and does not operate as an IG.

Return value

1 if new Slaves can connect to the Master after starting the session; otherwise, 0.

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 setSyncViewOffset ( int offset ) #

Enables synchronization of view offset for projections via the UDP protocol.

Arguments

  • int offset - 1 to enable synchronization; 0 - to disable it.

int isSyncViewOffset ( ) #

Returns a value indicating if synchronization of view offset for projections is enabled.

Return value

true if synchronization of view offset for projections is enabled; otherwise, false.

void setSyncWorldLoad ( int load ) #

Enables synchronization of world loading via the UDP protocol.

Arguments

  • int load - 1 to enable synchronization; 0 - to disable it.

int isSyncWorldLoad ( ) #

Returns a value indicating if synchronization of world loading is enabled.

Return value

true if synchronization of world loading is enabled; otherwise, false.

void setDefaultSyncNodes ( int nodes ) #

Sets a new mask defining types of nodes that will be synchronized automatically after world loading. This mask can be used for optimization reasons limiting the number of nodes to be synchronized and thus reducing network load. For example, you can restrict automatic synchronization to global water, and clouds only:
Source code (UnigineScript)
master.setDefaultSyncNodes(MASTER_WATER_GLOBAL | MASTER_CLOUD_LAYER);

Arguments

  • int nodes - Mask defining types of nodes that will be synchronized automatically after world loading.

int getDefaultSyncNodes ( ) #

Returns the current mask defining types of nodes that will be synchronized automatically after world loading. This mask can be used for optimization reasons limiting the number of nodes to be synchronized and thus reducing network load.

Return value

Current mask defining types of nodes that will be synchronized automatically after world loading.

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, int 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.
  • int 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.

NodeReference loadNodeReference ( string name, int 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.
  • int sync_mask - Synchronization mask, one of the SYNC_MASK values.
  • mat4 init_transform - Initial transformation of the node.

int 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

1 if the given node was created via the createNode() method; otherwise, 0.

Variable addCallback ( int callback, Variable 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:
Source code (UnigineScript)
// 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

Return value

Number of the last added callback of the specified type, if the callback was added successfully; otherwise, -1.

bool removeCallback ( int callback, Variable func ) #

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

Return value

true if the position callback with the given ID was removed successfully; otherwise false.

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 a users App 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 a users App 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 a users App 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 a users App 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 a users App 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 a users App application). For convenience, all messages are sent and received via named channels.
Last update: 2021-12-13
Build: ()