skip to Main Content

Hosting a game server

In this post we’re going to host a game server from your PC so that your friends can join you and play the game you’re currently developing. In order to follow this post you will need a non-binary version of the engine built in your PC. So before you continue, you should preferably clone a release version of the engine (since these versions are more stable) from its repository. In case you’re having trouble compiling the engine, check out this video.

Before we dive deeper into this post, it’s worth noting that currently you cannot build a game server for a Blueprint only game. Thankfully, you can convert a Blueprint project into a C++ one by adding an empty C++ class via the editor’s “New C++ class wizard”. Moreover, it is essential to build the editor from source, otherwise you won’t be able to compile your server’s code later on.

Creating the project

So, once you have built the engine from source, open it up and create a new third person C++ project template named “ServerProject”. Then, close the project and from your windows explorer, add the following file c# file into the source folder:

Make sure to save this file as “ServerProjectServer.Target.cs” (the red marked text is just a convention to let our future selves know that this file has to do with the server only and doesn’t interfere with our game’s code).

Once you’ve added the above file, open up your game’s solution file and build your game for the following configurations:

  • Development Editor
  • Development Server

In case you use a binary version of the engine, the compile process in the development server configuration will fail.

Configuring the maps for our project

In our case we will create an empty map (let’s call this EntryMap) in which the players will type the IP address of the server in order to establish a connection. Go into your project’s settings and assign the EntryMap into your project’s “Game Default Map” (this is the first map that will be loaded in your packaged game). Then, make sure to set the default map for your server as well (in my case this is called NewMap):

When you’re done with that, create a new Widget Blueprint (let’s call this IPWidget) and add a text box as well as a button inside its canvas panel:

Then, create the following logic inside the Pressed event for your Join button:

Compile and save your Blueprint. Then, make sure to go into your project’s Entry Map and add the widget into your viewport:

At this point, we’re done with the project so make sure to save everything and package your game and distribute it to your friends (in case they don’t have an installed version of the engine they’re going to need an installer in order to play your game).

Starting the server

In order to start your server, go into your project’s Binaries folder and locate the “ServerProjectServer.exe”. Then, create a shortcut for it somewhere in your PC and add the -log tag in its target from the properties like so:

This will make sure that the server will open up in a command prompt window which will give us a lot of info about what’s going on currently on our server. In order to start your server, run this shortcut and a similar window will appear:

Notice that the server is listening on port 7777. In order for players to join the server, they will need to type the server’s IP address including its listening port (ie: “” where xx will be the server’s IP). If you’re hosting the server in your local PC you need to open up your router’s ports in order for players to connect.

Finally, here is a screenshot of the server’s log after a few players have connected:

Avatar photo

This Post Has 2 Comments

  1. Several additions:

    – you need generate VS project files after add XXXServer.Target.cs

    – you may need add this file by hand to

    – you need set Development_Server to Active configuration in Configuration Manager (find your project name and check what is it.. In my case it was Development_Game in both Dev_Server and Dev_Game configurations)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back To Top