Netplay TimeSync: Forgot to take the absolute value

This commit is contained in:
HeatXD 2023-04-14 02:09:29 +02:00
parent f7e5dfe13a
commit fb47a2be44
No known key found for this signature in database
GPG Key ID: BF30D71B2F1305C7
1 changed files with 3 additions and 4 deletions

View File

@ -199,14 +199,13 @@ void Netplay::UpdateThrottlePeriod()
void Netplay::HandleTimeSyncEvent(float frame_delta, int update_interval)
{
// we need a threshold since sub frame values are not worth correcting for.
if (frame_delta <= 1.0f)
// we need a threshold since low advantage frames values are not worth correcting for.
if (std::abs(frame_delta) <= 1.0f)
return;
float total_time = frame_delta * s_frame_period;
// Distribute the frame difference over the next N * 0.8 frames.
// only part of the interval time is used since we want to come back to normal speed.
// otherwise we will keep spiraling into unplayable gameplay.
float total_time = frame_delta * s_frame_period;
float added_time_per_frame = -(total_time / (static_cast<float>(update_interval) * 0.8f));
float iterations_per_frame = 1.0f / s_frame_period;