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.