Building and Running a Dedicated Server

So…

I’m running into all sorts of bad news whenever I try to get a dedicated server up and running for either my game, or even ShooterGame. To keep things simple I’ll use ShooterGame as an example.

First off the shootergame didn’t actually come with a server build configuration, but this is what I’m using atm:

ShooterGameServer.Target.cs:



// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
 
using UnrealBuildTool;
using System.Collections.Generic;
 
public class ShooterGameServerTarget : TargetRules
{
        public ShooterGameServerTarget(TargetInfo Target)
        {
                Type = TargetType.Server;
                bUsesSteam = true;
        }
 
        //
        // TargetRules interface.
        //
 
        public override bool GetSupportedPlatforms(ref List<UnrealTargetPlatform> OutPlatforms)
        {
                // It is valid for only server platforms
                return UnrealBuildTool.UnrealBuildTool.GetAllServerPlatforms(ref OutPlatforms, false);
        }
 
        public override void SetupBinaries(
                TargetInfo Target,
                ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
                ref List<string> OutExtraModuleNames
                )
        {
                OutExtraModuleNames.Add("ShooterGame");
        }
        public override List<UnrealTargetPlatform> GUBP_GetPlatforms_MonolithicOnly(UnrealTargetPlatform HostPlatform)
        {
            if (HostPlatform == UnrealTargetPlatform.Mac)
            {
                return new List<UnrealTargetPlatform> { UnrealTargetPlatform.Mac };
            }
            return new List<UnrealTargetPlatform> { UnrealTargetPlatform.Win32, UnrealTargetPlatform.Win64 };
        }

        public override List<UnrealTargetConfiguration> GUBP_GetConfigs_MonolithicOnly(UnrealTargetPlatform HostPlatform, UnrealTargetPlatform Platform)
        {
            return new List<UnrealTargetConfiguration> { UnrealTargetConfiguration.Development };
        }
}


The documentation here:

https://docs.unrealengine.com/latest/INT/Programming/UnrealBuildSystem/TargetFiles/index.html

doesn’t have all that much info on this, so I’ve been going off the info I could find in the comments @engine\source\programs\unrealbuildtool\system\rulescompiler.cs

The above config file results in the binary being built, but after that I’m still seeing oddities when it comes to running that Server binary. It pretty much crashes soon after starting, and when I pass in the -log parameter, I can see that it has a bunch of errors. The thing is though, I can’t actually see the log from the crash because it doesn’t write one.

When I look in : ShooterGame\Saved\Logs, It only has logs from running ShooterGame.exe. ShooterGameServer.exe instead is outputting a bunch of binary dump files akin to Dump240478864.dmp there each time it gets run.

Anyone know what might be wrong, or how to properly build a server executable for a game?

I used the Target.cs file provided here to build a dedicated server executable: https://answers.unrealengine.com/questions/27802/packaging-and-creating-a-dedicated-server.html

One important thing to note is that Epic has mentioned in a few places that dedicated servers require cooked content, so if you aren’t packaging your project, and instead are trying to serve out of your working copy, that might cause crashes. It’s hard to say without knowing exactly what the errors you mentioned are.

Neverender is right about running the dedicated server executable against cooked content, however, you can also run an instance of the dedicated listen server using uncooked with the editor; I think in both cases you may be hitting a crash that I believe I solved for my own purposes and you can check out my solution here: Running UE4Editor.exe as dedicated server with ShooterGame demo results in a crash - C++ - Epic Developer Community Forums

I am only making an assumption for you (and the OP of the other thread) about what your crash(es) might be; throw up your logs and callstack next time if ya can, would help track this down quite a bit.