Creating an installed (binary) Unreal Engine 4 build
Including Linux server build support
For my upcoming game Shotgo (working title) I want to be able to build and distribute dedicated servers. To do this with Unreal Engine 4, there is, unfortunately, one problem. The part of the engine that allows building for dedicated server targets is not included in the binary engine build that can be downloaded from the Epic Games launcher. A custom unreal source build is required to get access to the dedicated server targets (DebugGame Server, Development Server, and Shipping Server).
While trying to make a source build I ran into a couple of issues. The first issue being, disk space. My completed unreal source build (that is excluding the binary build which I will get to later) totalled 109GB. This is with just the Win64 and Linux targets build. Because of this, I attempted to move the source code to my HDD however as I started the build and opened task manager, I saw what I had predicted would happen. Disk usage: 100%, CPU usage: 5%. So, take my advice, go free up some space on your SSD.
Another problem I ran into was with Visual Studio 2017 and the Windows SDK. Apparently, Visual Studio 2017 no longer includes PDBCopy by default. This tool is used to create binary builds of unreal. The solution, in this case, was to download the Windows SDK from the Microsoft developers website here. You might need to uninstall the Windows SDK you downloaded with the visual studio installer first as this version did not include the PDBCopy.exe in my case. Once the correct version of the Windows SDK was installed I ran the following commands as admin in Git Bash
mkdir -p 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\AppxPackage\'
cp -p 'C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\pdbcopy.exe' 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\AppxPackage\'
ls -l 'C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\AppxPackage\PDBCopy.exe'
Posted on the unreal forums by: FrostyElkArne
With these problems solved I was able to successfully build the engine. After this, of course, comes another challenge, making a distributable build. Although it is definitely possible to send this 109GB source build to your entire team, it is not exactly practical to do so. To shrink it down a bit we will be making an "installed build" (Or just binary build as I will be calling it). This will create a standalone, read-only, precompiled engine that is a lot smaller than our complete source build. This is perfect for my goal of getting a distributable engine version that includes dedicated server support. It does, however, have the downside of being read-only which means the engine source can't be changed without making a new binary build from the original source code.
To include the server build targets, I had to create a custom Buildgraph script that includes the server targets in the installed build. I have included that script below, however, this will likely only work on version 4.20 so if you are using another engine version I recommend using a diff tool between my build script and your default build script to get an idea of what you'll need to add to make this work.
To make the binary build process slightly easier I used the UE4 Binary builder by ryan040. This tool basically just adds a GUI (see screenshot above) to the Unreal Automation Tool which is used to create installed builds. There you can select the platforms and configurations you want to build for (Win64 and Linux in my case) and you can select your custom build script (InstalledEngineBuild.xml) if needed.
So there you have it. After all this I was able to distribute the engine with a total size of 42GB (12GB when zipped) to my team to allow us to build dedicated servers for our game. Below is my InstalledEngineBuild.xml script for inspiration. If you've got any questions or tips, let me know in the comments below.
Assets 1
InstalledEngineBuild (xml)