Description

IGameMoviePlayer playback of a movie during loading screen lets you set bAllowEngineTick  = true as a parameter. This will make FDefaultGameMoviePlayer manually tick the engine:

 

if (GEngine && bAllowEngineTick && LoadingScreenAttributes.bAllowEngineTick)
{
    GEngine->Tick(DeltaTime, false);
} 

However, it does not update the timestamp that is used to calculcate DeltaSeconds during normal ticking, which LaunchEngineLoop calls with

GEngine->UpdateTimeAndHandleMaxTickRate() 

This results in a high value for FApp::GetDeltaTime() when the movie finishes playing and normal ticking resumes. FApp::GetDeltaTime() is used as delta seconds in FEngineLoop::Tick():

GEngine->Tick(FApp::GetDeltaTime(), bIdleMode); 

So this leads to an incorrect DeltaSeconds for systems that have ticked in the meantime.

The fix may be to call GEngine->UpdateTimeAndHandleMaxTickRate() inside FDefaultGameMoviePlayer. However, perhaps more logic from FEngineLoop::Tick() should also be handled when playing a movie. Logging this task so someone can properly evaluate this.

 

Steps to Reproduce
  • Print out FApp::GetDeltaTime() on tick when it's suspiciously high:

 

void AMyPlayerController::Tick(float DeltaSeconds)
{
    Super::Tick(DeltaSeconds);    if (FApp::GetDeltaTime() > 5.0f)
    {
        UE_LOG(LogTemp, Error, TEXT("AAA | Long FApp::GetDeltaTime: %.2f"), float(FApp::GetDeltaTime()));
    }
} 

 

  • Playback a movie during game, only works in non-PIE (standalone or build):

 

    // Manually bring up loading screen
    FLoadingScreenAttributes LoadingScreen;
    LoadingScreen.bAutoCompleteWhenLoadingCompletes = false;
    LoadingScreen.WidgetLoadingScreen = FLoadingScreenAttributes::NewTestLoadingScreenWidget();
    LoadingScreen.bAllowEngineTick = true;
    LoadingScreen.MoviePaths.Add("DummyMovie"); // Put a 10+ seconds long DummyMovie.mp4 in /Content/Movies
    LoadingScreen.bMoviesAreSkippable = false;
    GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
    GetMoviePlayer()->PlayMovie(); 
  • Observe: After the movie finishes, FApp::GetDeltaTime() returns a high value, the length of the movie. This causes some systems to receive a high DeltaSeconds despite that they have ticked in the meantime due to bAllowEngineTick == true.
  • Expected: Movie playback does not result in a high FApp::GetDeltaTime()

 

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-207172 in the post.

0
Login to Vote

Backlogged
ComponentUE - Gameplay
Affects Versions5.15.25.3
CreatedFeb 16, 2024
UpdatedSep 4, 2024
Pull Requests
12076 - m-grunwald
View Jira Issue