Distributed Python API #
Cluster Simulation performs changes only on the master simulation, clients' simulations apply the changes received from the master and don't require to react on every API command. Only selected commands are distributed to the clients, for example, AddAgent, LoadScene and Reset commands.
Command Setup top#
If command should be distributed to the clients it has to implement the IDistributedObject
interface. Master simulation can modify the arguments that will be sent to the clients inside the Execute
methods.
Asynchronous Commands top#
Some commands, like AddAgent and LoadScene, requires more time to execute as they may download required Asset Bundles from the server. In this case master simulation has to wait for all the cluster machines to execute the command. Simulator uses ILockingCommand
interface to solve this use case. Commands that implement this interface locks the Python API process until command's Executed
action is invoked on every machine.