The newly-released SpatialOS 12 SDK brings a list of exciting improvements, one of them being Authority Handover of components during a worker authority change.
Some Context on Components Authority Change
Currently, the decision to switch authority of a component from one worker to another is made within the runtime. Subsequently, workers are informed of the lost/gained authority over such component.
Because of this, it is possible for a worker to send an update for a component it no longer has authority over —in which case, the runtime simply ignores the update. Consequently it is possible to lose progress of a component if the worker loses authority before it can write the most recent state update.
Introducing Authority Handover
Authority handover is the ability of the runtime to notify workers of their upcoming loss of authority on a component, allowing them to perform any final state update.
From SpatialOS 12, workers will be sent a notification about imminent loss of authority ahead of losing it —note that due to network conditions or worker load, the worker might not receive this in time to make use of it, or never receive it at all if it crashes or is stopped. This notification allows workers to send a final component update before losing authority. During the transition period the single-writer principle is still adhered. Upon updating the component, the worker can inform the runtime of having completed the operation to shorten the handover period.
The length of the transition period —the time between when a worker is informed of imminent loss of authority over a component and the actual loss— is configurable per component type.
Another benefit of authority handover is in the case of components that currently require frequent updates —for example for timer synchronisation, short-lived timers, or large component updates. In these cases you could incur network and serialisation costs. To avoid that, authority handover allows you to send a component update only when necessary and just before losing authority.
Please refer to the authority documentation for more details.
Are there APIs for Unity and Unreal integrations?
Yes, authority handover will be available within Unity and Unreal through a new set of APIs.
Will I be able to configure the handover period (transition) duration on per component type?
Yes, the transition duration will be configurable on a per component basis.