Can someone just please answer this question - online multiplayer

I created a simple world,nothing spectacular and my only goal is to have players connect to that world online(it’s an Android maybe IOS project if that is important to know). I checked every forum ,video but still didnt understand : do I need to set up a dedicated server to be able for players to simply connect online to that world? is there a built in feature in UE4 for basic online multiplayer? PLEEEEASE HELP !

If you want this to be accessible from the internet, a server is needed. For local network testing you should be able to make note of the IP address of the machine that is going to act as your server and if the proper components are in your project on the client builds, the other players should be able to connect to your running server build. You could have a way for the clients to type in the server IP address in your GUI when they start multiplayer mode.

I’m not sure how you haven’t found material for this topic. Have you tried YouTube? I thought UE4 was well-known for its built-in multiplayer system.

There are many ways around this depending on how you want your players to connect to each other.

Let’s talk about the server first.
You do not need a dedicated server. You can have one of the clients (phones) host the server in the background whiles they play the game. This is similar to how most co-op games work and how a lot of Xbox 360/PS3 online games worked, i.e. Call of Duty.

The notable downsides to this solution are:

  1. whoever is hosting the server needs to have their ports forwarded.
  2. the host of the server can ‘mod’ the server.

Ideally, it is better to use dedicated servers but that costs money and isn’t usually worth it for co-op games.

Now let’s talk about how your players can connect.

1. Joining through IP address
The player gets the IP address of the server and then executes the following command open {ip address}. You can always add a UI which then calls that command.

2. Joining through a server browser
A server browser is really just an online database containing all the info of registered servers. Therefore, it requires a server to host the database. This usually costs money but a lot of platforms offer you free server to use for server browsers, i.e. Steam, EOS and PlayFab.
But this approach requires quite a bit of research to understand how to use them.

Note: servers must be registered. If someone hosts a server but it is not registered with the server browser, then no one will see it. Sometimes this is automatically done by the platform.

3. Matchmaking
Similar concept to the server browser but usually more money. I’m sure you can do your own research once you get to this point.

This document is almost essential when it comes to learning UE4 multiplayer: https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf

I forgot to mention how a client can host a server.

Instead of using the standard open {level name} command to load a level, use open {level name}?listen. ‘listen’ is an argument that tells the game that players can join this world.

Thanks for the reply Dynamiquel. So after extensive research on this …farely basic issue here was my problem and solution. I wanted a dedicated server and I understand the complications of having to have a host for that server and all that but before paying for a host all I wanted was to do a simple test of using my pc as a server and conecting online with my phone to it. The issue was nobody anywere in all tutorials where mentioning the fact that the connection for UE4 servers is made ONLY on port 7777. And no matter how much I tried everything it wouldnt work cause my pc wasnt on that port.

I think your understanding on ports is wrong. You have to port-forward.

You have to go into your router settings, go to something like ‘port forwarding’, then create a new service.

If you don’t know how to access your router or your PC’s IP, then go to Command Prompt and type ipconfig.
You are looking for IPv4 Address (which is your PC IP), and Default Gateway (which is your router IP).
image

Enter the number for Default Gateway into your browser. You should now be on your router’s page and it will ask for login info. (The login info is router/ISP specific so just Google it).
Once logged in, find something to do with ‘port forwarding’, then create a new ‘service’.

In this service, you enter the IPv4 Address from earlier.
Then for the port range, do 7777-7777. As for type, select Both (TCP/UDP).
Save and enable everything.

Alternatively, just Google {your router name} port forward, you should find some material.

As long as you don’t have some firewall blocking anything, people should be able to connect to your server.

1 Like

It depends on the Ip address range being used.
16 bits host id is 192.168.x.x
20 bits host id is 172.x.x.x
24 bits host id is 10.x.x.x

Only UDP is necessary.

1 Like