Jenkins Library for Unreal Engine 4

🔖 game-development ⏲️ 1 minute to read

⚠️ This post was last updated in 2021, meaning its contents may be outdated.

For Estranged: The Departure, I released on Steam many hundreds of times, all at the push of a button using a tool called Jenkins.

At its core, Jenkins is a job scheduling system, where a job consists of some commands to run. You can define the job in the Jenkins interface or, as I prefer, in a Jenkinsfile which lives at the root of your source control repository.

I won't explain how to get a Jenkins server and attach a Windows build machine to it as there are better resources out there to explain that:

This post outlines the general-purpose Jenkins library I developed for Estranged. The library can be found here:

Building Estranged

The README in the repository does a pretty good job of going over the options, but here is the build script for Estranged. First, we need to obtain the library, load it, and set some variables for use further down:

def builder;
dir ('Builder') {
    git(url: 'https://github.com/alanedwardes/Jenkins.UnrealEngine.Builder.git', branch: 'v1');
    builder = load('UnrealEngine.groovy');
}

String enginePath = env.UnrealEngine424;
String projectPath = env.WORKSPACE + '/Depot/Insulam.uproject';
String targetPlatform = 'Win64';

Then we can check out the game (not shown), and use the builder to build the Editor binaries:

builder.build()
    .enginePath(enginePath)
    .target('InsulamEditor')
    .clientConfig('Development')
    .targetPlatform(targetPlatform)
    .useUBTMakefiles(false)
    .allowFASTBuild(false)
    .allowHotReloadFromIDE(false)
    .project(projectPath)
    .run(this);

And then cook and package the game:

def buildResult = builder.buildCookRun()
    .enginePath(enginePath)
    .noPerforce(true)
    .verbose(true)
    .project(projectPath)
    .shouldCook(true)
    .shouldStage(true)
    .shouldArchive(true)
    .forDistribution(true)
    .shouldBuild(true)
    .shouldPackage(true)
    .skipCookingEditorContent(true)
    .targetPlatform(targetPlatform)
    .clientConfig('Shipping')
    .usePak(true)
    .noCompileEditor(true)
    .archiveDirectory(env.WORKSPACE + '/Packaged')
    .run(this);

Finally we extract the debugging symbols:

builder.extractSymbols()
    .symstore('C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64\\symstore.exe')
    .source(buildResult.deployPath)
    .destination(env.WORKSPACE + '/Symbols')
    .product('Insulam')
    .run(this);

The debugging symbols can be uploaded to a symbol server, or something like Amazon S3 (I use CloudFront + S3). The game in buildResult.deployPath can now be deployed to a storefront like Steam.

Other Features

The library also wraps the "resave packages" functionality of the Unreal Engine 4 Editor, which allows you to run lighting builds, reflection captures and all kinds of other computational tasks. The example below builds lighting for the specified maps, and updates the reflection captures:

builder.resavePackages()
    .enginePath(enginePath)
    .targetPlatform(targetPlatform)
    .project(projectPath)
    .projectOnly(true)
    .mapsOnly(true)
    .quality('Preview')
    .buildLighting(true)
    .buildReflectionCaptures(true)
    .allowCommandletRendering(true)
    .addMap('/Game/Maps/MyMap1')
    .addMap('/Game/Maps/MyMap2')
    .run(this);

This could run lighting builds at weekends for example and check them into source control.

All options can be found on the README.

🏷️ jenkins library estranged source game symbol light unreal engine steam repository windows machine step readme

⬅️ Previous post: Three Approaches to Readable Materials in First Person Games

➡️ Next post: Spotting Fake Indie Game Key Requests

🎲 Random post: Tips for Building Games with Unreal Engine 4

Comments

Please click here to load comments.