How to add dedicated servers to Unreal multiplayer games

Docker for Game Servers
Docker for Game Servers
Docker for Game Servers

Edit: Introducing Edgegap's Docker Extension, which which helps Unreal developers create builds from container! It concretely means game devs have the ability to create builds much faster (from 2.5 hours to 8.5 mins on avg.) thanks to not having to build Unreal from source. Lean more here.

For developers seeking dedicate ("authoritative") server solutions, EOS recommends to be integrated with third-party services like Edgegap.

-> This article is based on Getting Started documentation. If you encounter issues or discrepancies, please make sure to refer to the original guide, as they are more frequently kept up to date.

0. Preparation

Deploy Your First Dedicated Server on Edgegap

By the end of this guide, you will have deployed a dedicated server with Edgegap at no cost.

1. Configure your Project

Whether you’re using a Windows, Mac, or a Linux machine, you will need to build your server for Linux runtime, as most cloud providers nowadays (including Edgegap) run on Linux. Don’t worry, no Linux knowledge is required.

☑️ Start by verifying your Unreal Engine version - pre-filled with value from your project files.

☑️ Input GitHub username and PAT from ✔️ Preparation, to download dependencies from GitHub.

☑️ Disable Unreal Engine version compatibility check for dedicated servers and set IpNetDriver as the default driver or the fallback driver for replication networking:

[ConsoleVariables]

net.IgnoreNetworkChecksumMismatch=1

net.CurrentHandshakeVersion=2

net.MinHandshakeVersion=2

net.VerifyNetSessionID=0

net.VerifyNetClientID=0

[/Script/Engine.GameEngine]

!NetDriverDefinitions=ClearArray

+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[/Script/OnlineSubsystemUtils.IpNetDriver]

MaxClientRate=1000000000

MaxInternetClientRate=1000000000

InitialConnectTimeout=120.0

MaxNetTickRate=60

NetServerMaxTickRate=60

[/Script/BuildSettings.BuildSettings]

DefaultServerTarget=LyraServer

☑️ Restart Unreal Engine to reload latest changes.

☑️ Create a dedicated server target script by copying your <PROJECT>Editor.Target.cs file in project root folder and renaming the copy to <PROJECT>Server.Target.cs.

☑️ Replace any references to word Editor with Server in your server target script.

☑️ Enable standard output server logs by adding overrides in your server target script:

bUseLoggingInShipping = true;

bOverrideBuildEnvironment = true;

✅ You may now proceed to the next step.

  1. Build Game Server

Now we'll build and cook your project, and package it in an easily reusable docker image.

Working in a team of developers means sharing your code. When things go wrong, the last thing you want to hear is “it works on my machine”. Game servers have to run reliably on any machine, since a successful games’ servers will run on thousands of server machines across the world.

To help make your server reliable, we use Docker - virtualization software to ensuring that all of your server code dependencies down to the operating system level are going to be always exactly the same, no matter how or where the server is launched.

☑️ You may configure the following options (or keep defaults):

  • Image name is a unique identifier of your choice, labeling your server build before shipping.

    • Usually, this will include the name of your game - for example “my-game-server”.

  • Image tag is an identifier pointing to a specific version of your image.

    • The term “build artifact” is sometimes used to refer to a specific version of your image.

Timestamps are a great option for tagging, e.g. 2024.01.30-16.23.00-UTC (default).

☑️ Build Project once you're satisfied with your configuration. Completing this step will add a new image with your linux game server executable in your local Docker client.

✅ You may now proceed to the next step.

  1. Test Server Locally

Let’s try deploying locally (on your machine) and connecting a game client, to make sure the server image is functioning properly before we upload and deploy (which may take a bit of time).

☑️ Select the image tag you wish to run locally (remote images will be downloaded). Optionally, more docker run arguments can be supplied to customize your local test:

  • -p 7777:7777/udp - this is your local container port mapping,

  • -e ARBITRIUM_PORT_GAMEPORT_INTERNAL=7777 is an environment variable mocking a real Edgegap deployment, telling your game server the internal port to listen on for player connections.

☑️ Once you’re happy with your configuration hit Start Local Server. Completing this step will result in a new container being started on your development machine.

☑️ Now it's time to connect your Unreal Engine Editor (PIE) game client to your local server container. Open Unreal PIE console with ~ (tilde) and connect with open <ip>:<port>:

  • ip = localhost or 127.0.0.1 (equivalent in most cases),

  • port = randomized external port value of the container in Docker GUI.

☑️ Once you’ve verified you’re able to connect to your local server container and play without issues, you may delete the container 🗑️ to free up resources on your machine for other programs.

✅ You may now proceed to the next step.

4. Publish to Edgegap

It’s time to ship your server online! Now that your image can successfully host players, we can upload it to Edgegap and start running it anywhere in the world. In this guide, we’ll be using Edgegap’s Container Registry (storage for images).

☑️ Choose an application name to label and group similar images on Edgegap.

☑️ Select the image tag you wish to publish and Upload Image. Completing this step will result in uploading your server image to Edgeap Registry and a new Application version being created in your web browser. Make sure to create your port mapping when prompted, with the default values.

✅ You may now proceed to the next step.

5. Deploy to Cloud

This is the final step in this guide, after which you will have a server deployed on Edgegap cloud, to which players from anywhere in the world can connect.

☑️ Choose an application and version from previous step to deploy.

☑️ Once you’re ready, hit Deploy to Cloud, wait to reach 3. Deployment Ready. Completing this step will result in a new Deployment being started on your Edgegap account.

☑️ Verify there are no new errors in your console output. Ensure also that your Container Logs don’t show any errors and your Container Metrics don’t indicate 100% resource utilization (vCPU or memory), otherwise new player connections may be rejected, or your server stuck in a restart loop. See troubleshooting steps below to address any issues.

☑️ Now we’ll perform the final test and connect your Unreal Engine Editor to your cloud deployment. Grab your Deployment’s Host in place of server IP and the Deployment’s external port, open Unreal console in game client (tilde ~) and type open {host}:{port} .

☑️ Once you verify you’re able to connect to your Deployment without issues and are done testing, Stop your Deployment to free up capacity in your account for the next build. In case you encounter issues, inspect Dashboard logs of your deployment. If you can’t figure out the issue, we’re hanging out in our Community Discord and happy to help.

🙌 Congratulations on your first Deployment on Edgegap! If you’d like to learn more, keep reading. Make sure to check our matchmaking to group players ahead of deploying a game server.

Written by

the Edgegap team

Sources and/or content collaboration with

Epic Online Services

Get your Game Online Easily & in Minutes

Get your Game Online Easily & in Minutes