Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to test my Client/Server game for which, currently, I am using localhost for both Client and Server.

Obviously I'm not getting any fluctuation in data and measure idea of performance, and in other parameters, what I wanted to ask how I would test a real world scenario:

if i create a little network with two computers or

if check that on LAN on which i am or

Are these cases (localhost included) equivalent?

or do I really need to test my game on different LANs to have reliable and realistic testing data?

How these different network setups influence the testing process?

Can somebody please suggest methods for testing the effect of network latency and packet loss on my game?

which above setup will give me more up and downs in number with LEAST setup/implementing efforts.

The game is supposed to be played on a LAN but it IS capable of more.

share|improve this question
up vote 2 down vote accepted

Its hard to tell exactly what you're asking, but there's my thoughts.

When testing networking code, its perfectly acceptable to use localhost for both client and server to get it working, because its quick to debug and you can easily debug both client and server. It is important to note, that this is NOT sufficient for testing and final development.

In order for your testing to have maximum impact, you must test as many situations as you can. The minimum you can get away with are (IMO) these:

  1. One client and server on same computer
  2. One client and server on the same SUBNET
  3. One client and server on the same SUBNET with additional players from other SUBNETS (Internet, etc) connecting to server via NAT
  4. Server on the Internet and multiple additional Internet clients connected
share|improve this answer
thanks, i would appreciate discussion on one of the above scenarios as i have time constraints; testing on multiple/other setups would be difficult, the reason to ask question is to taking help selecting one, so i create that one setup , and then test on that. BY SUBNET you mean LAN? your case 2 > will this be d/f from localhost and will your 2 will be different from my 2 two computer network? – static void main May 30 '11 at 22:02
If I could only chose a single scenario to test, it would be #4. Because it will cover the most bases. You will need at least two computers to test this in an accurate to the real world way. – Nate May 30 '11 at 22:21
actually the 4 is blur to me FYI the game is for LAN means not online/not http based."You will need at least two computers to test this in an accurate to the real world way" yes definitely,you didn't answer my all question, how will you take this if two computer are like this and server, for me it's on same LAN.. DO you have same meanings for subnet, what about if my server is on then it will be on d/f LANs. – static void main May 30 '11 at 22:31
Those IPs are routable, so in my mind, that is the Internet. What I mean. The information that you get from test #4 is that you know your application will work when its being routed. This is typically the weak link in networking code because it introduces more packet loss and latency. – Nate May 30 '11 at 22:41
what i got you mean this kind of test is enough:client and server, (because for me it's on same LAN..) no need to go for using other LAN i.e Server is on e.g – static void main May 30 '11 at 22:55

You can download software emulators that will artifically add packet loss, network latency, and whatever else you might like into the connection. On reflection, I actually don't know where to get these packages, but I know that they do exist.

share|improve this answer
See… for one option which needs a spare PC with two network connections. – Adam May 30 '11 at 23:04

Local Host:
All the network testing I've done on localhost has been completely misleading. Since it's a perfect environment it's useless...

Packet Loss:
The packet loss and latency you experience will differ based on your current lan set up. I've set up on several separate routers, and gotten completely different results.

It would be horrifically slow to compile, throw the executable elsewhere, recompile (in the beginning, before menus and such) run it on your compie, and connect, then test. What I've done lately is have a persistant server (on another computer) that simply forwards whatever is sent over any port to a partner, and set my program up as a client, so there's no further config necessary. It's a path that's treated me well so far.

share|improve this answer
"All the network testing I've done on localhost has been completely misleading. Since it's a perfect environment it's useless... "agreed that's why i am doing this =), im confused by these networking terminologies different subnets, LANs and now routers, no time to revised them – static void main May 30 '11 at 22:59
When you use the 'localhost' loopback the data you send doesn't go throught the entire Network Card, it stops at the Network layer and hence all the extra time needed for the Data Link and Physical Layers, and then the time needed to go through cables, etc. is obviously not represented. If you really want to put you program through it's paces, find a helpful soul that lives on the other side of the world, and see how your Client/Server fares. – Jonathan Connell May 31 '11 at 7:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.