Get SpatialOS

Sites

Menu

The Example Project

3: Launch a cloud deployment

Before launching a cloud deployment, as well as generating schema and a snapshot, you also need to:

  • Associate your game with its cloud project name.
  • Prepare the game’s server-workers and client-workers by building them
  • Upload the prepared workers to the cloud.

As you already generated schema and a snapshot for the Example project when you launched a local deployment, and haven’t changed the project since, you don’t need to do this again. If you make any changes to the project, you must generate schema and create a snapshot before launching a local or cloud deployment.

Everyone who signs up for SpatialOS automatically has free cloud deployment hosting via the free tier, so you can use free tier hosting for this Example project.

Step 1: Associate your game with a cloud project name

When you signed up for SpatialOS, your account was automatically given a SpatialOS cloud organization name and a SpatialOS cloud project name, both of which are the same generated name.

  1. Find this name by going to the Console at https://console.improbable.io. The name should look something like beta_randomword_anotherword_randomnumber. In the example below, it’s beta_yankee_hawaii_621.
    Toolbar Image: The SpatialOS Console with a project name highlighted.
  1. In File Explorer, navigate to the UnrealGDKExampleProject\Game\spatial directory and open the spatialos.json file in a text editor of your choice.
  2. In the file, replace the name field with the project name shown in the Console. This associates your SpatialOS cloud project with your Unreal game, telling SpatialOS which cloud project you are uploading your prepared workers to..

Step 2: Build your workers

Note: You must close the Unreal Editor before building your workers. If the Editor is open when you try to build your workers the command will fail.

There are two ways to build your worker assemblies (known as “building workers”):

  • Build your workers automatically using the BuildProject.bat script.
    This script automatically builds both the server-workers and client-workers required to run your game in the cloud. It then compresses your workers and saves them as .zip files to the UnrealGDKExampleProject\spatial\build\assembly\worker directory. Use this script if you want to build server-workers and client-workers at the same time.

  • Build your workers manually using the command line.
    Use the command line when you want to build your server-workers and client-workers separately, or, if you want to build different worker configurations, for example: Editor, Test, Shipping or Linux.

Troubleshooting

Step 3: Upload your workers

Before launching a cloud deployment, you must upload your sever-worker and client-worker assemblies to the cloud. To do this:

  1. Open a terminal window and navigate to \UnrealGDKExampleProject\spatial.
  2. Run the following command: spatial cloud upload <assembly_name>.

You must replace <assembly_name> with a name for your assembly (for example: exampleprojectassembly).

A valid upload command looks like this:

spatial cloud upload exampleprojectassembly

Step 4: Launch your cloud deployment

The next step is to launch a cloud deployment using the worker assemblies that you just uploaded. You can only do this through the SpatialOS command-line interface (also known as the “CLI”).

When launching a cloud deployment you must provide four parameters:

  • The snapshot file - defines the starting state of the game world
  • The assembly name - identifies which workers to use for your deployment.
  • A launch configuration file - defines the SpatialOS game world and load balancing configuration.
  • A name for your deployment - labels the deployment in the Console.
  1. In a terminal window, navigate to UnrealGDKExampleProject\spatial\ and run the following command

    spatial cloud launch --snapshot=snapshots\default.snapshot <assembly_name> one_worker_test.json <deployment_name>
    

Where:

  • default.snapshot is the snapshot file provided for this Example project.
  •  assembly_name is the name you gave the assembly in the previous step.
  • one_worker_test.json is the launch configuration file provided for this Example project.
  •  deployment_name is a name of your choice - you create this name when you run this command.

A valid launch command looks like this:

spatial cloud launch --snapshot=snapshots\default.snapshot exampleprojectassembly one_worker_test.json mydeployment

When your deployment has launched, SpatialOS automatically opens the Console in your browser.

> Next: 4: Play the game


——
2019-05-21 Page added with editorial review

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums