From a6111ff8b723f4432edeb4363d494fb1ecd45a2d Mon Sep 17 00:00:00 2001 From: JoshuaJB Date: Sat, 31 Oct 2015 21:04:47 +0000 Subject: [PATCH] Fix #3309 by capping m_DeltaSimTime in NetTurnManager.cpp. Patch by elexis. Review by Philip. This was SVN commit r17159. --- source/network/NetTurnManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/network/NetTurnManager.cpp b/source/network/NetTurnManager.cpp index e241752b8a..b7774ebfdb 100644 --- a/source/network/NetTurnManager.cpp +++ b/source/network/NetTurnManager.cpp @@ -104,6 +104,11 @@ bool CNetTurnManager::Update(float simFrameLength, size_t maxTurns) { m_DeltaSimTime += simFrameLength; + // If the game becomes laggy, m_DeltaSimTime increases progressively. + // The engine will fast forward accordingly to catch up. + // To keep the game playable, stop fast forwarding after 2 turn lengths. + m_DeltaSimTime = std::min(m_DeltaSimTime, 2.0f * m_TurnLength / 1000.0f); + // If we haven't reached the next turn yet, do nothing if (m_DeltaSimTime < 0) return false;