Get SpatialOS

Sites

Menu
These are the docs for 13.5, an old version of SpatialOS. 13.6 is the newest →

Worker attribute sets and worker requirement sets

The documentation on layers and on the EntityAclcomponent should help you to understand this page.

Overview and terminology

Worker attribute set

The worker_attribute_set field of the bridge configuration of the worker configuration file describes which layer this worker type belongs to.

The layer that a worker type belongs to controls the entity components that worker instances of this type can simulate.

Each worker type must have one worker attribute set containing one attribute, for example physics.

Worker requirement set

A worker requirement set specifies what a worker type needs to fulfil in order to read from or write to (simulate) certain entity components.

You specify a worker requirement set in two places in the EntityAcl component of each entity, to control read and write access to its entity components.

Specifying a worker requirement set

You specify worker requirement sets in two places in the EntityAcl component of each entity:

  • In the read_acl field, you specify a worker requirement set for the entity as a whole. SpatialOS uses this requirement set to grant appropriate worker instances read access to components on the entity.
  • In the component_write_acl field, you specify a worker requirement set for each component on the entity. SpatialOS uses this requirement set to grant an appropriate worker instance write access to the component. It does this by checking if any of the worker instances it knows about has a worker attribute set that satisfies the requirement set associated with the component.

Specifying a worker attribute set

Concretely, the worker_attribute_set field contains a single string element which defines the layer that the worker type belongs to (in other words, what it should simulate).

For example, a UnityWorker may have the following attribute set:

"worker_attribute_set": {
    "attributes": ["physics"]
}

With this worker_attribute_set setting, the worker type indicates that worker instances of this type can perform “physics” work. This means they can have write access to (in other words, can simulate) components that specify “physics” as their worker requirement set (see Specifying a worker requirement set above).

Worker ID

In addition to the attributes specified in your worker configuration file, each running worker instance has a unique attribute associated with it, assigned by SpatialOS when the worker instance connects. This allows users to specify write access over entity components with a requirement set that only a specific worker instance can match.

In C++, C#, and Java, the only way to obtain the worker instance’s unique attribute is by reading the worker attributes associated with a command request sent from that worker. Refer to the language-specific API documentation for more details.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums