Jump to content

Are components excuted on slaves? Or just on master?


photo

Recommended Posts

While I'm coding with syncker and component systems, this question comes into my mind.

There are some objects should be syncked in the scene. All these objects got a component. I'm wondering that if the components are just excuted on master?

Link to comment

Hello.
if I understand correctly, you are using SynckerPlugin and C# ComponentSystem. The ComponentSystem knows nothing about the Syncker. The Syncker knows nothing about the Component System.

Now the C# Component System runs on both master and slave. do you want the component system to work only on the master? or to keep the components in sync?

if you want to turn off the component system
in SysyemLogic call https://developer.unigine.com/en/docs/2.14/api/library/common/logic/component_system/cs/class.componentsystem?rlang=cpp#setEnabled_bool_void
if syncker is initialized as a slave. 

if you want to synchronize the state of the components, you can use
on the master send messages
https://developer.unigine.com/en/docs/2.14/api/library/plugins/syncker/class.synckerinterface?rlang=cs#sendMessage_cstr_Blob_int_bool
subscribe and read on the slave
https://developer.unigine.com/en/docs/2.14/api/library/plugins/syncker/class.synckerinterface?rlang=cs#setMessageReceivedCallback_cstr_CallbackBase_ptr_void

what messages will be - you decide. You can make save/restore state methods for each component and send data in each frame, or send only the necessary data at the time of change.

both use cases are good.

it is important to remember that the synker synchronizes the state of the nodes, and sometimes this can be overkill. you can make high-level commands - and send them to the slave to do the same. this can reduce the load on the network.

  • Like 2
Link to comment
×
×
  • Create New...