diff --git a/Core/GameEngine/Include/GameNetwork/NetworkInterface.h b/Core/GameEngine/Include/GameNetwork/NetworkInterface.h index b137260ecfa..fe8ad376095 100644 --- a/Core/GameEngine/Include/GameNetwork/NetworkInterface.h +++ b/Core/GameEngine/Include/GameNetwork/NetworkInterface.h @@ -64,6 +64,7 @@ class NetworkInterface : public SubsystemInterface virtual void parseUserList( const GameInfo *game ) = 0; ///< Parse a userlist, creating connections virtual void startGame() = 0; ///< Sets the network game frame counter to -1 virtual UnsignedInt getRunAhead() = 0; ///< Get the current RunAhead value + virtual UnsignedInt getBufferedFramesAvailable() = 0; virtual UnsignedInt getFrameRate() = 0; ///< Get the current allowed frame rate. virtual UnsignedInt getPacketArrivalCushion() = 0; ///< Get the smallest packet arrival cushion since this was last called. diff --git a/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp b/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp index 8f4cf72c56f..b217b8b93e1 100644 --- a/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp +++ b/Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp @@ -857,7 +857,7 @@ void GameSpyStagingRoom::launchGame() GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME ); msg->appendIntegerArgument(GAME_INTERNET); - TheWritableGlobalData->m_useFpsLimit = false; + // TheWritableGlobalData->m_useFpsLimit = false; // GeneralsX @bugfix fbraz3 21/07/2026 Keep FPS limiter active in multiplayer to avoid rendering at uncapped 500+ FPS // Set the seeds InitRandom( getSeed() ); diff --git a/Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp b/Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp index 2445271916f..d1ec177a2a8 100644 --- a/Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp +++ b/Core/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp @@ -255,7 +255,7 @@ void LANAPI::OnGameStart() GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME ); msg->appendIntegerArgument(GAME_LAN); - TheWritableGlobalData->m_useFpsLimit = false; + // TheWritableGlobalData->m_useFpsLimit = false; // GeneralsX @bugfix fbraz3 21/07/2026 Keep FPS limiter active in multiplayer to avoid rendering at uncapped 500+ FPS // Set the seeds InitRandom( m_currentGame->getSeed() ); diff --git a/Core/GameEngine/Source/GameNetwork/Network.cpp b/Core/GameEngine/Source/GameNetwork/Network.cpp index f45ff04812f..eb5b1b58516 100644 --- a/Core/GameEngine/Source/GameNetwork/Network.cpp +++ b/Core/GameEngine/Source/GameNetwork/Network.cpp @@ -113,6 +113,7 @@ class Network : public NetworkInterface virtual void setLocalAddress(UnsignedInt ip, UnsignedInt port) override; virtual UnsignedInt getRunAhead() override { return m_runAhead; } + virtual UnsignedInt getBufferedFramesAvailable() override; virtual UnsignedInt getFrameRate() override { return m_frameRate; } virtual UnsignedInt getPacketArrivalCushion() override; ///< Returns the smallest packet arrival cushion since this was last called. virtual Bool isFrameDataReady() override; @@ -589,6 +590,16 @@ Bool Network::AllCommandsReady(UnsignedInt frame) { return m_conMgr->allCommandsReady(frame);// && m_conMgr->allCRCsReady(frame); } +UnsignedInt Network::getBufferedFramesAvailable() { + UnsignedInt currentFrame = TheGameLogic->getFrame(); + UnsignedInt readyCount = 0; + // Limit the search so we don't loop forever if network is somehow way ahead + while(AllCommandsReady(currentFrame + readyCount) && readyCount < 100) { + readyCount++; + } + return readyCount; +} + /** * Take commands from the connection manager and put them on TheCommandList. * The commands need to be put on in the same order across all clients. diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp index 708f90ce5cc..c150e674fea 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp @@ -560,7 +560,7 @@ void GameSpyLaunchGame() GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME ); msg->appendIntegerArgument(GAME_INTERNET); - TheGlobalData->m_useFpsLimit = false; + // TheGlobalData->m_useFpsLimit = false; // GeneralsX @bugfix fbraz3 21/07/2026 Keep FPS limiter active in multiplayer to avoid rendering at uncapped 500+ FPS // Set the random seed InitGameLogicRandom( TheGameSpyGame->getSeed() ); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 13c61210fa8..857d7fe08f8 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1241,7 +1241,11 @@ void W3DDisplay::gatherDebugStats() } #endif - fpsString.format( L"FPS: %.2f", fps); + if (TheNetwork != nullptr) { + fpsString.format( L"FPS: %.2f (Buf: %d)", fps, TheNetwork->getBufferedFramesAvailable() ); + } else { + fpsString.format( L"FPS: %.2f", fps); + } m_benchmarkDisplayString->setText( fpsString ); Int polyPerFrame = Debug_Statistics::Get_DX8_Polygons(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp index b8386b756e2..e9c211c8258 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpyGameInfo.cpp @@ -560,7 +560,7 @@ void GameSpyLaunchGame() GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME ); msg->appendIntegerArgument(GAME_INTERNET); - TheGlobalData->m_useFpsLimit = false; + // TheGlobalData->m_useFpsLimit = false; // GeneralsX @bugfix fbraz3 21/07/2026 Keep FPS limiter active in multiplayer to avoid rendering at uncapped 500+ FPS // Set the random seed InitGameLogicRandom( TheGameSpyGame->getSeed() ); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 2974a4c2611..5978e1832bf 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -1313,7 +1313,11 @@ void W3DDisplay::gatherDebugStats() } #endif - fpsString.format( L"FPS: %.2f", fps); + if (TheNetwork != nullptr) { + fpsString.format( L"FPS: %.2f (Buf: %d)", fps, TheNetwork->getBufferedFramesAvailable() ); + } else { + fpsString.format( L"FPS: %.2f", fps); + } m_benchmarkDisplayString->setText( fpsString ); Int polyPerFrame = Debug_Statistics::Get_DX8_Polygons();