So you have moved away from using the pre-built solutions of Unreal Engine; awesome! The next logical step is creating a portable Unreal Engine rocket build of your own. Whether you are working in a large team or working on your own, a rocket build takes the technical lifting out of working with the Unreal Engine source code. It gets you, and your team right into working directly on your project. I typically do a rocket build of dotBunny’s internal version of the Unreal Engine, with the latest changes from Epic on Friday night. I just set it and forget it, and then post the build Monday morning.
- A copy of the Unreal Engine source code. We have covered this topic in a previous article.
- Properly installed and configured build tools relevant to your platform, also covered in the previous article briefly. The Unreal Engine repository also has an overview guide as well, in case you would like some extra reading.
There are some things that you can do to make this entire process easier. While optional, I’m going to treat it as required. The creation of some static batch scripts that you can simply change will save you from yourself. Typos and forgetfulness are the two most common problems that occur over time when doing stuff like this. Depending on the platform you are on, you will also need to adjust some of the presented information to be specific for the host operating system. I will try to keep it as agnostic as possible, but you do have to connect a few dots. All content demonstration content in this article is taken from a macOS deployment.
Attached to this article are the files that I use to build for macOS, I’ll see about adding a Windows version in the future.
Step 1 – Creating the rocket build script
This script is the one that is going to make your life, and future you’s life so much easier. The purpose of this script is to define some directory definitions and make the call to Unreal Automation Tool (UAT) to start the build process with the right arguments.
#!/bin/bash # Definitions EngineBuildFolder="/Users/reapazor/Workspaces/dotBunny/Dethol/Engine/Engine/Build/BatchFiles/" BuildDefinition="/Users/reapazor/Workspaces/dotBunny/Dethol/Scripts/Engine/Config/InstalledEngineBuild.xml" OutputFolder="/Users/reapazor/Workspaces/dotBunny/Dethol/Game/Engine/" # Make local to script directory for some reason cd "$(dirname "$0")" clear # Change to UE folder cd "$EngineBuildFolder" # Build IT! ./RunUAT.sh BuildGraph -target="Make Installed Build Mac" -script="$BuildDefinition" -set:BuiltDirectory="$OutputFolder" -set:WithMac=true -set:WithWin64=true -set:WithAndroid=false -set:WithIOS=false -set:WithTVOS=false -set:WithLinux=true -set:WithHTML5=false -set:WithSwitch=false -set:WithDDC=false -clean # Run Unreal (First Run Takes A While) cd "$OutputFolder" cd "LocalBuilds/Engine/Mac/Engine/Binaries/Mac/" open ./UE4Editor/Contents/MacOS/UE4Editor
Something to note is that I’ve added a “BuiltDirectory” definition to the UAT arguments which don’t typically exist in the normal Unreal Engine build chain. This slight difference allows the changing of the rocket build output directory. However, it requires a custom build script to be referenced by the initializing command.
If you are on macOS, you can simply copy and paste this into a script file and alter its paths as needed. If you are on Windows, you will need to rehash the script into a Windows-compatible batch file. Unless you are using the new PowerShell with bash support!
Step 2 – Custom build script, sort of.
In the attached package, there are two specific XML files. One of them (InstalledEngineBuild.xml) adds a slight definition change to the Unreal Engine build process, and the other (InstalledEngineFilters.xml) is just required when you use a custom build definition. The InstalledEngineBuild.xml is the stock one that comes with the Unreal Engine, with a change to define how the BuiltDirectory argument is used when packaging up the completed build.
<Option Name="BuiltDirectory" DefaultValue="$(RootDir)/LocalBuilds/Engine/" Description="Directory for outputting the built engine"/>
<!-- The local output directory --> <Property Name="LocalInstalledDir" Value="$(BuiltDirectory)/LocalBuilds/Engine/Windows"/> <Property Name="LocalInstalledDirMac" Value="$(BuiltDirectory)/LocalBuilds/Engine/Mac"/> <Property Name="LocalInstalledDirLinux" Value="$(BuiltDirectory)/LocalBuilds/Engine/Linux"/>
The above snippet from the file outlines the changes that I have made to the stock file, and you will most likely need to make similar changes to address your paths.
Step 3 – Make it so!
Depending on your platform you are going to want to run the build script. I often create a .command file alongside the .sh file and have it execute the .sh file. The command files are launched via the macOS finder quite easily, without a shell. If you are on Windows, a similar system is in place for you via the Windows’ Explorer. You can double-click your created .bat file, and it will start the process.
Simply put, batch scripting processes is awesome. It saves time (and money) when it comes to remembering argument structures and the proper paths to use.