How to make a standalone UE4 build that is capable of building dedicated servers.
- Clone UE4 from GitHub (if it shows 404 go to your ‘Personal’ settings](Epic Games) and set your GitHub username)
Its highly recommended to place near the root of the drive, or in its subfolder (eg. D:\B), as UBT+clang combo is sensitive to path length.
2.[Linux support] Download Clang for your version of the engine
https://wiki.unrealengine.com/Compil…_the_toolchain
3.[Linux support] Place Clang somewhere near to root and set required environmental variables.
LINUX_MULTIARCH_ROOT %PATH_TO_CLANG% (e.g. C:\clang\v9_clang-4.0.0-centos7)
LINUX_ROOT %PATH_TO_CLANG%\x86_64-unknown-linux-gnu
UE4_LINUX_USE_LIBCXX 1
- To make your engine compatible with official distrubution: open file Build.version from ‘\Engine\Build’ and set Changelist to be the same number as CompatibleChangelist, or copy this file from the official distribution of the engine. Add empty ‘BuildId’ string. Example of Build.version: Build.version.txt
Open Version.h, located in ‘Engine\Source\Runtime\Launch\Resources’ and set the same values as in build.version. Example of Version.h Version.h - Generate project and build it once in Development Win64 configuration. (Mainly to get Unreal Build Tools, etc)
You can skip this step and copy .net tools from existing engine build if you have one. - Place InstalledEngineBuild.xml in “Engine\Build” folder.
InstalledEngineBuild.xml.txt
rename to (InstalledEngineBuild.xml) - Make standalone build of the engine using this tool (thanks ryanjon2040)
https://forums.unrealengine.com/deve…-for-your-team
Example config: Win64+Linux+Enable Symbol Store - Wait until build is complete
- [Linux support] Run commands from engine’s root (from the one you got from git)
robocopy ./Engine ./LocalBuilds/Engine/Windows/Engine *.a /S
robocopy ./Engine/Source/ThirdParty/Linux ./LocalBuilds/Engine/Windows/Engine/Source/ThirdParty/Linux *.* /S
It will collect all Linux binaries, and libcxx, that are required by Clang to Archcopy folder while maintaining folder hierarchy.
*TODO: move this and below steps to InstalledEngineBuild.xml
10. …
11.Profit!
Distributing and installing the resulting standalone engine in system.
Copy clang (v10_clang-5.0.0-centos7 for 4.18) to engine root and rename folder to Clang.
Keep in mind that this built should be placed near the root of the drive, or in its subfolder (eg. D:\B), as UBT+clang combo is sensitive to path length.
Create .bat file, containing this script:
set EnginePath=%~dp0
set EnginePath=%EnginePath:~0,-1%
net session >nul 2>&1
if %ERRORLEVEL% equ 0 (
echo User has enough privileges. Installing...
reg add "HKEY_CURRENT_USER\SOFTWARE\Epic Games\Unreal Engine\Builds" /v "4.18-Custom" /t REG_SZ /d "%EnginePath%" /f
echo Adding environmental variables...
echo LINUX_MULTIARCH_ROOT
setx /m LINUX_MULTIARCH_ROOT "%EnginePath%\Clang"
echo LINUX_ROOT
setx /m LINUX_ROOT "%EnginePath%\Clang\x86_64-unknown-linux-gnu"
echo UE4_LINUX_USE_LIBCXX
setx /m UE4_LINUX_USE_LIBCXX "1"
echo Engine successfully installed.
) else (
echo Please run this script under admin rights.
)
Pause
Now if you set engine to 4.18-Custom in .uproject file it will open up your engine.
How properly bind OnlineSubsystemSteam to your Linux Dedicated Server.
This post assumes that you already configured steam, and tried it on windows server.
If not, read this article
https://docs.unrealengine.com/latest…/Online/Steam/
Okay. After building a project server it will work, you can connect to server with OnlineSubsystemNull. But OnlineSubsystemSteam will fail, because it requires some changes to the source.
To fix this problem, copy OnlineSubsystemSteam from engine folder to your project and add server check to "static void DeleteSteamAppIdFromDisk() in OnlineSubsystemSteam.cpp.
#if UE_SERVER
const FString SteamAppIdFilename = GetSteamAppIdFilename();
// Turn off sandbox temporarily to make sure file is where it's always expected
FScopeSandboxContext ScopedSandbox(false);
if (FPaths::FileExists(*SteamAppIdFilename))
{
bool bSuccessfullyDeleted = IFileManager::Get().Delete(*SteamAppIdFilename);
}
#endif // UE_SERVER
Build of dedicated server in release mode relies on code changes in ConfigureSteamInitDevOptions
// Always check against the Steam client when shipping
RequireRelaunch = true;
// Enter shipping app id here
RelaunchAppId = *you steam_appid here*;
Also you should copy steamclient.so from steamcmd to your server’s binaries location.
To get instructions for steamcmd visit SteamCMD - Valve Developer Community
You could obtain 64-bit steamclient.so after launching steamcmd.sh on Linux machine.
After those manipulations you most likely would be able to run your LinuxServer with steam just fine.
How to package your game from Windows Batch file.
Change the script below for your needs
set UE4=*Path to UE4*
set GameClient="Path to .uproject"
set GameOutput="Output path"
set ConfigClient="Shipping / Development"
set PlatformClient="Win32 / Win64 / Linux / ..."
set Maps="Map1+Map2+Map3"
cls
echo UE4: %UE4%
echo Project: %GameClient%
echo Output: %GameOutput%
echo Client Build in progress!
%UE4%\Engine\Binaries\DotNET\AutomationTool.exe -ScriptsForProject=%GameClient% BuildCookRun -project=%GameClient% -noP4 -clientconfig=%ConfigClient% -serverconfig=%ConfigClient% -nocompile -nocompileeditor -installed -ue4exe=UE4Editor-Cmd.exe -utf8output -platform=%PlatformClient% -build -cook -map=%Maps% -encryptinifiles -pak -createreleaseversion= -manifests -compressed -stage -package -cmdline=" -Messaging" -addcmdline="-SessionId=360EAEA94B14AF6FC8BE7085199EE977 -SessionOwner='BatchBuild' -SessionName='ClientShipping'" -archive -archivedirectory=%GameOutput% >ClientBuild.log