Interest and authority
Central to SpatialOS is the idea that your server-worker has access only to a part of the game world.
This view is governed by two things: what the server-worker has authority over, and what it has interest in.
Every component on every entity in the world needs to be simulated. That is, it has computation associated with it, and something needs to carry out that computation.
For example, if there’s an NPC with a Position component, you probably want something to move that NPC around in the world.
But you don’t want more than one server-worker at a time to be able to write to a component. So SpatialOS uses the concept of authority: for any component of any entity, there is at most one server-worker authoritative over it.
Authority is a responsibility: the responsibility to carry out the computation required for a component. That responsibility can be handed over: if an entity moves from one server-worker’s region of authority to another, authority over its components is handed over to the new server-worker.
How are those regions of authority defined? You decide those when you decide on your load balancing. The “load” in load balancing is the computation associated with the components your server-worker has authority over.
But to carry out the computation associated with a component, it’s not enough to have authority to write to that component.
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. It doesn’t matter if the lettuce or the fox belongs to another server-worker: the rabbit still needs to behave correctly.
To deal with this, a server-worker has interest. Interest is an expression of the things a server-worker wants to know about, even if it doesn’t have authority over them.
For example, a server-worker might be interested in every object within a 100m radius of the entities it has authority over. A client-worker might be interested in objects nearby, but also really big objects far away - it is interested in mountains, because it needs to render them to the player.