Bug with GameState ElapsedTime with Time Dilation (slomo)

GetWorldTimerManager().SetTimer(TimerHandle_DefaultTimer, this, &AGameState::DefaultTimer, GetWorldSettings()->GetEffectiveTimeDilation() / GetWorldSettings()->DemoPlayTimeDilation, true);

just set the interval to 1.0f, the time dilation is already applied at a global scope including to the timer manager by UWorld::Tick(). Multiple changes have been made to this line and they’ve all been wrong, the one released in 4.10 actually amplified the time dilation drastically, and the version currently in GitHub is wrong again, reverting partially to the older behavior which ticks ElapsedTime at the same pace as real time, except with demo dilation amplified now.

Hey -

Where are you seeing the code that you’re referring to? Can you explain how you’re using the code and what exactly you’re seeing when you do? Please be sure to list the steps in your setup so that I can ensure I am getting the same results.


Sorry, I’ll elaborate on the issue. The bug is in the engine’s GameState.cpp and causes the match elapsed time to advance at an inappropriate rate.

  1. Make a simple project that prints out the GameState::ElapsedTime and has a match start to satisfy IsMatchInProgress()
  2. Start a game and note that the time ticks at a pace of 1 game second per 1 real second
  3. Open console and type “slomo 5”
  4. Note that the elapsed time ticks at a pace of 20+ game seconds per 1 real second (instead of 5)
  5. Open console and type “slomo 0.5”
  6. Note that the elapsed time ticks at a pace of roughly 1 game second per 5 real seconds (instead of 2)

slomo is a useful command for testing game mechanics which take time to complete, but this bug causes a time-limited match to end much too quickly compared with the rate of everything else ticking. The repro above is from 4.10, although in 4.8 it had a different bug which caused slomo to have no effect at all on match elapsed time. My recommended fix is to just set the GameState DefaultTimer “rate” to 1.0f instead of trying to mix time dilation into it, since time dilation is factored into the world timer-manager.

The behavior you mentioned was present on 4.10.2 however this has been fixed in the 4.11 preview. You should be able to use Elapsed Time as expected in the 4.11 preview 4 on the Launcher or from source code on GitHub.