Release notes and upgrade guides

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

Using Dynamic

The improbable.worker.Dynamic class provides a way to execute arbitrary component-related logic in a
type-safe way even when the component is not known statically. Dynamic.forComponent will invoke a
custom handler for a component with a specific ID; Dynamic.forEachComponent will invoke a custom
handler for every known component. These handlers have enough information to register Dispatcher
callbacks, manipulate component updates and data, and so on.

This allows, for example, a custom View with any desired semantics to be implemented from scratch.

To do this, you would extend Dispatcher, adding data structures such as Map<EntityId, Entity> entities and
Map<EntityId, HashSet<Integer>> authority below to track the entities in the worker’s view.

You would then also need to define a class which implements the Dynamic.Handler interface, providing type-safe
behaviour in the accept(final Metaclass metaclass) method.
Dynamic allows you to implement, for example, a custom View with any desired semantics from scratch.