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.
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.
One machine will host the deployment, meaning that it's the machine where the SpatialOS runtime and local deployment runs.
- 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.
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.
To do this, make sure
UseExternalIp is set to true, and pass the host IP address as the hostname into the connection method.
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.
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.
Updated about a year ago