Disabled clock correction, not stable enough

This commit is contained in:
Kamay Xutax 2024-08-24 14:17:13 +02:00
parent 7a92c3afde
commit 4cf14a0939
2 changed files with 43 additions and 19 deletions

View file

@ -517,8 +517,29 @@ void CL_ReadPackets ( bool bFinalTick )
return;
// update client times/tick
if (!CClockDriftMgr::IsClockCorrectionEnabled())
{
cl.oldtickcount = cl.GetServerTickCount();
}
// Moved after process socket so we can receive the lastest updates.
if ( !cl.IsPaused() )
{
// While clock correction is off, we have the old behavior of matching the client and server clocks.
if (!CClockDriftMgr::IsClockCorrectionEnabled())
{
cl.SetClientTickCount(cl.GetClientTickCount() + 1);
cl.SetServerTickCount(cl.GetClientTickCount());
g_ClientGlobalVariables.tickcount = cl.GetClientTickCount();
g_ClientGlobalVariables.curtime = cl.GetTime();
}
}
if (!CClockDriftMgr::IsClockCorrectionEnabled())
{
// 0 or tick_rate if simulating
g_ClientGlobalVariables.frametime = cl.GetFrameTime();
}
// read packets, if any in queue
if ( demoplayer->IsPlayingBack() && cl.m_NetChannel )
@ -562,25 +583,28 @@ void CL_ReadPackets ( bool bFinalTick )
}
#endif
if (CClockDriftMgr::IsClockCorrectionEnabled())
{
cl.oldtickcount = cl.GetServerTickCount();
}
// Moved after process socket so we can receive the lastest updates.
if ( !cl.IsPaused() )
{
// While clock correction is off, we have the old behavior of matching the client and server clocks.
if (!CClockDriftMgr::IsClockCorrectionEnabled())
{
cl.SetClientTickCount(cl.GetClientTickCount() + 1);
cl.SetServerTickCount(cl.GetClientTickCount());
}
else
if (CClockDriftMgr::IsClockCorrectionEnabled())
{
cl.m_ClockDriftMgr.IncrementCachedTickCount(bFinalTick);
}
g_ClientGlobalVariables.tickcount = cl.GetClientTickCount();
g_ClientGlobalVariables.curtime = cl.GetTime();
}
}
if (CClockDriftMgr::IsClockCorrectionEnabled())
{
// 0 or tick_rate if simulating
g_ClientGlobalVariables.frametime = cl.GetFrameTime();
}
}

View file

@ -11,7 +11,7 @@
#include "enginethreads.h"
ConVar cl_clock_correction( "cl_clock_correction", "1", FCVAR_CHEAT, "Enable/disable clock correction on the client." );
ConVar cl_clock_correction( "cl_clock_correction", "0", FCVAR_CHEAT, "Enable/disable clock correction on the client." );
ConVar cl_clockdrift_max_ms( "cl_clockdrift_max_ms", "150", FCVAR_CHEAT, "Maximum number of milliseconds the clock is allowed to drift before the client snaps its clock to the server's." );
ConVar cl_clockdrift_max_ms_threadmode( "cl_clockdrift_max_ms_threadmode", "0", FCVAR_CHEAT, "Maximum number of milliseconds the clock is allowed to drift before the client snaps its clock to the server's." );