Skip to content

Commit ce485ae

Browse files
authored
fix(headless): Use ParticleSystemManager update instead of reset in headless replay (TheSuperHackers#2219)
1 parent 492d209 commit ce485ae

4 files changed

Lines changed: 14 additions & 16 deletions

File tree

Generals/Code/GameEngine/Source/GameClient/GameClient.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -745,14 +745,11 @@ void GameClient::step()
745745

746746
void GameClient::updateHeadless()
747747
{
748-
// TheSuperHackers @info helmutbuhler 03/05/2025
749-
// When we play a replay back in headless mode, we want to skip the update of GameClient
750-
// because it's not necessary for CRC checking.
751-
// But we do reset the particles. The problem is that particles can be generated during
752-
// GameLogic and are only cleaned up during rendering. If we don't clean this up here,
753-
// the particles accumulate and slow things down a lot and can even cause a crash on
754-
// longer replays.
755-
TheParticleSystemManager->reset();
748+
// TheSuperHackers @info helmutbuhler 03/05/2025 bobtista 02/02/2026
749+
// Update particles to prevent accumulation in headless mode. Particles are generated
750+
// during GameLogic and only cleaned up during rendering. update() lets particles finish
751+
// their lifecycle naturally instead of abruptly removing them with reset().
752+
TheParticleSystemManager->update();
756753
}
757754

758755
/** -----------------------------------------------------------------------------------------------

Generals/Code/Main/WinMain.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,9 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
826826
#endif
827827
// register windows class and create application window
828828
if(!TheGlobalData->m_headless && initializeAppWindows(hInstance, nCmdShow, TheGlobalData->m_windowed) == false)
829+
{
829830
return exitcode;
831+
}
830832

831833
// save our application instance for future use
832834
ApplicationHInstance = hInstance;

GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -783,14 +783,11 @@ void GameClient::step()
783783

784784
void GameClient::updateHeadless()
785785
{
786-
// TheSuperHackers @info helmutbuhler 03/05/2025
787-
// When we play a replay back in headless mode, we want to skip the update of GameClient
788-
// because it's not necessary for CRC checking.
789-
// But we do reset the particles. The problem is that particles can be generated during
790-
// GameLogic and are only cleaned up during rendering. If we don't clean this up here,
791-
// the particles accumulate and slow things down a lot and can even cause a crash on
792-
// longer replays.
793-
TheParticleSystemManager->reset();
786+
// TheSuperHackers @info helmutbuhler 03/05/2025 bobtista 02/02/2026
787+
// Update particles to prevent accumulation in headless mode. Particles are generated
788+
// during GameLogic and only cleaned up during rendering. update() lets particles finish
789+
// their lifecycle naturally instead of abruptly removing them with reset().
790+
TheParticleSystemManager->update();
794791
}
795792

796793
/** -----------------------------------------------------------------------------------------------

GeneralsMD/Code/Main/WinMain.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,9 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
873873

874874
// register windows class and create application window
875875
if(!TheGlobalData->m_headless && initializeAppWindows(hInstance, nCmdShow, TheGlobalData->m_windowed) == false)
876+
{
876877
return exitcode;
878+
}
877879

878880
// save our application instance for future use
879881
ApplicationHInstance = hInstance;

0 commit comments

Comments
 (0)