This repository is deprecated. To manage a SpatialOS game with multiple deployments, please use the deployment pool module of the SpatialOS Online Services
The SpatialOS Deployment Manager is a SpatialOS game management tool. It starts and stops game deployments - instances of your game running in SpatialOS. It’s useful for player-limited and time-limited match-based games such as battle royales where you have multiple game sessions, with a defined number of players.
The Deployment Manager is a C# SpatialOS project. You set it up and deploy it separately to setting up and deploying your game project.
Once set up and deployed, the Deployment Manager starts and stops multiple deployments of your game: Every deployment of your game which it can start and stop is a separate game instance with its own SpatialOS game world.
Note: The Deployment Manager does not manage its own deployment; you have to manually start and stop the Deployment Manager as it only starts and stops game deployments.
The Deployment Manager is one worker instance.
Conceptual organization of a Deployment Manager and a game’s deployments
There are two elements to preparing your Deployment Manager:
Inside your Deployment Manager project, there is a deploymentmanager/config.json
file containing the configuration for your Deployment Manager. Use this to configure the Deployment Manager and your game deployments.
Add an entity type to act as a Deployment State Entity to your game. The Deployment Manager then gets updates on the components in the Deployment State Entity in each of your running game deployments.
Example Deployment State Entity
- GDK for Unity: Deployment State Entity template in the FPS Starter Project.
- GDK for Unreal: Deployment State Entity template in the Example Project.
There is an example implementation of a Deployment Manager in a GDK for Unreal project and a GDK for Unity project:
-
GDK for Unity: FPS Starter Project guide on the GDK for Unity documentation website
-
GDK for Unreal: Example Project on GitHub
Clone the Deployment Manager project.
Run a script to download and build the SpatialOS dependencies. To do this, in a command line or terminal window, from the root directory of the cloned Deployment Manager project, enter:
Windows
powershell ./build-nuget-packages.ps1
Mac
./build-nuget-packages.sh
You need to generate a service account token. The service account token enables the Deployment Manager to list, start and stop deployments in your SpatialOS project.
(See SpatialOS documentation on development authentification for more details on tokens.)
To generate the token, from the root directory of the cloned Deployment Manager project, open a command line or terminal window and enter:
Windows
powershell ./generate-service-account-token.ps1 <your SpatialOS project name> <token life time in days>
Mac
./generate-service-account-token.sh <your SpatialOS project name> <token life time in days>
This automatically generates and adds a service account token to your Deployment Manager project. You do not need to make a note of the token or add it to the project manually.
Add an entity template to act as a Deployment State Entity to your game project.
(See examples in the projects in the Overview section above.)
Add a worker configuration file (spatialos.DeploymentManager.worker.json
) for the Deployment Manager worker type to your game project.
(You can copy the worker configuration file examples in the projects Overview section above.)
Go through the usual workflow to deploy your game locally or to the cloud.
See:
- the GDK for Unreal local deployment and cloud deployment workflow summaries.
- the GDK for Unity FPS Starter Project guide to Build your workers and Upload & launch your game
- the SpatialOS SDKs documentation on deploying locally and deploying to the cloud.
Update the configuration: navigate to the deployment-manager/DeploymentManager/ directory and, in a text editor, edit the config.json file as shown below:
"ClientType": “<edit this>”
is your SpatialOS development platform’s game client type, for example,”UnityClient"
or"UnrealClient"
."NumberOfDeployments": “<edit this>”
is the number of game deployments you want to launch."AssemblyName": “<edit this>”
is the name of the assembly you uploaded to the cloud in step 2. This enables the Deployment Manager to launch deployments using this assembly.
Launch your Deployment Manager locally on your computer or to the cloud. To do this, follow the steps below.
Open a command line or terminal window and enter:
Windows
powershell ./publish-windows-workers.ps1 <game launch config path> <game snapshot path>
powershell ./local-launch.ps1
Mac
./publish-macos-workers.sh <game launch config path> <game snapshot path>
./local-launch.sh
Open a command line or terminal window and enter:
Windows
powershell ./publish-linux-workers.ps1 <game launch config path> <game snapshot path>
powershell ./cloud-launch.ps1 <Deployment Manager assembly name> <Deployment Manager deployment name>
Mac
sh./publish-linux-workers.sh <game launch config path> <game snapshot path>
sh ./cloud-launch.sh <Deployment Manager assembly name> <Deployment Manager deployment name>