File tree Expand file tree Collapse file tree 10 files changed +40
-6
lines changed
Source/GameClient/MessageStream
Include/W3DDevice/GameClient
Source/W3DDevice/GameClient
Source/GameClient/MessageStream
Include/W3DDevice/GameClient
Source/W3DDevice/GameClient Expand file tree Collapse file tree 10 files changed +40
-6
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ class Display : public SubsystemInterface
180
180
virtual void setCinematicTextFrames ( Int frames ) { m_cinematicTextFrames = frames; }
181
181
182
182
virtual Real getAverageFPS ( void ) = 0; // /< returns the average FPS.
183
+ virtual Real getCurrentFPS ( void ) = 0; // /< returns the current FPS.
183
184
virtual Int getLastFrameDrawCalls ( void ) = 0; // /< returns the number of draw calls issued in the previous frame
184
185
185
186
protected:
Original file line number Diff line number Diff line change @@ -471,6 +471,14 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
471
471
break ;
472
472
}
473
473
474
+ // TheSuperHackers @bugfix Mauller 07/06/2025 Adjust the viewport scrolling so it is independent of gameClient FPS
475
+ // The scaling is based on the logic rate of 30 FPS, this provides a consistent scroll speed at all gameCLient FPS
476
+ // This also fixes scrolling within replays when fast forwarding due to the uncapped FPS
477
+ // When the FPS is in excess of the expected frame rate, the ratio will reduce the offset of the cameras movement
478
+ Real logicToFpsRatio = LOGICFRAMES_PER_SECONDS_REAL / TheDisplay->getCurrentFPS ();
479
+ offset.x *= logicToFpsRatio;
480
+ offset.y *= logicToFpsRatio;
481
+
474
482
TheInGameUI->setScrollAmount (offset);
475
483
TheTacticalView->scrollBy ( &offset );
476
484
}
Original file line number Diff line number Diff line change @@ -145,7 +145,8 @@ class W3DDisplay : public Display
145
145
static W3DAssetManager *m_assetManager; // /< W3D asset manager
146
146
147
147
void drawFPSStats ( void ); // /< draw the fps on the screen
148
- virtual Real getAverageFPS ( void ); // /< return the average FPS.
148
+ virtual Real getAverageFPS ( void ); // /< return the average FPS.
149
+ virtual Real getCurrentFPS ( void ); // /< return the current FPS.
149
150
virtual Int getLastFrameDrawCalls ( void ); // /< returns the number of draw calls issued in the previous frame
150
151
151
152
protected:
@@ -166,6 +167,7 @@ class W3DDisplay : public Display
166
167
IRegion2D m_clipRegion; // /< the clipping region for images
167
168
Bool m_isClippedEnabled; // /<used by 2D drawing operations to define clip re
168
169
Real m_averageFPS; // /<average fps over the last 30 frames.
170
+ Real m_currentFPS; // /<current fps value.
169
171
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
170
172
Int64 m_timerAtCumuFPSStart;
171
173
#endif
Original file line number Diff line number Diff line change @@ -832,8 +832,8 @@ void W3DDisplay::updateAverageFPS(void)
832
832
if (historyOffset >= FPS_HISTORY_SIZE)
833
833
historyOffset = 0 ;
834
834
835
- double currentFPS = 1.0 /elapsedSeconds;
836
- fpsHistory[historyOffset++] = currentFPS ;
835
+ m_currentFPS = 1.0 /elapsedSeconds;
836
+ fpsHistory[historyOffset++] = m_currentFPS ;
837
837
numSamples++;
838
838
if (numSamples > FPS_HISTORY_SIZE)
839
839
numSamples = FPS_HISTORY_SIZE;
@@ -1559,6 +1559,11 @@ Real W3DDisplay::getAverageFPS()
1559
1559
return m_averageFPS;
1560
1560
}
1561
1561
1562
+ Real W3DDisplay::getCurrentFPS ()
1563
+ {
1564
+ return m_currentFPS;
1565
+ }
1566
+
1562
1567
Int W3DDisplay::getLastFrameDrawCalls ()
1563
1568
{
1564
1569
return Debug_Statistics::Get_Draw_Calls ();
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ class GUIEditDisplay : public Display
126
126
#endif
127
127
128
128
virtual Real getAverageFPS (void ) { return 0 ; }
129
+ virtual Real getCurrentFPS (void ) { return 0 ; }
129
130
virtual Int getLastFrameDrawCalls ( void ) { return 0 ; }
130
131
131
132
protected:
Original file line number Diff line number Diff line change @@ -181,6 +181,7 @@ class Display : public SubsystemInterface
181
181
virtual void setCinematicTextFrames ( Int frames ) { m_cinematicTextFrames = frames; }
182
182
183
183
virtual Real getAverageFPS ( void ) = 0; // /< returns the average FPS.
184
+ virtual Real getCurrentFPS ( void ) = 0; // /< returns the current FPS.
184
185
virtual Int getLastFrameDrawCalls ( void ) = 0; // /< returns the number of draw calls issued in the previous frame
185
186
186
187
protected:
Original file line number Diff line number Diff line change @@ -470,6 +470,14 @@ GameMessageDisposition LookAtTranslator::translateGameMessage(const GameMessage
470
470
break ;
471
471
}
472
472
473
+ // TheSuperHackers @bugfix Mauller 07/06/2025 Adjust the viewport scrolling so it is independent of gameClient FPS
474
+ // The scaling is based on the logic rate of 30 FPS, this provides a consistent scroll speed at all gameCLient FPS
475
+ // This also fixes scrolling within replays when fast forwarding due to the uncapped FPS
476
+ // When the FPS is in excess of the expected frame rate, the ratio will reduce the offset of the cameras movement
477
+ Real logicToFpsRatio = LOGICFRAMES_PER_SECONDS_REAL / TheDisplay->getCurrentFPS ();
478
+ offset.x *= logicToFpsRatio;
479
+ offset.y *= logicToFpsRatio;
480
+
473
481
TheInGameUI->setScrollAmount (offset);
474
482
TheTacticalView->scrollBy ( &offset );
475
483
}
Original file line number Diff line number Diff line change @@ -146,7 +146,8 @@ class W3DDisplay : public Display
146
146
static W3DAssetManager *m_assetManager; // /< W3D asset manager
147
147
148
148
void drawFPSStats ( void ); // /< draw the fps on the screen
149
- virtual Real getAverageFPS ( void ); // /< return the average FPS.
149
+ virtual Real getAverageFPS ( void ); // /< return the average FPS.
150
+ virtual Real getCurrentFPS ( void ); // /< return the current FPS.
150
151
virtual Int getLastFrameDrawCalls ( void ); // /< returns the number of draw calls issued in the previous frame
151
152
152
153
protected:
@@ -167,6 +168,7 @@ class W3DDisplay : public Display
167
168
IRegion2D m_clipRegion; // /< the clipping region for images
168
169
Bool m_isClippedEnabled; // /<used by 2D drawing operations to define clip re
169
170
Real m_averageFPS; // /<average fps over the last 30 frames.
171
+ Real m_currentFPS; // /<current fps value.
170
172
#if defined(RTS_DEBUG) || defined(RTS_INTERNAL)
171
173
Int64 m_timerAtCumuFPSStart;
172
174
#endif
Original file line number Diff line number Diff line change @@ -899,8 +899,8 @@ void W3DDisplay::updateAverageFPS(void)
899
899
if (historyOffset >= FPS_HISTORY_SIZE)
900
900
historyOffset = 0 ;
901
901
902
- double currentFPS = 1.0 /elapsedSeconds;
903
- fpsHistory[historyOffset++] = currentFPS ;
902
+ m_currentFPS = 1.0 /elapsedSeconds;
903
+ fpsHistory[historyOffset++] = m_currentFPS ;
904
904
numSamples++;
905
905
if (numSamples > FPS_HISTORY_SIZE)
906
906
numSamples = FPS_HISTORY_SIZE;
@@ -1647,6 +1647,11 @@ Real W3DDisplay::getAverageFPS()
1647
1647
return m_averageFPS;
1648
1648
}
1649
1649
1650
+ Real W3DDisplay::getCurrentFPS ()
1651
+ {
1652
+ return m_currentFPS;
1653
+ }
1654
+
1650
1655
Int W3DDisplay::getLastFrameDrawCalls ()
1651
1656
{
1652
1657
return Debug_Statistics::Get_Draw_Calls ();
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ class GUIEditDisplay : public Display
126
126
#endif
127
127
128
128
virtual Real getAverageFPS (void ) { return 0 ; }
129
+ virtual Real getCurrentFPS (void ) { return 0 ; }
129
130
virtual Int getLastFrameDrawCalls ( void ) { return 0 ; }
130
131
131
132
protected:
You can’t perform that action at this time.
0 commit comments