Enable sync mode per agent when creating the AgentSyncEffector
Until an AgentSyncEffector is present for an agent, it will be viewed as being synchronized.
This avoids freezing the simulation when the agent connects and doesn't
send the scene message within five cycles. In that case, the late scene
message would be processed, but the agent would not be synchronized.
Additional (syn)
messages would not help here because the realization of
the scene effector takes place in the PrePhysicsUpdate stage. As long as
this agent is connected, there would be no way to unfreeze the
simulation.
However, we still need the mPerceptorCycle < 5
condition. Otherwise, the AgentSyncEffector is present but due to the perception being delayed by one (?) cycle, agents will never receive a perception message. Without a perception message, they also won't send a message (containing a (syn)
).
Of course, if agents aren't sending their scene message within these first five cycles, the simulation still freezes. But it shouldn't make anything worse than it is right now because you COULD unfreeze the simulation with an additional (syn)
message in the next cycle.
In the future, it would probably not be a bad idea to get rid of this delayed perception. But that's something for another day...