C++ dedicated server list

Hello,

First, I’d like to say that I don’t know c++, at all. Although I have some experience with c# in unity.

I have heard that dedicated server stuff can only be done in c++ so my question is:

The game I’m working on is going to be a multiplayer game. For that it requires us to hire someone servers host the game on it and that would be our dedicated server (correct me if I’m wrong)

One server is not enough. Let’s say we want 5 servers,

Just like in the shooter example, we want to list the servers avaliable and connect to the one you desire.

What would be a possible way of achieving that?

Then again: I don’t know c++

Help would be greatly appreciated .

Thanks in advance,

Marcel

Hey MarcelEissens,

If you don’t know C++, you can use the Blueprint nodes. As an example, this is how you can Create, Search, and Join a multiplayer session:

On top of that, here is some networking and multiplayer documentation:

[)][2]
[Networking and Multiplayer in Unreal Engine | Unreal Engine 5.1 Documentation][3]
[Engine Feature Examples for Unreal Engine | Unreal Engine 5.1 Documentation][4]

Hey,

Thanks for the fast answer!

Let’s see if I understand it:

I want to use the Multiplayer-Shootout game as a template to start from.

Multiplayer Shootout uses [OnlineSubsystemSteam] (altough i dont understand that part very well)
That game does include hosting, searching and joining, as well as LAN mode.

I want to host the game on a rented (dedicated) server.(the server does not act as a player.)

Would it be as simple as running the game on the rented server (or multiple servers), and then other players can find those games/sessions?

Or do i need to go trough the process of compiling the engine from the github source, changing the buildtarget and servertarget, then compile a server.exe and a client.exe and run the server.exe on the rented server.

I know I can use blueprints to get stuff done instead of c++, but can I combine the two?

Edit: I watched this video: UE4 How to build a Dedicated Server - PT 1 - YouTube

on how to set it up, but at 180:20 he opens the console and types in the ip-adress he wants to connect to.

Is there a way to automatically list these servers (just like the shootout game, but then not LAN) Or is that wat the steam subsystem does for you?

If you want to run a dedicated server, you need to build a server to run; which includes building from source.

If you just want to join a hosted game, as in another player is acting as the server, you do not need to build a server from source.

“Find Sessions” should return all multiplayer game sessions; hosted and dedicated. (for your game)

You can mix C++ and Blueprint. Most games do.

https://docs.unrealengine.com/latest/INT/Gameplay/ClassCreation/CodeAndBlueprints/

https://wiki.unrealengine.com/Blueprints,_Creating_C%2B%2B_Functions_as_new_Blueprint_Nodes

So i download the source, compile it,
change the UnrealEngine Version to the one build from the source,
then open the project in Visual Studio and then build the Server.

Run the server build on a rented server and it should be listed in the Serverlist.

Am i correct?

Yeah, that sums it up.

To break it down:

  • Make sure your Unreal Engine User account is linked to GitHub.
  • Download the branch you want (current stable version is 4.12)
  • Run “Setup.bat” in downloaded source code. Wait for it to finish downloading (roughly 4GB)
  • Run “GenerateProjectFiles.bat”
  • Open UE4.sln
  • Compile engine as Development Editor (this takes a while)
  • Run UE4 and create C++ Project (this will open another Visual Studio window for that project)
  • Close UE4 Visual Studio project.
  • Create Server.Target.cs for your game : Documentation
  • Close MyGame Visual Studio project.
  • Navigate to your MyGame project directory
  • Right click, MyGame.uproject → Select, “Generate Visual Studio project files”.
  • Re-launch MyGame.sln
  • Make sure MyGameServer.Target.cs exists in the Solution Explorer
  • Change the “Solution Configuration” from Development Editor to Development Server
  • Compile MyGame (You have to do this every time you make changes to your game and want to test them on the server)
  • Open MyGame.uproject
  • Set your package settings in editor and package the game
  • Navigate to where you packaged your game and go to WindowsNoEditor->MyGame->Binaries->Win64
  • In other folder, navigate to where your MyGame.uproject is saved.
  • Go to Binaries->Win64
  • Copy MyGameServer.exe
  • Paste MyGameServer.exe to packaged game: WindowsNoEditor->MyGame->Binaries->Win64
  • Right click MyGameServer.exe → Copy
  • Paste shortcut in same folder.
  • Right click on short cut and go to properties
  • add, “-log” to end of Target (no quotes)
  • You can now run a server.

Last bit of advice:

Making a multiplayer game is exceedingly more difficult and costly than making a single player game.

Big thanks for clearing that up :smiley:

One more question:

Does all this work the same for mobile?

Like if I change the controlls of the Multiplayer-Shootout game for mobile, will multiplayer still work?

-Marcel

It should work for mobile but there has been some documented issues with mobile development and multiplayer having some bugs.

As an example:

https://issues.unrealengine.com/issue/UE-34875

If you are learning multiplayer programming, I would first focus on learning how to write the code / use Blueprint to make the functionality solid. Then, focus on something like deploying to mobile devices and hosting servers.

Okay will do that :slight_smile:

Thanks for the help, it’s much appreciated :smiley:

greetings,

Marcel