Sites

Menu
These are the docs for 13.7, an old version of SpatialOS. The docs for this version are frozen: we do not correct, update or republish them. 14.1 is the newest →

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 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 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 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.

Layer load balancing

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.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums