Dedicated Servers for UE4

So I have a couple of questions regarding servers. My main question is how to create a standalone server which does not contain the hole game so you can split between Clients and Server. I don’t want the clients to contain the server software and therefore a separated server program which only operates from command line. I’ve already come over this question here: Having separated client-server code is possible? - UE4 AnswerHub
Can someone provide more specific information how to do so since I don’t really understand what they mean by WITH_SERVER.

However, I also came up about some other stuff.

  • Master servers. In Unity they provide a Master Server software. Any similar for UE4?
  • Linux support. When will there be support for dedicated servers on Linux?

Coming from the perspective of someone whose primary professional experience is server-side development.

The best way to think of this is that the server and the game client are two completely different(related, but logically separate) projects.

In Unity(and some other Engines) they munge these together a bit, similar to what you’re trying to do with Unreal. But the reality is you’re actually building two distinct programs, a client(UE4) and a server(Whatever you want).

So there’s no requirement that you run the server side in UE4(and if I was being honest, I’d highly recommend against it).

So the server program can be in any language, run on any machine, or meet any criteria you deem. You simply have to pick a way for them to communicate, I believe UE4’s default way is UDP?, but you can communicate via other protocols or control schemes, TCP/IP packets, HTTP( and JSON,XML,EDN…etc), various RFC implementations, or roll your own(do not recommend).

The only prime benefit of running the engine on the server-side is for direct access to engine features in your remote calls to it, which typically isn’t needed(and if it was, I’d still recommend a server-side program that acts as a abstraction layer on top the engine).

I guess I’m ultimately just leaving you with more questions, but ultimately I’m just expressing that this feature is not only unnecessary, it’s not even the best route in most cases.

Hi Mellnik,

Thanks for taking the time to ask. I’ll do my best to answer some of these!

WITH_SERVER_CODE is a #define that will be 1 when you select the “Debug Server” or “Development Server” configuration option.

You can use this as part of a compile time macro to exclude code on the client that was meant only for the server:

void MyServerOnlyFunction()
    Do Server Stuff here;

If you search the code base for WITH_SERVER_CODE you should find existing usage of it currently.

We don’t supply an actual master server component. Since this is something that can get very specific, and depends on what your backend needs are, it can go from simple to very complex.

We do however supply a way to integrate third party support for this very feature via platform agnostic API’s. Check out for more details.

If your client is using UE4 for networking and replication, it will be much easier to also use UE4 for your dedicated server instances. We fully understand any concerns for security, and unnecessary overhead, but we take this very seriously internally, and we are working towards the same goals in this respect.

Thanks for your answers. I do understand it more now.

I built a development server to test the macro definition but when i start UE4Server.exe it crashes and says “Unreal Engine has stopped working”. Any idea?

Dedicated servers need cooked content. Right now it looks like we don’t supply a game which you could cook, so you will perhaps need to wait for the next build for a real-world working example - right now you can only build the executable.

Having dedicated server and client share code is a viable strategy though, from code reuse point of view if nothing else.

Linux dedicated server can be cross-compiled even now (given a cross-toolchain, which is again something that we’re about to supply :-)). There are also forks on github that already added support for native compilation (thanks @sbc100!).

Hi guys. Has anyone tried to run an U4 multiplayer game on Freebie Servers:

Hi Mellnik,

if you are looking for a custom implementable server solution I can recommend PhotonServer by ExitGames. I just try to implement the c++ api into UE4 with some good progression. If you want you can check my website for a short reference on how to integrate Photon and UE4.

If you are looking for a free server framework I might recommend RakNet. Just google for it.

I am sorry to bother you. I am also stuck at unreal engine dedicated server part.
I have followed the unreal wiki tutorial for dedicated server till now it seems to be working.

I have following confusions
How to handle server after launching the exe? I mean what about command line just like SteamCMD provides.

and how do i handle custom game mods i have created just like call of duty has “TDM, Search and destroy etc”. I am thinking of building custom Dedicated server with custom command line arguments to select game mode.

Right now we can only select map or set port while launching exe, What about Max players, custom game modes.

and mid-session ,changing map, kicking player(hacker), pausing/resuming, restarting and, next random map, etc