[Experimental] Multiserver zoning

3: Test changes in the cloud

Step 1: Build your workers

When you build your workers, you create an assembly. They’re .zip files that contain all the files that the SpatialOS Runtime uses when your run your game in the cloud.
To do this you run a batch file, BuildWorker.bat. You can add different flags to the script but, for now, run the script twice, once with a flag for server-workers and once with a flag for cloud-workers:

To build workers:

  1. Close your Unreal Editor - if the Editor is open when you try to build workers, the command fails.
  2. Check the project’s networking is set to Spatial networking.
    GDK projects default to using Spatial networking. However, if you have reset the networking switch to native Unreal networking, you need to set it back.
    1. In a terminal window, navigate to the DefaultGame.ini configuration file (located in <ProjectRoot>\Game\Config directory).
    2. Check if the bSpatialNetworking option is present. If it is, set it to True (so: bSpatialNetworking=True), save the file and exit.
  3. Still in a terminal window, navigate to the UnrealGDKExampleProject directory.
  4. Run the BuildProject.bat command to build a server-worker using the filepath and flags below.
    The filepath you use depends on whether you have the UnrealGDK plugin set up as an engine plugin or as a project plugin. If you followed the default setup instructions which use the InstallGDK.bat script, you have it set up as an engine plugin.

    • Engine plugin filepath (default):

      UnrealEngine\Engine\Plugins\UnrealGDK\SpatialGDK\Build\Scripts\BuildWorker.bat GDKShooterServer Linux Development GDKShooter.uproject

    • Project plugin filepath:

      UnrealGDKExampleProject\Game\Plugins\UnrealGDK\SpatialGDK\Build\Scripts\BuildWorker.bat GDKShooterServer Linux Development GDKShooter.uproject

    • Now run the BuildProject.bat command to build a client-worker:

      • Engine plugin filepath (default):

        UnrealEngine\Engine\Plugins\UnrealGDK\SpatialGDK\Build\Scripts\BuildWorker.bat GDKShooter Win64 Development GDKShooter.uproject

      • Project plugin filepath:

        UnrealGDKExampleProject\Game\Plugins\UnrealGDK\SpatialGDK\Build\Scripts\BuildWorker.bat GDKShooter Win64 Development GDKShooter.uproject

Step 2: Upload your game

  1. In File Explorer, navigate to UnrealGDKExampleProject\spatial and open spatialos.json in a text editor.
  2. Change the name field to the name of your project. You can find this in the Console.
    It’ll be something like beta_nuts_double_379.
  3. In a terminal window, change directory to UnrealGDKExampleProject\spatial\ and run 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.

Step 3: 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.
  1. 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>
    where assembly_name is the name you gave the assembly in the previous step and deployment_name is 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=eu flag for lower latency.

Step 4: Play your game

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

  1. 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.
  2. 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.

Step 5: Invite your friends

  1. To invite other players to this game, head back to the Deployment Overview page in your Console, and select the Share button.
  2. 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.

Next steps:

  • If you want to create a new game using the GDK, you should get the Starter Template.
  • If you want to port your existing game to the GDK, follow the Porting guide.

2019-08-14 Page updated with editorial review: added filepaths based on auto-install or manual-install.
2019-08-02 Page updated with limited editorial review: updated project name.
2019-03-20 Page updated with limited editorial review.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums