The Platform SDK lets you build tools, workflows and services that integrate with the SpatialOS platform.
You can use its APIs to integrate SpatialOS into your continuous integration process, create debugging tools as game engine plugins, or build matchmaking and inventory systems that utilize player identity. You can also manage deployments, snapshots, and other parts of a project locally or in the cloud.
More information on using the API locally is available in the introduction to the Local API.
We currently support the Platform SDK in C#. For more information, see the introduction to the Platform SDK: C#.
There are currently four services available:
- Deployment service
- Snapshot service
- Service account service
- Player authentication service
Authenticating your API calls
We require authentication to use the Platform SDK. It uses the same SpatialOS refresh token attached to a normal account or service account to authenticate your API calls. As a result, you must have either a SpatialOS user account or a service account to use the SDK.
The SDK is built to work together with the
spatial CLI’s built-in authentication mechanism. Alternatively, you can provide a refresh token string for the Platform SDK to use directly.
To use the
spatial CLI’s built-in authentication mechanism, run
spatial auth login. This obtains a copy of your refresh token and caches it locally. By default, the Platform SDK looks for the refresh token file stored locally (see the
spatial auth login documentation for details) and uses it to authenticate. Refresh tokens for normal user accounts expire relatively quickly; we’re currently working on a service account API which will let you set a longer expiry time.
We’ve created some example scenarios that demonstrate the benefits of incorporating the Platform SDK into your project.
An example of an automated script that would run on a regular cadence and reset the live deployment of your game.
Replicate local state to cloud
An example of a debugging tool that captures a snapshot in a local deployment and uploads it to the cloud in order to reproduce game behavior.
Service account maintenance
An example of an automated script that extends the duration of service accounts which are close to expiry.
An example of connecting a user to a SpatialOS cloud deployment.
An example of limiting the number of workers that can connect to a given deployment.
We’ll add more example scenarios in future.