UnrealEngine linux server build


overview

  • if you want to seperate the game into client and server
    • mostly, the clients would be executed on windows
    • as the server is up to you, you can select more efficient option
      • in aws, linux server instead of windows to save cost
  • so it is needed to build linux server, but you can use cross compilation
    • this makes you can build linux server on windows
  • in this post, I suppose you have already an unreal engine built from source code and test project
    • especially, I used 4.21 version

setup

  • download the proper toolchain from this document
    • in my case, clang-6.0.1-based toolchain is needed
  • execute the toolchain installer
    • you do not have to do extra works when your engine version is equal to or over 4.14
    • if not, reference the document mentioned for the details
  • in the test project, edit the DefaultEngine.ini of [ProjectRoot]/Config/DefaultEngine.ini
    • add the code below
    • the code will add configurations for linux version build
1
2
[/Script/LinuxTargetPlatform.LinuxTargetSettings]
TargetArchitecture=X86_64UnknownLinuxGnu
  • right click uproject and select Generate Visual Studio project files
    • open sln and build the test project with Development Editor & Win64

build

  • double click uproject and you would see the test project on unreal editor
  • select Development in File/Package Project/Build Configuration
  • select Linux in File/Package Project
    • choose an arbitrary directory for saving the package
    • in my case, I created Packages folder in project directory and use it
  • after packaging, you can see the directory like this
  • open sln and build the test project with Development Server & Linux
  • you can see the [ProjectName]Server build, which will be executed on linux
  • copy the [ProjectName]Server into package binary folder
    • now you can execute [ProjectName]Server on linux

usage

  • in this post, I will show you an example with wsl
    • I recommend to make shared folder for sharing files
    • if you do not know about it, read this post
  • I used a shared folder called LinuxShare for sharing the package files
  • there are build files in package binary folder
    • [ProjectName] is build file from Game build target, which cannot be executed for absense of graphics api
    • [ProjectName]Server is build file from Server build target, which is copied by you
  • execute server build with option 127.0.0.1 -log on wsl(linux)
  • execute client build twice with option 127.0.0.1 -log -windowed resx=720 resy=480 on windows
    • you can see the same result that we saw in previous post