5. Authority and interest
In Unreal’s single-server architecture, authority over an Actor stays with the single server; an Actor’s properties never leave the server’s memory. When you use multiple server-worker instances in your SpatialOS game world, each instance has access only to a part of the game world. This access is governed both by what the worker instance has authority over and what it has interest in.
Every Actor needs a worker instance to compute it. If your game has only one server-worker instance (which is the default for the GDK), this instance has authority over all the Actors. But if you’re using multiple server-worker instances, you must have only one worker instance at a time that is able to write to an Actor. So SpatialOS makes sure that for any Actor, there is never more than one server-worker instance which has authority over it (that is, is able to send updates about it).
Authority is a responsibility: the responsibility to carry out the computation required for an Actor. This is the case for both client-worker and server-worker instances, however, it’s only server-worker instances that can share the game world between them, with multiple areas of authority. When an Actor moves from one server-worker instance’s area of authority to another, authority over the Actor is handed over. This allows the second server-worker instance to continue where the first one left off. Client-worker instances are often refferred to as clients.
To carry out the computation associated with an Actor, a server-worker instance needs more than just authority over the Actor. It also needs to know about other Actors that it doesn’t have authority over, but that are relevant to the Actors that it does have authority over.
For example, with your NPC moving around the world, it might need to behave differently depending on what’s nearby. A rabbit might run towards a nearby lettuce, or away from a nearby fox. Even if the lettuce or the fox are in a different area of authority to the rabbit, the rabbit still needs to behave correctly.
To deal with this, a server-worker instance has interest. That is, it wants to receive updates about Actors, even if it doesn’t have authority over them. For example, a server-worker instance might have interest in every object within a 100m radius of the Actors it has authority over.
Note that interest doesn’t only apply to server-workers: a client-worker instance might have interest in objects nearby, but also really big objects far away. It has interest in distant mountains, because it needs to render them so the player can see them as they play the game.
Authority is write access: a worker instance does the computation relevant to an Actor and sends updates about that Actor to the SpatialOS entity database. This allows other worker instances to know about the changes to the Actor.
Interest is read access: a worker instance receives updates about Actors from the SpatialOS entity database.