Unreal Engine
Unreal Engine has first-class support for dedicated server builds. The engine separates client, server, and editor code paths at the target level, which means you can produce a server binary that excludes rendering, audio, and other client systems entirely.
Build Targets
Section titled “Build Targets”Unreal projects support multiple build targets:
- Editor - Full engine with editor tools. Never ship this.
- Client - The game client players run.
- Server - The dedicated server. No rendering, no audio, no input.
- Game - A combined client+server target. Avoid using this for production servers.
To create a dedicated server target, add a [YourProject]Server.Target.cs file alongside your existing target files. This tells Unreal Build Tool to produce a server-specific binary.
public class YourProjectServerTarget : TargetRules{ public YourProjectServerTarget(TargetInfo Target) : base(Target) { Type = TargetType.Server; DefaultBuildSettings = BuildSettingsVersion.Latest; // UE5+; for UE4, use BuildSettingsVersion.V2 // Add your modules here }}Headless Mode Flags
Section titled “Headless Mode Flags”When running an Unreal dedicated server, these flags are commonly used:
| Flag | Purpose |
|---|---|
-server | Launch as a dedicated server |
-log | Enable log output to console |
-nosound | Disable audio subsystem |
-nullrhi | Disable rendering (no GPU required) |
-unattended | Suppress dialog boxes (important for headless environments) |
-port=N | Set the game port |
A typical launch command:
./YourProjectServer -server -log -nosound -nullrhi -unattended -port=7777Packaging a Shipping Server Build
Section titled “Packaging a Shipping Server Build”When packaging for production:
- Set the build configuration to Shipping (not Development or Debug)
- Use the Server target, not the Game target
- Enable pak file packaging to bundle assets
- Disable Include Debug Files for production builds
In the Editor: Platforms > [Your Platform] > Package Project, but select the Server target. Alternatively, use the command line:
RunUAT BuildCookRun -project=YourProject.uproject -serverconfig=Shipping -server -noclient -cook -stage -pak -archiveCommon Pitfalls
Section titled “Common Pitfalls”Blueprint-heavy projects: If your game logic lives primarily in Blueprints, those assets still need to ship with the server. You cannot strip them. Plan your asset organization so server-relevant Blueprints are in clearly separated directories from client-only UI or visual Blueprints.
Plugin dependencies: Some plugins assume a rendering context exists. If a plugin crashes on the server because it tries to access RHI or Slate, you need to either wrap those calls in #if !UE_SERVER guards or find a server-compatible alternative.
World Composition / World Partition: Large open-world setups with streaming can behave differently on the server. Test your server build with your full world loaded to catch streaming-related issues early.
Dedicated Server App ID on Steam: If distributing via Steam, you need a separate App ID for the dedicated server tool. This is free to set up through Steamworks.