Command-Line Arguments, Networking, and ShooterGame example.

Sorry for adding more posts about the ShooterGame example to this thread, but I’ve extensively searched the forum first and have been unsuccessful in finding a solution.

I am trying to run the ShooterGame example on two separate computers and connect to the same game. I built the game in release mode and both computers run it fine, but when I host on one computer, the other does not pick it up when searching for servers. After reading through the forums that the ShooterGame is a fully functioning multiplayer game, I decided to search the forum in more depth. I found the following article:

about command-line arguments and am unsuccessful in connecting the the other computer to a running game on the first. I tried creating a shortcut of the .exe and appending ?listen -game to end, but it did not work as intended. I may be doing this incorrectly, but as someone that’s new to network programming so as far as I could make out that is correct. I also read up on:

but I’m not looking to connect via a dedicated server. I also found:

and the following response:

but unfortunately I’m unable to simply find the server and connect one PC running the game to a PC hosting a server right next to it.

Thanks in advance for any help.

Your router might be blocking incoming connections. Make sure to forward 7777 UDP port on your server computer. The 7777 port is used by default for networking in UE4, but could be configured via .ini files.

There are another options available as well, such as enabling DMZ zone, using Virtual Server or turning on UPnP in your router. Yet another option is to use UPnP library which would do port-forwarding automatically, requires programming obviously.
Note, that this all still might not work in case of double NAT situation, where you use some setup like modem + router, both of which got NAT enabled.

Tried forwarding the 7777 UDP port but got the same result. I honestly have no idea what any of the second paragraph stuff means since I’m inexperienced.

First of all, did you try to run multiple clients of shooter game and connecting to the server at the same PC?

Game.exe ?listen -server for server
Game.exe server-IP -game to connect, for the server hosted in the local network use 127.0.0.1

You could also try to connect to the local server via WAN IP(just your IP), if it fails to connect to your local server, then it’s obviously NAT issue, though it still might block you from connecting to yourself using WAN IP if your router does not support NAT loopback, in other words, you might fail to connect to the local server via WAN IP while others would be able to connect to your server.

I can connect to my server when I run multiple clients on the same PC. I’m able to just open up two instances of the executable, host on one, and then join on the other without having to append anything.

So, as i said, that’s a NAT issue.

Properly configuring server behind NAT is quite heavy task i’d say, if simple port forwarding didn’t help you, and since it’s your home PC, setting up DMZ zone would be a good idea. Go through your router configuration and look for DMZ zone or Virtual Server, set them to function on your PC. In case of DMZ zone simply setting PC LAN IP would be enough, configuring Virtual Server would require quite more work if i recall correctly.

If the two computers are on the same router, then NAT shouldn’t come into play. NAT only happens when you cross out of the local network. With that said, there’s plenty of documentation on the net on how to configure your router to support an Open NAT. The thing to remember is that the client can have a more restrictive NAT setting than the server. The server needs to be on an Open NAT in order to accept unsolicited UDP connections from the client. The client can be completely locked down, since it is the one initiating the connection

Hm, yeah, indeed. I was sure server and client are running in different networks :slight_smile:

This is an old post, but in case anyone else comes across it… When you fire up the server as a game session it doesn’t always start a listening server. If you exit to main menu then select **Host **it will take you back into the game and “look” like nothing changed, but it is now also listening and the second computer can join in.