Multiserver Shooter tutorial
Step 4: Test your changes in the cloud
Build your assemblies
An assembly is what’s created when you run
BuildWorker.bat. They’re .zip files that contain all the files that your game uses when running in the cloud.
- In a terminal window, change directory to the root directory of the Third-Person Shooter repository.
- Build a server-worker assembly by running:
Game\Plugins\UnrealGDK\SpatialGDK\Build\Scripts\BuildWorker.bat ThirdPersonShooterServer Linux Development ThirdPersonShooter.uproject
- Build a client-worker assembly by running:
Game\Plugins\UnrealGDK\SpatialGDK\Build\Scripts\BuildWorker.bat ThirdPersonShooter Win64 Development ThirdPersonShooter.uproject
Upload your game
- In File Explorer, navigate to
spatialos.jsonin a text editor.
- Change the
namefield to the name of your project. You can find this in the Console. It’ll be something like
In a terminal window, change directory to
spatial cloud upload <assembly_name>, where
<assembly_name>is a name of your choice (for example
myassembly). A valid upload command looks like this:
spatial cloud upload myassembly
Note: Depending on your network speed it may take a little while (1-10 minutes) to upload your assembly.
Launch a cloud deployment
The next step is to launch a cloud deployment using the assembly that you just uploaded. This can only be done through the SpatialOS command-line interface (also known as the SpatialOS CLI.
When launching a cloud deployment you must provide three parameters:
- the assembly name, which identifies the worker assemblies to use.
- a launch configuration, which declares the world and load balancing configuration.
- a name for your deployment, which is used to label the deployment in the Console.
In a terminal window, in the same directory you used to upload your game, run:
spatial cloud launch --snapshot=snapshots/default.snapshot <assembly_name> two_worker_test.json <deployment_name>
assembly_nameis the name you gave the assembly in the previous step and
deployment_nameis a name of your choice. A valid launch command would look like this:
spatial cloud launch --snapshot=snapshots/default.snapshot myassembly two_worker_test.json mydeployment
Note: This command defaults to deploying to clusters located in the US. If you’re in Europe, add the
--cluster_region=euflag for lower latency.
Play your game
When your deployment has launched, SpatialOS automatically opens the Console in your browser.
- In the Console, Select the Launch button on the left of the page, and then click the Launch button that appears in the centre of the page. The SpatialOS Launcher, which was installed along with SpatialOS, downloads the game client for this deployment and runs it on your local machine.
- Once the client has launched, enter the game and fire a few celebratory shots - you are now playing in your first SpatialOS cloud deployment!
TIP: Check out the cloud deployment workflow page for a reference diagram of this workflow.
Invite your friends
- To invite other players to this game, head back to the Deployment Overview page in your Console, and select the Share button.
- Share the generated link with your friends!
When you’re done shooting your friends, you can click the Stop button in the Console to stop your deployment.
We hope you’ve enjoyed this tutorial. If you want to build a new game using the SpatialOS GDK, you should build it on top of the SpatialOS GDK Starter template. If you want to port your existing game to SpatialOS, follow the porting guide.
2019-03-20 Page updated with limited editorial review