Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

When doing the net code for a video game what sort of latency targets and packet loss rates do you design around?

To be more specific I have my net code working local network only at the moment. I plan on using WANEM to simulate packet loss and latency but I am not sure what I should use for max and average values.

share|improve this question
1  
I'm hoping someone with more networking experience than me chimes in, but one thing to be aware of is the expected geography of your player base. The latency requirement for a LAN party game is different than something that runs for 8-16 random players over the Internet, is different than your global MMO hosted in Boston which gets connections from Taiwan. –  user744 Dec 19 '10 at 22:21
    
I suggest to try it out with two or more real internet connections instead of using simulation with guessed parameters. –  Hendrik Brummermann Dec 19 '10 at 23:24
    
@ Joe Wreschnig It is just me fooling around in my basement there is no expected player base. I was just wondering what were realistic targets to aim for. –  stonemetal Dec 20 '10 at 0:44
add comment

1 Answer

up vote 5 down vote accepted

Packet loss is hard to guess, but internet latency you should probably plan for up to ~750ms, though the vast majority will be under 500ms. The biggest outliers are Australia<->US pings and satellite internet. Depending on your target market maybe you can ignore those. If you are doing stuff for mobile devices it can be even more unpredictable. As a random guess for packet less I would say to plan for somewhere around 1-5% at the most, generally we see much less than that (~0.1% at the worst of times) and usually that is only on UK<->US links at peak hours (UK peak that is). The packet loss itself isn't a problem, but throw the transatlantic latency into the mix with TCP retransmission and you get a very jittery connection and can have trouble managing network buffers (this was for file transfers, for lower data rates I doubt this would be a problem).

share|improve this answer
1  
I'm no expert, but I usually test with far worse packetloss rates than that; 10-20% at the minimum. Once, I accidentally left the artificial packetloss in and demoed a game with 90% packetloss (it worked perfectly) ;) –  Martin Dec 20 '10 at 12:09
    
We have seen rare cases as high as 50%, but nothing worth testing for. I think the best (worst?) I can remember was a guy using wifi from several buildings over on a military base in the Honduran jungle (which then went over satellite for the backhaul). ~1000ms latency and 50% packet loss. In general windowing usually keeps TCP from sending too much once the link gets congested, so you just see a latency bump. UDP is another story, but you probably shouldn't use UDP for games these days. –  coderanger Dec 20 '10 at 17:11
1  
I always use UDP for games, but then that depends very much upon the kind of games you're making! –  Martin Dec 20 '10 at 19:24
    
No, it really doesn't. UDP has no place in gaming these days. People seem to think TCP has crazy overhead when it really doesn't as long as you set NODELAY. –  coderanger Dec 20 '10 at 20:23
add comment

Your Answer

 
discard

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.