Worker attribute sets and worker requirement sets

GDK for Unreal

If you're using the GDK for Unreal, this page does not apply to you.

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 section 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 authority over 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 permission 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 permission 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 authority over (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 ID associated with it, assigned by SpatialOS when the worker instance connects. You can use this to specify write access authority over entity components with a requirement set that only a specific worker instance can match. For more information, see the EntityAcl documentation (in particular Control which worker instance computes a particular component).

In C++, C#, and Java, the worker instance's unique ID (and its prefix workerId:) is in every command request sent from that worker instance. To obtain it, read a command request. Refer to the language-specific API documentation for more details (C++/C#/Java).

Updated 8 months ago


Worker attribute sets and worker requirement sets


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.