Get SpatialOS

Sites

Menu
You are viewing the docs for 11.0, an old version of SpatialOS. 12.0 is the newest →

The SpatialOS Unreal integration is currently experimental. It's usable, but definitely has some sharp edges! We're very open to feedback - don't hesitate to get in touch on the forums if you have any thoughts.

Debugging and iterating

Once you’ve built your Unreal SpatialOS project, you can quickly iterate as you would on a regular Unreal project.

In a SpatialOS game, players connect and control their game using a client (UnrealClient). Your server workers run in the cloud and their lifecycle is managed by SpatialOS (UnrealWorker).

You can debug both the UnrealClient and the UnrealWorker from within the Unreal Editor. The USpatialOS class controls how you connect to a SpatialOS instance, and whether to connect as an UnrealClient or UnrealWorker.

Debugging

To choose which worker to debug:

  1. Find your default Game Mode blueprint and open it. For the RPG project this will be under Content > TopDownCPP > Blueprints > RPGDemoGameMode.
  2. This blueprint has a Worker Type field. Depending on which you want to debug, change it to either UnrealClient or UnrealWorker.
  3. Press ▷ Play.

You can now debug your blueprints as you normally would in Unreal, and your native code in Visual Studio if you have it attached.

Iterating on the UnrealClient

You can develop and iterate on the UnrealClient without having to restart your deployment.

  1. Run your deployment locally by running spatial local launch.
  2. Make any C++ code or Unreal blueprint changes.
  3. Find your default Game Mode blueprint and open it. For the RPG project this will be under Content > TopDownCPP > Blueprints > RPGDemoGameMode.
  4. This blueprint has a Worker Type field. Set it to UnrealClient.
  5. Press the Compile button in the Editor or the Blueprint Editor depending on what you changed.
  6. Press the ▷ Play button - you will join the deployment as a player using an UnrealClient.
  7. To make more changes, go back to step 2!

Iterating on the UnrealWorker

You can also develop and iterate on the UnrealWorker without having to restart the deployment, but in order to do this, you need to make sure that SpatialOS won’t spin up UnrealWorkers. This means that only the UnrealWorker you connect through the editor is running:

  1. Open default_launch.json in your project directory, and modify the num_workers field under load_balancing to 0.
  2. Run your deployment locally by running spatial local launch.
  3. Make any C++ code or Unreal blueprint changes.
  4. Find your default Game Mode blueprint and open it. For the RPG project this will be under Content > TopDownCPP > Blueprints > RPGDemoGameMode.
  5. This blueprint has a Worker Type field. Set it to UnrealWorker.
  6. Press the Compile button in the Editor or the Blueprint Editor depending on what you changed.
  7. Press the ▷ Play button - you will join the deployment as an UnrealWorker.
  8. To make more changes, go back to step 2!

When you’re happy with the UnrealWorker behaviour, change your settings back so SpatialOS will spin up its own UnrealWorkers, and rebuild:

  1. Stop your local deployment by pressing Ctrl+C in the terminal.
  2. Open default_launch.json in your project directory, and modify the num_workers field under load_balancing to its previous value.
  3. Build the worker using spatial worker build UnrealWorker --target=development, or through your Visual Studio solution.
  4. Restart the deployment with spatial local launch.

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums