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


If you’re using a legacy version of the Runtime, you’ll need to upgrade in order to use 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.

How to use layers

For each component on an entity:

  • Specify which layer the component is part of. At the moment, you still do this using the ACL component.
    • If you want a particular client-worker instance to have write access to a particular component, specify that worker instance instead of a layer.

For each server-worker type:

  • In the launch configuration file, for each layer, specify a load balancing configuration - how many server-worker instances to start, and how to split the world up between them.
  • In the server-worker type’s worker configuration file, specifically in the worker attribute set field within the bridge field, specify which layer the worker type simulates. Currently, a worker type can only simulate one layer.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums