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.

  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – user744
    Dec 19, 2010 at 22:21
  • \$\begingroup\$ I suggest to try it out with two or more real internet connections instead of using simulation with guessed parameters. \$\endgroup\$ Dec 19, 2010 at 23:24
  • \$\begingroup\$ @ 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. \$\endgroup\$
    – stonemetal
    Dec 20, 2010 at 0:44

1 Answer 1


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).

  • 1
    \$\begingroup\$ 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) ;) \$\endgroup\$
    – Martin
    Dec 20, 2010 at 12:09
  • \$\begingroup\$ 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. \$\endgroup\$
    – coderanger
    Dec 20, 2010 at 17:11
  • 3
    \$\begingroup\$ I always use UDP for games, but then that depends very much upon the kind of games you're making! \$\endgroup\$
    – Martin
    Dec 20, 2010 at 19:24
  • \$\begingroup\$ 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. \$\endgroup\$
    – coderanger
    Dec 20, 2010 at 20:23
  • 2
    \$\begingroup\$ @coderanger It's about latency. Sometimes, if a packet is lost, you don't want to wait a whole ping time to resend it! Sometimes you just want to forget about the lost packet and send the next packet anyway. Remember, 100ms latency is noticeable on a fast-paced shooter, and TCP's reliability could cause spikes of up to a second. \$\endgroup\$
    – user253751
    Mar 20, 2015 at 1:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .