Layers
Layers are a concept that organises both the components in your game world, and the workers that simulate the world.
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 write access 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 authority over those entity components.
For example, you might say that a particular entity’s Position
and Rotation
components should be in the Physics
layer, which means that server-worker instances with the Physics
attribute are able to have write access authority over 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 instances aren’t part of layers, and neither are the components they have write access authority over. If you want a client-worker instance to have write access authority over a component, you don’t specify a layer for that component, and instead specify that it’s assigned to a specific client-worker instance.