What layers are
You can look at layers in two ways:
- A layer is a group of components on entities in the game world.
- A layer comprises the server-worker instances that have authority over one of those groups of components.
To explore that in more detail: for the entities in the world, you split their components up into layers. A particular entity component being in a particular layer means that server-worker instances that belong to that layer can have write access to those entity components.
For example, you might say that a particular entity’s
Rotation components should be in the
Physics layer, which means that server-worker instances with the
Physics attribute are able to have write access to these entity components.
Then, for each layer, you can decide separately how to load-balance the server-worker instances responsible for simulating the layer.
For example, for a layer simulating the physics in the world, you might need quite a few server-worker instances to handle the work of that layer, but for a layer that involves managing a chat system, you might only need one server-worker instance for the whole world.
What about client-workers?
Client-worker instancess aren’t part of layers, and neither are the components they have write access to. If you want a client-worker instance to have write access to a component, you don’t specify a layer for that component, and instead specify that it’s assigned to a specific client-worker instance.