The serverTime a client attaches to a usercmd appears to be slightly lagged depending on client fps. This is because cl.serverTime is calculated by CL_SetCGameTime() AFTER the call to CL_SendCmd() but BEFORE the call to SCR_UpdateScreen(). Simply moving up the call to CL_SetCGameTime() a few lines seems to correct this.
The amount of lag depends on the rendering FPS on the client: the less frames rendered between cmds the smaller the lag. e.g. a client rendering only 20fps may have serverTime lagged by up to 50ms, but one rendering 100fps may only have serverTime lagged by 10ms.
To the existing game code this doesn't make a difference since it only uses the delta in serverTime between two commands, but it does make a difference to Unlagged since the exact value of serverTime is used for backward reconciliation of client position. I think is why cg_cmdTimeNudge exists in Neil's Unlagged code.
Created attachment 1142[details]
svn965 serverTime
Last patch may have put the serverTime too far ahead. This patch moves the CL_SendCmd() call to immediately after the SCR_UpdateScreen() call instead of moving the CL_SetCGameTime() call. This should ensure that the cmd is sent with the rendered serverTime as closely as possible to when that frame was rendered (in the same CL_Frame() call).
Created attachment 1150[details]
svn973 serverTime
After more testing it appears just calling CL_SetCGameTime() prior to CL_SendCmd() is not _enough_. Adding the cls.frametime too seems like the most accurate time so far. This is through trial and error more than understanding the timing problem, so I'll try come up with a better explaination eventually.
OK, this bug appears to be invalid. The ucmd->serverTime does appear to be lagging the real serverTime, but it is by the time of one server frame (usually 50ms). I think this is normal/expected. See "built-in 50ms lag" at:
http://axon.cs.byu.edu/~josh/unlagged/docs/README.html
ucmd->serverTime just needs to be adjusted in the game code.
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.
--ryan.
Created attachment 1140 [details] svn963 more accurate serverTime for ucmd
Created attachment 1142 [details] svn965 serverTime Last patch may have put the serverTime too far ahead. This patch moves the CL_SendCmd() call to immediately after the SCR_UpdateScreen() call instead of moving the CL_SetCGameTime() call. This should ensure that the cmd is sent with the rendered serverTime as closely as possible to when that frame was rendered (in the same CL_Frame() call).
Created attachment 1150 [details] svn973 serverTime After more testing it appears just calling CL_SetCGameTime() prior to CL_SendCmd() is not _enough_. Adding the cls.frametime too seems like the most accurate time so far. This is through trial and error more than understanding the timing problem, so I'll try come up with a better explaination eventually.