Game Networking (3) - RTT, PING, latency, lag

Daposto
3 min readJul 2, 2020

--

These terms are very nice, they mean different things in different fields. So lets carefully examine them.

Round Trip Time (RTT)

The following definition is taken from Development and Deployment of Multiplayer Online Games, Vol. I.

Round-trip time (RTT) is the duration in milliseconds (ms) it takes for a network request to go from a starting point to a destination and back again to the starting point. RTT is an important metric in determining the health of a connection. Ping can be used to measure the RTT.

Let’s note that while RTT depends greatly on the player’s ISP (and especially on the “last mile” connection), even in a very ideal case, there are hard limits on “how low you can go with regards to RTT.” Very roughly, for RTT and, depending on the player’s location, you can expect the ballpark numbers shown in Table 3.1 (assuming the very best ISPs, etc. Getting worse is easy; getting significantly better is usually not exactly realistic):

In addition, we need to account for a player’s “last mile,” as described in Table 3.2:

Furthermore, RTT is a very important metric when it comes to estimating certain values for client-to-server.

More

Ping

There are two ways you can interpret ping. First, it can represent a request for RTT by a network utility that uses ICMP packets for this. Secondly as an implementation on the application layer. This takes into account the processing time for example additional processing delay produced by higher-level protocols and applications (e.g. HTTPS). The second one is the one used in games.

Latency & Lag

Network latency is the term used to indicate any kind of delay that happens in data communication over a network.- techopedia

First I was confused because some people like to talk about latency in terms of delay time between client to server or from client to server and back. I came to realize that my perspective, were latency only was the complete RTT, was wrong and that it can be both just depending on the way your using it. Latency is not restricted to networking but is the hidden evil everywhere.

Latency can either be measured as the Round Trip Time (RTT) or the Time to First Byte (TTFB):

  • RTT is defined as the amount of time it takes a packet to get from the client to the server and back (see above).
  • TTFB is the amount of time it takes for the server to receive the first byte of data when the client sends a request.

Many factors like serializing, compressing may affect the latency of a service. One can use tools like tracert/ping/application layer utility to detect latency. Just as we mentioned above, this will be the application layer most of the time. It is important that one checks the latency regularly because it might change at any moment.

Latency is quite an important metric, and many networking models are heavily relying on a correct latency calculation. Like deterministic lockstep/command-model. For example, it can be used to speed up/down a simulation, disconnect slow users.

part 0 (intro)
part 1 (Interval and ticks)
part 2 (Time, Tick, Clock Synchronisation)
part 3 (RTT, PING, latency, lag)
part 4 (Client-Side Extrapolation a.k.a. Dead Reckoning/ Interpolation)
part 5 (Compression, delta encoding, interest management, bit packing)
part 6 (Event, Input, Command Ring/Buffer/priority/Queue)
part 7 (Deterministic vs State)
part 8 (Present, past future where am I)
part 9 (Bonus, Overwatch Model)

--

--

Daposto
Daposto

Written by Daposto

Programmer, problem solver, learning everyday. I write about anything mainly to straighten my own thoughts.

No responses yet