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

In real-time multiplayer games that use UDP for the actual game (CS:S, UT, etc.), how is network latency (ping) measured? More specifically, how do you find out how long ago a UDP packet was sent?

Sorry if this is a dumb question, but I'm very new to network programming.

share|improve this question
Update: on the Quake 3 Networking Model page (…), there's a mention of unreliable acks. Would this be a good approach — send out a bunch of unreliable UDP packets, noting their sequence number, and then record (halve?) the round-trip time when an ack for a packet returns? – Archagon Feb 27 '12 at 18:50
up vote 6 down vote accepted

Just send some 'ping', write timestamp of that packet/session, wait for 'pong' response and get timestamp 'now' and divide the difference by two.

share|improve this answer
Thank you! In retrospect, this seems really obvious, but I'm really new to all this. :) – Archagon Feb 27 '12 at 19:00

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.