From f2257df11fd586a5fcde12277ee8f54c945c39a1 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 28 Sep 2025 12:05:34 +0200 Subject: [PATCH 1/2] tweak(camera): Decouple camera zoom update from logic time --- .../Source/W3DDevice/GameClient/W3DView.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index c4e2216567..a8b8d3474e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1355,7 +1355,8 @@ void W3DView::update(void) // if scrolling, only adjust if we're too close or too far if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround)) { - Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) // only do positive { m_zoom += zoomAdj; @@ -1366,7 +1367,8 @@ void W3DView::update(void) else if (!didScriptedMovement) { // we're not scrolling; settle toward desired height above ground - Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) { m_zoom -= zoomAdj; From ae587642a334b7f3d0eeb64d7bb6d60413738fe5 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 19:45:52 +0200 Subject: [PATCH 2/2] Replicate in Generals --- .../Source/W3DDevice/GameClient/W3DView.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 5e80699000..31e10ef8f5 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -1206,7 +1206,8 @@ void W3DView::update(void) // if scrolling, only adjust if we're too close or too far if (m_scrollAmount.length() < m_scrollAmountCutoff || (m_currentHeightAboveGround < m_minHeightAboveGround) || (TheGlobalData->m_enforceMaxCameraHeight && m_currentHeightAboveGround > m_maxHeightAboveGround)) { - Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomAdj = (desiredZoom - m_zoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) // only do positive { m_zoom += zoomAdj; @@ -1217,7 +1218,8 @@ void W3DView::update(void) else if (!didScriptedMovement) { // we're not scrolling; settle toward desired height above ground - Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * TheGameEngine->getActualLogicTimeScaleOverFpsRatio(); + const Real fpsRatio = (Real)BaseFps / TheGameEngine->getUpdateFps(); + const Real zoomAdj = (m_zoom - desiredZoom) * TheGlobalData->m_cameraAdjustSpeed * fpsRatio; if (fabs(zoomAdj) >= 0.0001f) { m_zoom -= zoomAdj;