Building Unreal Tournament with Genvid¶
Getting the Unreal Tournament Source Code¶
The first thing you need to do is download the Unreal Tournament source code.
This code is available from GitHub but only to registered developers. To register, follow the steps here.
Our current code is based off of the following changelist:
commit 27e91ad5b439cfe698b2d1345432983ccfbc0936
Author: Peter Knepley <[email protected]>
Date: Tue May 16 16:37:14 2017 -0400
Copying
//UT/Release-Next/...
to //UT/Release-Live/...
[CL 3441773 by Peter Knepley in UT-Release-Live branch]
Once you have downloaded the source code, switch to that changelist:
git checkout 27e91ad5b439cfe698b2d1345432983ccfbc0936
Normally, a git-hook will call setup.bat
automaticaly, but we recommend
calling it manually for good measure. This script downloads and
installs all of the necessary requirements.
Note
- This version of Unreal Tournament is missing a header it needs to
- compile correctly. Add the following line to the file
UnrealWatchdog.cpp
:
#include "EngineBuildSettings.h"
Then follow the steps listed in the Unreal Tournament documentation.
The basic instructions are:
- Run
GenerateProjectFiles.bat
.- Open
UE4.sln
.
- Compile
ShaderCompileWorker
andUnrealLightmass
.
- Select UnrealTournament.
- Run Build and Debug (F5).
The build will take some time. When finished, make sure you have a working Unreal Tournament build before proceeding.
Environment preparation and patching¶
The scripts and configuration for Unreal Tournament are located under
samples/ue4/ut4
. They use an environment variable named
UTROOT
to find the Unreal Tournament installation folder. You need to
set it to your local version of Unreal Tournament.
For Windows command prompt, specify your UTROOT
variable
like this:
set UTROOT=C:\UnrealTournament
Adjust for the shell you’re using. For example, using Bash the command would instead be:
export UTROOT='C:\UnrealTournament'
The integration requires some added files and modifications to existing UE4 files to make Unreal Tournament run with Genvid. You can do this with the following script:
py ut4.py prepare
This script will:
- Copy
GenvidPlugin
toUnrealTournament/Plugins/
.- Copy the
Genvid
module toUnrealTournament/Source/
.
- Copy
GenvidConnector.h
toUnrealTournament/Source/UnrealTournament/Public/
.
- Copy
GenvidConnector.cpp
toUnrealTournament/Source/UnrealTournament/Private/
.
- Copy
BP_GenvidConnector.uasset
toUnrealTournament/Content/Genvid/
.
Details¶
This section presents the modifications required to the UnrealTournament files.
UnrealTournament.Build.cs¶
At the end of public UnrealTournament(TargetInfo Target)
, add
the following lines:
PrivateIncludePaths.Add("Genvid/Private");
PublicIncludePaths.Add("Genvid/Public");
PublicDependencyModuleNames.Add("Genvid");
These lines make all the GenvidPlugin public interfaces available to the UnrealTournament sub-project.
UTWorldSettings.h¶
You need to derive the AUTWorldSettings
class from the
AGenvidWorldSettings
, which is a specialization of AWorldSettings
.
Start by including the GenvidWorldSettings.h
header at the top of the
file:
#include "UTResetInterface.h"
#include "GenvidWorldSettings.h"
#include "UTWorldSettings.generated.h"
Then replace the parent class of AUTWorldSettings
with
AGenvidWorldSettings
:
UCLASS()
class UNREALTOURNAMENT_API AUTWorldSettings : public AGenvidWorldSettings, public IUTResetInterface
{
And you’re ready to go!
Note
Using UE4 JSON serialization routines is a suboptimal decision which we made mainly due to simplify arguments of this tutorial. We recommend you use a more compact binary representation to save as much bandwidth as possible. The cost incurred on the web browser side should be worth the effort.
BP_GenvidConnector.uasset¶
To finish the integration, select the map you want to play and open the World Settings window.
There are two settings in the Unreal Editor World Settings window you need to modify.
- Open the Genvid subsection.
- Select Enabled checkbox.
- Select BP_GenvidConnector from the Streamer
- dropdown list.
Building Unreal¶
Finally, you can build Unreal Tournament:
py ut4.py build
This will run GenerateProjectFiles over the UnrealTournament repository and start a build.