Setting up an Unreal SDK project
To set up the Unreal SDK and run your first Unreal project, you need to:
- Set up your machine.
- Get the Unreal Engine source.
- Build the Unreal Engine.
- Build the project.
- Deploy the project, locally or in the cloud.
You don’t need to install Unreal Engine, as this guide will take you through compiling it from source.
1. Set up your machine
To develop a project that uses the Unreal SDK, you’ll need:
- A development machine that meets the required criteria for Unreal Engine 4 and SpatialOS
- Visual Studio 2015
- Windows SDK 8.1 (this is a requirement for Unreal itself)
- (Recommended) Around 100GB of space - the Unreal source alone takes up at least 50GB
spatialcommand-line tool - see the guide to setting it up
2. Get the Unreal Engine source
To use the 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.16.3-release branch. This can be done in a shell by running either:
- via HTTPS:
git clone https://github.com/EpicGames/UnrealEngine.git -b 4.16.3-release
- via SSH:
git clone firstname.lastname@example.org:EpicGames/UnrealEngine -b 4.16.3-release
- via HTTPS:
Navigate to the root of the cloned repo.
Add a user environment variable (
Control Panel > System and Security > System > Advanced system settings > Advanced > Environment variables) named
The value should be the path to the directory you cloned into above. For example,
Restart your terminal and run
echo $UNREAL_HOMEto make sure that the new environment variable is registered. This should output the path to the directory you cloned into above. For example,
3. Build the Unreal Engine
To build Unreal workers for SpatialOS deployments, you need to build targeting Linux, which requires cross-compilation of your SpatialOS project and Unreal Engine.
Note: 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.16, 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 $LINUX_MULTIARCH_ROOTto make sure that the new environment variable is registered. This should output the path to the clang v8 directory that you installed in step 1.
- Navigate to the directory you cloned the Unreal Engine source code into. For example,
In this folder, run the batch file
This will install prerequisites for building Unreal Engine 4.
While running the batch file, you should see
Checking dependencies (excluding Mac, Android).... If it says
excluding Linuxtoo, make sure that you set the environment variable LINUX_MULTIARCH_ROOT correctly, and run the batch file again.
In the same directory, run the batch file
This sets up the project files required to build Unreal Engine 4.
UE4.slnin Visual Studio 2015.
Build > Configuration Managerwindow, set your solution configuration to
Development Editorand your solution platform to
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
Automation Toolproject in the solution explorer, right-click it and click
You have now built UnrealEngine 4 to support cross-compilation for Linux.
Warning: Once you’ve built the Unreal Engine, don’t move it into another directory: that will break the integration.
4. Build the project
For starters, you’ll need a SpatialOS project. Check out the UnrealStarterProject if you don’t have one yet. Next, you need to build the project itself. To do this:
If you are not using one of our starter projects, you have to add
Build.csfile. This will set up your include paths next time you generate VS project files.
- Open a terminal, navigate to the root folder of your project and run
spatial worker codegen.
- Locate the Unreal project file for your project. This can be found in
- Right-click on your project’s
.uprojectfile and select Switch Unreal Engine version:
- Switch engine versions to the source-built version you just built.
spatial worker build. This may take an hour or more.
This will build an assembly used for both local and cloud SpatialOS deployments.
If you only want to deploy your project locally, you can run
spatial worker build --target=local. Similarly, if you only want to deploy your project to the cloud, run
spatial worker build --target=cloud.
5. Deploy the project
To run your project, deploy and run it on SpatialOS. You can run it as a local deployment, or in the cloud.
Deploying the project locally
To deploy locally:
- In a terminal,
cdto the root of your SpatialOS project.
spatial local launch default_launch.jsonto start the local deployment.
- Open your Unreal project in the Unreal Editor.
- Press the ▷ Play button to join the game as a new player.
Deploying the project to the cloud
To deploy to the cloud:
- In the project’s root directory, open
spatialos.json. Change the
namefield to your assigned SpatialOS project name.
spatial cloud upload <assembly name>to upload the assembly that was built when you built the project earlier.
<assembly name>is a label that you can choose for this assembly, for example
spatial cloud launch <assembly name> default_launch.json <deployment name> --snapshot=snapshots/default.snapshot.
<deployment name>is a label for the deployment.
Go to your console.
Click on the deployment’s name.
Launch a player client by clicking ▷ Launch.
See the rest of the documentation to learn how to: