Building an Installed version of UE4

Why an Installed Build?

Recently I’ve come across the need to start using the source version of UE4 again. The last time I used it was for some contract work earlier last year. It worked well but it had some fundamental issues that prevented me from using it on my main project up until now:

  1. More difficult than a one-click install for non-technical folk to use
  2. A lot more of a pain to update
  3. Distribution to the rest of the team as its no longer “done for us”

This time around I wanted to actually address these issues and I guess this gave me an excuse to dive into the build system of UE4. The solution to my problem was creating an installed version of the engine (although, funnily enough after writing this article we’ve switched production pipelines but that is a story for another day).

When I refer to an Installed Build what I mean is a binary build, a build that is ready for distribution. An example of this is the one you download from the Unreal Engine Launcher.

Before we dive into this there are a couple of things to note.

First up, unfortunately if you are on UE version 4.12 or earlier this write up won’t be of any help to you, as the Build Graph system was only published in 4.13. But fear not, Kalmalyzer has your back with his UE4 Rocket Build Tutorial.

Secondly, before jumping into this article I’d highly suggest you take a read of my other article How To: BuildGraph. As that article, will give you some deeper insight into what the hell this all means.

Building the Installed Build

Assuming you have read my previous article or know what you’re doing then you should have the source version of Unreal set up and ready to go.

To build an Installed Build all we simply need to do is call UAT with the BuildGraph command, set our target to be our platform, and then give it the path to the Installed Engine Build script.

"[EnginePath]/Engine/Engine/Build/BatchFiles/RunUAT.bat" BuildGraph -target="Make Installed Build Win64" -script="[EnginePath]/Engine/Build/InstalledEngineBuild.xml" -clean

The -clean value is optional and will result in a full rebuild as opposed to continuing from where it left off. If you are planning on doing iterative builds then you can remove it, however, if you are wanting to ensure everything compiles then I’d recommend keeping it.

If Windows is not your desired platform for the editor it also supports both Mac and Linux via Make Installed Build Mac and Make Installed Build Linux respectively.

By default, the call above will include the following target platforms; Win64, Win32, Mac, Linux Android, IOS, TVOS and HTML5. Each of these add to the build time so if you are wanting to reduce your build times you can set the host platform only option -set:HostPlatformOnly=true which, as its name suggests will only compile for your current pc’s platform.

An additional optimization you can make is by disabling Derived-Data Cache generation which, if left on, can add quite some time to your build (I also wouldn’t recommend this as well if you are planning on sharing this build over the internet especially if via source control).

After running the script your build should appear in your root engine folder under LocalBuilds/[EditorTarget]. At the time of writing this I could not use the built-in commands to change the output directory. Instead I had to resort to adding an option that allows you to do so; you can check that out down below.

Extending the Build Script

Adding Dedicated Server Target support

Typically, something you can only do in the source version, adding dedicated server support to your installed version in reality is really easy. All we need to do is make some small adjustments to our InstalledEngineBuild.xml file (Found in [EnginePath]/Engine/Build/InstalledEngineBuild.xml)

The first change is to add the target to the compilation list. The following code is placed under the UE4Game Target section which is you will find in the Target Platfoms Win64 agent.

<!-- UE4 Server Target Compile Tasks -->
<Compile Target="UE4Server" Platform="Win64" Configuration="Development" Tag="#UE4Game Win64" Arguments="-precompile -nodebuginfo"/>
<Compile Target="UE4Server" Platform="Win64" Configuration="Shipping" Tag="#UE4Game Win64" Arguments="-precompile -nodebuginfo"/>

This section is just like the UE4Game target adds the UE4Server target to our build for both development and shipping build configurations. The files are tagged as the tagged files are used later down the line for further use.

Lastly, we want to add the follow line of code to just under the corresponding UE4Game code in the same agent as above (should only be a few lines down).

<!-- Ouput directory for the build -->
<Tag Files="Engine/Intermediate/Build/Win64/UE4Server/Inc/...;Engine/Plugins/.../Intermediate/Build/Win64/UE4Server/Inc/..." With="#UE4Game Win64 Includes"/>

That’s it! After compiling the engine, you should now have the ability to compile a dedicated server target for your game in editor and in visual studio with your installed engine. How great is that?!

The logic we have done here should in fact also apply for both Linux and Mac as well, as long as you follow the same procedure and change the respective targets, platforms etc.

Changing the output directory

As I eluded too earlier I had issues using the built-in method of outputting the compiled engine to a desired directory. What I’m going to show you now is a super easy way to add the ability to do this. We just need to do two simple things;

First of all we create ourselves an option:

<!-- Ouput directory for the build -->
<Option Name="BuiltDirectory" DefaultValue="$(RootDir)/LocalBuilds/Engine/" Description="Directory for outputting the built engine"/>

Then we change the following bit of code from:

<!-- The local output directory -->
<Property Name="LocalInstalledDir" Value="$(RootDir)/LocalBuilds/Engine/Windows"/>
<Property Name="LocalInstalledDirMac" Value="$(RootDir)/LocalBuilds/Engine/Mac"/>
<Property Name="LocalInstalledDirLinux" Value="$(RootDir)/LocalBuilds/Engine/Linux"/>


<!-- The local output directory -->
<Property Name="LocalInstalledDir" Value="$(BuiltDirectory)/Windows"/>
<Property Name="LocalInstalledDirMac" Value="$(BuiltDirectory)/Mac"/>
<Property Name="LocalInstalledDirLinux" Value="$(BuiltDirectory)/Linux"/>

Now all we need to do is add -set:BuiltDirectory="C:/MyCompiledEngine/" to the BuildGraph call.

The resulting call should look something like this:

"[EnginePath]/Engine/Engine/Build/BatchFiles/RunUAT.bat" BuildGraph -target="Make Installed Build Win64" -script="[EnginePath]/Engine/Build/InstalledEngineBuild.xml" -clean -set:BuiltDirectory="C:/MyCompiledEngine/"

Voila your built engine should appear in the specified folder after it’s finished compiling.

Now you should have everything you need to build your own binary version of the engine. I would highly recommend reading through the entirety of the InstalledEngineBuild.xml to see some more advanced BuildGraph features in action. Additionally, be sure to check out my previous post How To: BuildGraph so you can learn how to add functionality for yourself.

That’s everything for this post, you can find a copy of the full modified InstalledEngineBuild.xml file down below as well as links to all the posts/articles that helped me along the way. If you any questions, feel free to leave a comment or shoot me a tweet @jack_knobel.

Useful Links



updated_at 06-02-2017