Expires in 9 months
28 August 2022
This document covers the bare basics on how to get your Unreal Engine 4 game project able to build both Windows and Linux dedicated server builds, using just a Windows machine for compiling.
- For 4.9.X or older, you need Visual Studio Community Edition 2013
- For 4.10 or newer, you need Visual Studio Community Edition 2015
Unreal Engine 4 compiled from source codes
This Tutorial is how I did the Epic's Documentation.
The project must be C++ code.
- If your project is a Blueprint Only project, follow this tutorial to wrap it in C++. You won't even need to code anything.
Linux Toolchain For Windows installed for Linux x86 Support
This link will take you to my beginner's manual. Also, the UE4 Wiki documentation is available.
Adding dedicated server support
Note: The Project word in any file name or code reference will refer to your project's title. For example, my project for this tutorial is named GenShooter, so in my case Project.Target.cs refers to GenShooter.Target.cs. In my case, ProjectTarget is GenShooterTarget.
1. Navigate to your Project's Source folder. You should now see some.Target.cs documents.
2. Make a copy of Project.Target.cs file and rename it ProjectServer.Target.cs, be sure not to grab ProjectEditor.Target.cs.
3. Open up ProjectServer.Target.cs in your favorite text editor. Visual Studio is what I will be using here. 4. Rename all instances ProjectTarget instances to ProjectServerTarget. 5. GAMING Change Type = TargetType.Game; to Type = TargetType.Server;. 6. Save this file. Your ProjectServer.Target.cs file should look something like this now:
Building your Dedicated Server
1. Right-click your project's .uproject file in your project's folder and "Generate Visual Studio project files".
2. Now, we need to create our project in Visual Studio using the Development Server configuration for Windows and Linux. To do this, you need to build your game project in Visual Studio with the Development Server configuration.
Your output should look exactly like this when the Windows server has finished building.
Here is the build output for the Linux server.
Now your project supports building for dedicated servers, for all platforms, including Linux. Whether Linux will compile depends on how your Linux x86 Cross-Compile Toolchain was set up correctly.
Packaging Your DedicatedServer
1. Open up your project using the UE4 Editor. 2. Window -> Project Launcher will open the Project Launcher.
This should greet your door with a window that looks something like this.
This window allows for the launch of various configurations for project deployment.
1. A custom build profile is required to build your project on dedicated server form. Click the button "Add a custom launch profile" in the bottom panel. It looks like a plus symbol. This will bring up the custom profile editing screen.
1. Select your Project in the Project dropdown. If you don't find it, click browse to send it your.uproject file.
1. Change Cook mode to By the Book or On the fly. Select the WindowsServer platform under Cooked Platforms. If you have Linux x86 Cross-Compile Toolchain installed on your computer, select the LinuxServer option. If your project is not English-centric, you can also select en under Cooked Cultures or your base language. Click here to see these settings.
1. Change the package mode from Do not pack to Package and store locally. By default, all settings are left blank.
1. Change the Deploy mode to Not deploy
1. To return to the main Project Launcher Window, click "Back" in the top right corner. 2. Click the button "Launch This Profile" next to your brand new profile. This button looks similar to the Play button in your level editor window.
1. This will begin the process of cooking and packaging your dedicated servers for your selected platforms. This process will take some time. When it is done, it should look like this.
Locating your Dedicated Server Builds
After you have packaged your dedicated servers builds, you will find them in the SavedStagedBuild directory. If you've packaged your regular games builds, they will also be listed here as WindowsNoEditor. You are free to copy these builds to your target machines and distribute them as you like.
Note about the Windows Dedicated Server
When you load Windows Dedicated Server, it will appear that nothing is loading up and that there is no UI/command prompt. Your Windows Task Manager will show you that your server is running, but it is not visible. You can see the log output for your Windows Dedicated Server if you run it with -log. This is the easiest way to do it:
1. Hold Shift, Right-click the folder that Windows Dedicated Server is found in, and select "Open command Window here."
1. Enter ProjectServer.exe.log, and hit Enter. In my case, it is GenShooterServer.exe.log 2.