Game Development Community

Testing an intenet game from a local network

by Jack Stone · in General Discussion · 03/27/2014 (12:35 pm) · 4 replies

Hello,

I am working on a project which has internet play. I can connect and play the game perfectly over my LAN (using Query lan from the standard T3D server gui). However, "Query Master" never returns any results, even when I know my server is running.

In my console, I get this:

ServerQuery:  start Querying master server 0
No master servers found in this region, trying IP:198.101.240.242:28002.
Requesting the server list from master server IP:198.101.240.242:28002 (2 tries left)...
Received server list packet 1 of 1 from the master server (1 servers).
Pinging Server IP:86.46.103.164:28000 (3)...
Pinging Server IP:86.46.103.164:28000 (2)...
Pinging Server IP:86.46.103.164:28000 (1)...
Pinging Server IP:86.46.103.164:28000 (0)...
Ping to server IP:86.46.103.164:28000 timed out.
ServerQuery:  query Querying servers: 0 left... 0.5
ServerQuery:  done No servers found. 1
ServerQuery:  start Querying LAN servers 0
LAN server ping: IP:Broadcast:28000...
Pinging Server IP:192.168.1.6:28000 (3)...
ServerQuery:  ping Waiting for lan servers... 0.5
ServerQuery:  query Querying servers: 1 left... 0.5
Querying Server IP:192.168.1.6:28000 (3)...
ServerQuery:  query Querying servers: 0 left... 1
ServerQuery:  done One server found. 1
ServerQuery:  start Querying master server 0
No master servers found in this region, trying IP:198.101.240.242:28002.
Requesting the server list from master server IP:198.101.240.242:28002 (2 tries left)...
Received server list packet 1 of 1 from the master server (1 servers).
Pinging Server IP:86.46.103.164:28000 (3)...
Pinging Server IP:86.46.103.164:28000 (2)...
Pinging Server IP:86.46.103.164:28000 (1)...
Window focus status changed: focus: 0
  Using background sleep time: 200
Pinging Server IP:86.46.103.164:28000 (0)...
Ping to server IP:86.46.103.164:28000 timed out.
ServerQuery:  query Querying servers: 0 left... 0.5
ServerQuery:  done No servers found. 1

My issue is described exactly in this thread:
http://www.garagegames.com/community/forums/viewthread/109433/2#comments

This post, by Nathan Martin, seems to shed light on the issue:

"1) PC B queries Master for servers available.
2) Master replies with a listing of known alive game servers.
3) PC B then directly queries each server it was given by Master.
4) PC B awaits replies from servers, if it receives any it'll display them in the GUI that are valid (correct protocol, etc..)

The problem comes in play during stages 3 and 4. When PC B tries to query PC A by sending a packet addressed to the public IP of the server then most likely (if port forwarding is working) it (PC A) will receive the query packet, but when it tries to send a response it'll send it to PC B's IP address as PC A LAN IP (due to NAT router saying packet came from PC B's LAN IP. Therefore PC A will reply directly over LAN to PC B instead of going through NAT router), but PC B is expecting a response from the public IP address not PC A's LAN IP."

It seems from some of the other posts in the thread, that this problem can be overcome, but I haven't been able to figure out how. Also, if it is possible to test an internet game (using the master server) on the same network as the host, would this be a reliable way of simulating a client connecting from outside the network? Or could there still be other issues that this testing regime would not discover?


#1
03/28/2014 (9:42 am)
The only workaround I know of is to have the client(s), master server, and game server(s) on the same LAN. But this would mean not testing over the internet at all.

The best test is to run the game server on an actual public IP address separate from the client. Such as host the game server on a dedicated server or VPS. Or if your lucky enough to have an ISP that gives you two or more public IP addresses you can assign one to your game server host machine. And make sure it isn't firewalled off and bypasses your NAT router or at least isn't the same NAT router that your client will go through for internet access to avoid the situation explained in the discussion thread you referenced.

Another one you can easily do is make sure your game server is exposed properly to the public internet (correct ports forwarded, access policy, etc..) and have somebody else outside your home/office run the game client connect to your server.
#2
03/31/2014 (10:53 am)
Hello,

Yes, that is what I am doing now, and it seems to be working, but I am very wary of releasing even very early code that hasn't been properly network tested, since I don't know what firewall issues, security issues, etc there could be.

I understand that, obviously, running the game server on a dedicated server would be preferable, and for a production game, neccessary. Hosting anything on a home internet connection would be madness for any production project, but for testing, it's a major expense to rent a server like that.

I think I'll just have to find someone to test my game with then, I just wanted to know if there was an obvious alternative.

Thanks a lot!
#3
03/31/2014 (10:58 am)
I suppose you could put your server in the DMZ....

I have found that each of the three "network" configurations behaves slightly differently from each other - single player, hosted multiplayer and dedicated server all have quirks but if you get it working correctly for the dedicated server then it should work correctly in either of the other two modes. Just thought I'd throw that out there - comes from fiddling with the RTS Prototype and an AI extension to it....
#4
04/05/2014 (2:01 pm)
@Richard: Would a DMZ work? That's an interesting idea...

I have a pretty basic router/modem though, it may not work...