Networking for Multiplayer Lobby

Hi guys,

A friend and I are working on a multiplayer lobby for our game. It is modeled off of the multiplayer lobby that Sierra uses for some of its games (e.g., Empire Earth, Emperors), though we’re trying to make the UI a little more intuitive. :slight_smile:

Anyway, there is something about the way that the Empire Earth lobby works that I don’t understand, but maybe somebody else does. It does not allow you to host a game if you are using NAT. Does anybody have any insight as to why that might be, and what can be done to get around that?

Also, I guess while I have your attention, let me run the high-level multiplayer lobby architecture by you and see whether I am on the right track. We have a single login server that handles authentication and then hands users off to one of arbitrarily many lobby servers. When somebody hosts a game, it is a game staging server running on the host’s machine that handles game staging. So players have to connect to the host’s machine. I assume that somehow NAT prevents that, but I don’t know what the problem would be.

Thanks,
Willie

p.s. I do not believe that it has anything to do with a firewall. Even if I’m using NAT with no firewall, I can’t host a game.

Willie

I have limited network knowledge, but I think I can answer the NAT part:

NAT is an acronym for Network Address Translation and is (primarily) used for having multiple machines share the same public internet IP. The simple setup is this:

                Internet
                    |
                    |
               Router public interface with public IP
               Router private interface with some local IP (could be 10.x.x.1)
                     |
                     |
                     /\
                   /    \

Local machine 1 Local machine 2
with local IP With another local IP

So the setup has one public IP and a number of local IPs, one for each machine connected to the router. What happens when a local machine connects to some public site (say, www.java-gaming.org) is that the router translates the request to come from the public IP instead of the local IP and marks messages with some cookie identifying the local machine. When a reply comes back from java-gaming.org the echoed cookie enables the router to forward the reply to the correct local machine.

Now, the problem is when a connection request is send the other way, that is, from a public IP to the router, where is the router to send the request? It can’t just pick an arbitrary local machine, so in many NAT configurations, connect requests are simply dropped, and you can’t host anything on the local machines, including games.

Some routers allow you to setup a destination local machine for specific ports, say connect request port 6666 on the public IP should go to local machine 1, 1024 to lovcal machine 2 etc. If that has been setup for your game’s port, hosting a game should work regardless of NAT.

Hope it helped

  • elias

Yeah, the part at the end gave me an idea, where you say “Some routers…”. The thing that I’ve been having trouble getting is why an inbound connection wouldn’t work through NAT even if I have port forwarding set up on my router. I already tried it before, and before hosting, the game (Empire Earth in this case) warns me that others might have trouble connecting to my machine.

Hm, I wonder if this is what’s happening. I wonder if EE checks the local machine’s IP address, and is somehow able to determine that it is a private IP address. (Reserved range for private IPs? Is there such a thing? On my LANs I use 192.1.x.x and 192.2.x.x.) If it’s private then the warning comes up, but maybe if port forwarding is configured then clients will be able to connect anyway, despite the warning.

Thanks for the idea. I’ll give it a shot.

Willie

Like elias said, if your router has port-forwarding…use that. My router maps incoming ips ##.##.##.##:4567 maps to 10.#.#.# on my internal network. I use this for GT6. Oddly enough, Tribes 2 lets me host a server without any altering of my router???

Hey guys, your explanation was right. Damn. I’ve been playing that game for about three years without being able to host. LOL, I’m a dork…

p.s. Once I configured port forwarding for the EE ports, my attempt to host stopped producing the warning at all. It looks like the way it works is that when I press “Host”, Sierra tries to establish a connection to my machine. If it’s successful, then no dialog comes up. In other words it is not the client that is somehow able to divine whether my machine is sitting behind NAT, as I had proposed.

hey javawillie,
i am having the same problem hosting on EE.
after i disabled my firewall and still couldnt host, i read your posted notes and decided to try disabling my NAT. (i use DirecWay satellitte for internet sevrice and the configuration software has that option, strangely enough) i thought that would solve the problem, but it didn’t.
now i’d like to try the port-forwarding strategy. how do i configure that on windows XP? how did you do it?