Get SpatialOS

Sites

Menu

Running a local deployment across multiple machines

You can connect multiple machines together to collectively run a SpatialOS world. One machine will host the SpatialOS world, and you can launch workers on other machines that connect to that deployment.

This can be especially useful when developing mobile or VR games, as you can run the SpatialOS deployment on your computer and connect the mobile or VR client. You can also use it to debug managed workers.

This guide assumes you have a working SpatialOS project which you can already deploy locally.

When you release a game commercially, you must use a cloud deployment: our EULA doesn’t allow you to release a game by running a local deployment across multiple machines.

Prerequisites

All of the machines which you want to run the deployment on must be on the same local network. Specifically, they must be able to ping each other’s IP addresses.

1. Find the IP of the host machine

One machine will host the deployment, meaning that it’s the machine where the SpatialOS runtime and local deployment runs.

  1. First, find the IP address of the machine you want to use as the host machine.

    Follow this guide to find your IP address on Windows 10, and this guide for versions of Windows below that.

    Follow this guide to find your IP address on Mac.

2. Set up the other machines

You need to configure each of your workers to connect to the host machine instead of trying to connect to a local deployment on the same machine. To do this:

You will need to undo these steps if you want to go back to the default behaviour, which connects to a local deployment on the same machine.

For workers built using the language-specific SDKs

The Connection object (C++, C# and Java) describes how the worker should connect to SpatialOS. You need to modify this to connect to the host’s IP address.

To do this, make sure UseExternalIp is set to true, and pass the host IP address as the hostname into the connection method.

3. Launch a deployment

Using the host machine’s IP address, run the following command on the host machine inside the project root directory:

spatial local launch default_launch.json --runtime_ip=<host IP address>

This starts the local deployment on the host machine.

4. Connect workers to the host machine

Now the workers are configured to connect to the host machine, you can launch workers on other machines that can connect to the deployment. These can be clients, or workers that would usually be run as managed workers. You can run the workers as normal and they will connect to the host’s local deployment.

You can run the workers directly using spatial local worker launch.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums