Download

Connect to a dedicated server from client

Hello !

I am slowely starting to learn Unreal Engine 4 using C++.

I am making a multiplayer game (2 players). The game is pretty much done, now i want to make a menu : the player enters the server’s address, then the game connects to it.
For the moment i’ve been using UE4’s built in connection (under the play button).

So here is my question : how can i make a menu to let the user connects to a dedicated server. I’d like a level which his the menu, then a new level gets loaded, connected to the dedicated server.

Thank you for any help :slight_smile:

If you’re using Steam or some other Online Sub-System provider, then you use the Online Session System for the relevant platform. For some reason though, Dedicated Servers on Steam are notoriously difficult to get working properly.

If you’re just using a simple internet connection, then you have to connect via IP address. Sessions are a complex topic and there isn’t a lot of good documentation on it to be honest. My advice would be to study the ShooterGame sample if you’re working with C++, and also look at the “Multiplayer Shootout” example on the Learn tab for a simple Session setup.

I will do that, thank you ! I’m still blocked with that problem for my project until now ;(

I’m using the function ClientTravel() from the Player Controller. The first argument is a string containing the IP + eventual arguments (that function just like HTML get parameters “blabla?param=value&param2=value2”), the second argument is an ETravelType enum.

That should work for you as well :slight_smile: