Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Hedos

ping?

This topic is 5237 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was wondering, the ping shown in most multiplayer game is the time between a packet can be sent from the client to the server or the time for a packet to be sent from the client to the server and then from the server to the client?

Share this post


Link to post
Share on other sites
Advertisement
Ping is usually the time it takes to get a response. This could depend on several things such as network traffic and server load ( ie it make take a little bit of time for the server to process the ping request ). If you want just the network time then it may be better to have the server time stamp the return ping message with the received and ack''d times and let the client do calculations based on that. Even then, though, it will take the server a little bit of time to process incomming network messages.

==============
Andrew

Share this post


Link to post
Share on other sites
>>If you want just the network time then it may be better to have the server time stamp the return ping message with the received and ack''d times and let the client do calculations based on that

The clocks on the two computers may not be synchronized so that doesn''t work...

Ping is the time it takes for a packet to go to the server and come back again.

Share this post


Link to post
Share on other sites
The clocks don''t need to be synchronized, they just need to run at the same speed (which most clocks do, more or less :-)

Here''s how it works:

1) client time-stamps the outgoing packet, at time C-130
2) server time-stamps the incoming packet, at time S-3440
3) server sends response packet at time S-3470; it puts the values "C-130," "S-3440" and "S-3470" into the return packet. (Actually, it only needs to put the value "30" which is the difference between the server timestamps, and the original client time)
4) client receives the return packet at time C-180

The client now knows that it sent a packet at time C-130, it received a packet at time C-180, and the server spent 30 time units processing the packet. Thus, (180-130-30) is the network round trip time (== 20) which makes the one-way propagation time (assuming symmetry) 10.

Share this post


Link to post
Share on other sites
Maybe i missunderstood but i was under the impression acraig was suggesting the time for the packet to reach the server could be calculated by taking the received time - sent time. Which would work in theory, but not if the clocks arn''t synchronised.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!