Worker SDK in Java
The Worker SDK in Java is an implementation of the Worker SDK that allows developers to build workers as part of a SpatialOS game in Java.
The SDK provides functionality to write a worker that:
- connects to a SpatialOS simulated world (see Connecting to SpatialOS)
- can subscribe to information for a part of the world (see Handling data received from SpatialOS)
- can send and receive component updates (see Sending data to SpatialOS)
The SDK also includes methods to load and save snapshots of the entire simulation from and to a file (see Manipulating snapshots).
A typical Java worker uses both the core API defined in
the improbable.worker
package, and Java generated code
based on the user-specified simulated world schema.
Using the Worker SDK in Java
The Java API closely mirrors the C# API.
The most important units of functionality in the Java API are:
- The
improbable.worker.Locator
, which is responsible for querying for and connecting to remote cloud deployments. - The
improbable.worker.Connection
, which represents a worker’s connection to a SpatialOS simulated world. - The
improbable.worker.Dispatcher
, which is responsible for invoking user-provided callbacks based on data received from SpatialOS via theimprobable.worker.Connection
. - The
improbable.worker.Entity
, which is a container for the component data associated with a single entity.