How to add game servers to Unreal Engine Multiplayer

How to add game servers to Unreal Engine Multiplaye
How to add game servers to Unreal Engine Multiplaye
How to add game servers to Unreal Engine Multiplaye

关键洞察

关键洞察

关键洞察

Add game servers to Unreal by building the engine from source and creating dedicated server targets. Since Unreal Engine doesn't offer a built-in game server solution, you'll need external hosting services like Edgegap for game server hosting and their deployments. Alternatively, Unreal Engine offers peer-to-peer networking solution.

Faster Alternative: Edgegap's Unreal Engine Plugin for Game Server Hosting

Use Edgegap's plugin for Unreal game servers as a simpler approach. The plugin allows you to add multiplayer functionality and make any Unreal game playable for free. Installation takes minutes through the marketplace.

The plugin automatically handles containerization and deployment across Edgegap's 615 global locations. It reduces latency by 58% while scaling to 14M CCU in 60 minutes. Built-in DDoS protection and anti-cheat features eliminate security concerns.

This allows game developers to focus on game development instead of server infrastructure management.

The step-by-step guide is the following:

  1. Install the Plugin: Download and install the Edgegap plugin into your Unreal project. FAB Store

  2. Set Up Requirements: Ensure you have Docker installed, built Unreal from Source and Unreal's Linux cross-compilation toolchain configured. Docs

  3. Build and Push: Within the Unreal Editor, use the plugin to build your project for Linux, containerize it, and push it to Edgegap's platform. Docs

  4. Deploy the Server: Once uploaded, you can deploy your game server globally across Edgegap's network of over 615 locations.

This method allows for rapid deployment and scalability without the need to manage infrastructure manually. For a comprehensive guide, visit Edgegap's integration tutorial.

Manually Adding Game Servers to Unreal Engine

Step 1: Build Unreal from Source

Create a GitHub account, connect it to Unreal, link it, and download Unreal Engine source code from GitHub. Building from source is required for dedicated server functionality. Epic doesn't include server builds in the standard launcher version.

Clone the repository and run Setup.bat to install dependencies. Generate project files using GenerateProjectFiles.bat. Build the engine in Development configuration through Visual Studio.

Step 2: Create Server Target File

Create a new target file for your server build. Name it [ProjectName]Server.Target.cs in your project's Source folder. This file defines server-specific compilation settings.

using UnrealBuildTool;

public class YourGameServerTarget : TargetRules

{

    public YourGameServerTarget(TargetInfo Target) : base(Target)

    {

        Type = TargetType.Server;

        DefaultBuildSettings = BuildSettingsVersion.V2;

        ExtraModuleNames.Add("YourGame");

    }

}

Step 3: Configure Project Settings

Modify your project's build configuration. Set the target platform to Linux for most hosting scenarios. Configure networking settings in Project Settings under Engine > Network.

Enable "Use Pak File" for optimized server builds. Disable unnecessary features like audio and rendering for headless servers.

Step 4: Install Linux Toolchain

Download and install Unreal's Linux cross-compilation toolchain. Set the LINUX_MULTIARCH_ROOT environment variable to point to your toolchain installation. Regenerate project files after installation.

Step 5: Package for Server

Select your server target in the Project Settings. Choose Linux as the target platform. Package your project through File > Package Project > Linux.

The build process creates a headless server executable. Test locally before deploying to cloud infrastructure.

By following these methods, you can effectively add dedicated game servers to your Unreal Engine project, either through manual setup or automated deployment using Edgegap's services.

书写者

the Edgegap Team