# Comparing two signal outputs from two clients on a networked computer game to identify lag

Basically, I'm running a server and two clients of the Unreal Engine and trying to figure out if there is lag in player movement on one of the clients (the clients are different in way that's not important). For each client I am sampling the (X,Y,Z) location in world space every frame. Here's a sample from one player of frames 577-580:

[0037.70] ScriptLog: @@ player  577  Loc  -262.53,565.64,79.15
[0037.71] ScriptLog: @@ player  578  Loc  -261.30,563.43,79.15
[0037.72] ScriptLog: @@ player  579  Loc  -260.14,561.10,79.15
[0037.73] ScriptLog: @@ player  580  Loc  -259.15,558.78,79.15


X,Y,Z are independent. So, I have this data for two players and one player does not have lag, and so serves as the reference signal. However the second player is visibly laggy. I think a good informal definition of lag would be "large values between consecutive frames", but how do I make this notion a little bit more rigorous and also testable in a signal sense?

Here's an image of the x coordinate of the two signals. The blue player is the normal player, and the red player is the laggy player.

Edit: I'm not looking for the time delay between the two signals. Player 2 is programmed to follow Player 1 only to ensure that the trends are the same. If you zoom into the graph above, you can see that the blue line is smooth and the red line is jagged. It's the "relative jaggedness" of the red line that I want to quantify and test.

I should also mention the goal is to identify lag so that the game can start running alternative emergency routines to mitigate the lag.

• You might try cross-correlating the two waveforms (like those shown in your plot). You should see a spike in the magnitude of the correlation. The delay value associated with that spike would be commensurate with the lag that you're estimating. – Jason R Jun 24 '14 at 19:24
• @JasonR No sorry, the time shift is known. I forgot to mention one player is programmed to follow the other. It's not an estimation of the time delay that I want. If you zoom into the image, you see the blue line is smooth, and the red line is jagged. The "relative jaggedness" of the red line is what i want to test. I've already started reviewing my statistics textbooks from my school days, but I was hoping to get some guidance from some who actually knows what they're doing :) – user10310 Jun 25 '14 at 1:59