This guide will prepare your Windows machine for local development with the SpatialOS SDK.
SpatialOS works with up-to-date versions of Windows 7 and 10.
Before following the setup guide check that your machine meets the hardware requirements.
To set up the SpatialOS CLI (spatial
):
-
Download
spatial
for Windows (64bit). By downloadingspatial
, you agree to the SpatialOS EULA. -
Put
spatial.exe
in a directory where you have administrator privileges. -
Add the directory containing
spatial.exe
to yourPATH
by following these instructions. -
Check this succeeded by running
spatial update
in your terminal. You should get the output:Current version of the 'spatial' command-line tool: <version number>
Attempting to download the latest version...
Unreal versions 4.16.3-release and 4.17.1-release have been tested with SpatialOS. Other versions may work fine, but have not been extensively tested. To use the Unreal SDK, you must build the Unreal engine from source:
- Restart your computer to complete the install process.
- If you don't have it already, install Visual Studio 2015.
- If you don't have it already, install the Windows SDK 8.1.
To use the Unreal SDK, you need to build the Unreal Engine 4 from source. To get the source and set it up to build:
-
Check if you have access to the Unreal Engine 4 GitHub repository. If you don't, follow these instructions to get access.
-
Clone the repository and checkout the 4.17.1-release branch by running either of these commands in a Git bash terminal:
- via HTTPS:
git clone https://github.com/EpicGames/UnrealEngine.git -b 4.17.1-release
- via SSH:
git clone [email protected]:EpicGames/UnrealEngine -b 4.17.1-release
- via HTTPS:
-
Navigate to the root of the cloned repo.
-
Add a system environment variable (
Control Panel > System and Security > System > Advanced system settings > Advanced > Environment variables
) namedUNREAL_HOME
. The value should be the path to the directory you cloned into above. For example,D:\Work\UnrealEngine
. -
Restart your terminal and run
echo $env:UNREAL_HOME
(PowerShell) orecho %UNREAL_HOME%
(cmd) to make sure that the new environment variable is registered. This should output the path to the directory you cloned into above. For example,D:\Work\UnrealEngine
.
To build Unreal workers for SpatialOS deployments, you need to build targeting Linux, which requires cross-compilation of your SpatialOS project and Unreal Engine.
Building Unreal Engine from source could take up to a few hours. Just so you know!
-
Follow the compiling for Linux setup guide for UnrealEngine 4.17.1, installing the Linux-x86_64 cross compile toolchain. You don't need to follow the "Packaging for Linux" section.
-
After following the Linux setup instructions, restart your terminal and run:
echo $env:LINUX_MULTIARCH_ROOT
(PowerShell)echo %LINUX_MULTIARCH_ROOT%
(cmd)echo $LINUX_MULTIARCH_ROOT
(Git Bash)
to make sure that the new environment variable is registered. This should output the path to the clang directory that you installed in the previous step.
-
Navigate to the directory you cloned the Unreal Engine source code into. For example,
D:\Work\UnrealEngine
. -
In this folder, run the batch file
Setup.bat
. This will install prerequisites for building Unreal Engine 4. -
While running the batch file, you should see
Checking dependencies (excluding Mac, Android)...
. If it saysexcluding Linux
too, make sure that you set the environment variableLINUX_MULTIARCH_ROOT
correctly, and run the batch file again. -
In the same directory, run the batch file
GenerateProjectFiles.bat
. This sets up the project files required to build Unreal Engine 4. If you encounter anerror MSB4036: The "GetReferenceNearestTargetFrameworkTask" task was not found
when building with VS2017, check that you have NuGet Package Manager installed via the Visual Studio installer. -
Open
UE4.sln
in Visual Studio 2015. -
In the
Build > Configuration Manager
window, set your solution configuration toDevelopment Editor
and your solution platform toWin64
. -
In the Solution Explorer, right-click on the UE4 target and select
Build
(you may be prompted to install some dependencies first).This builds Unreal Engine, which can take up to a couple of hours.
-
Once the build succeeds, search for the
Automation Tool
project in the solution explorer, right-click it and clickBuild
. You have now built UnrealEngine 4 for cross-compilation for Linux.
Once you've built the Unreal Engine, don't move it into another directory: that will break the integration.
If you want to run a game client to connect to a SpatialOS game running in the cloud, you must install the Launcher (SpatialOS documentation).
- Download the Launcher.
- Follow the instructions in the installation wizard.
You've now set up your machine for development with SpatialOS!