MaxUndilatedFrameTime

MaxUndilatedFrameTime

#Overview

name: MaxUndilatedFrameTime

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MaxUndilatedFrameTime is to set an upper limit on the frame time in Unreal Engine’s game loop, regardless of time dilation effects. It represents the maximum allowable time between frames, effectively capping the slowest frame rate the engine will process.

This setting variable is primarily used by the Engine’s core timing and rendering systems. It’s particularly relevant in the MovieRenderPipeline plugin, which is part of Unreal Engine’s cinematic rendering toolset.

The value of MaxUndilatedFrameTime is typically set in the WorldSettings object, which is a part of each level in an Unreal Engine game. It can be configured through the editor or programmatically.

MaxUndilatedFrameTime interacts closely with MinUndilatedFrameTime, which sets the lower bound for frame time. Together, these variables define the acceptable range for frame times in the engine.

Developers should be aware that:

  1. This variable directly affects the engine’s frame rate limits.
  2. It’s used in time-critical operations, such as timeline components and movie rendering.
  3. Modifying this value can impact game performance and visual smoothness.

Best practices when using this variable include:

  1. Setting it in conjunction with MinUndilatedFrameTime to define a reasonable frame time range.
  2. Considering the target platforms and their capabilities when setting this value.
  3. Being cautious when modifying it during runtime, as it can affect game behavior and performance.
  4. Using it judiciously in movie rendering scenarios to control frame timing precisely.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseGame.ini:182, section: [/Script/Engine.WorldSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/MovieGraphCoreTimeStep.cpp:704

Scope (from outer to inner):

file
function     bool UMovieGraphEngineTimeStep::Initialize

Source code excerpt:

	{
		PrevMinUndilatedFrameTime = WorldSettings->MinUndilatedFrameTime;
		PrevMaxUndilatedFrameTime = WorldSettings->MaxUndilatedFrameTime;
	}

	return true;
}

void UMovieGraphEngineTimeStep::Shutdown(UEngine* InEngine)

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/MovieGraphCoreTimeStep.cpp:715

Scope (from outer to inner):

file
function     void UMovieGraphEngineTimeStep::Shutdown

Source code excerpt:

	{
		WorldSettings->MinUndilatedFrameTime = PrevMinUndilatedFrameTime;
		WorldSettings->MaxUndilatedFrameTime = PrevMaxUndilatedFrameTime;
	}
}

void UMovieGraphEngineTimeStep::SetCachedFrameTiming(const FTimeStepCache& InTimeCache)
{
	if (ensureMsgf(!FMath::IsNearlyZero(InTimeCache.UndilatedDeltaTime), TEXT("An incorrect or uninitialized time step was used! Delta Time of 0 isn't allowed.")))

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/MovieGraphCoreTimeStep.cpp:745

Scope (from outer to inner):

file
function     bool UMovieGraphEngineTimeStep::UpdateTimeStep

Source code excerpt:

		{
			WorldSettings->MinUndilatedFrameTime = TimeCache.UndilatedDeltaTime;
			WorldSettings->MaxUndilatedFrameTime = TimeCache.UndilatedDeltaTime;
		}
	}

	// Clear our cached time to ensure we're always explicitly telling this what to do and never relying on the last set value.
	// (This will cause the ensure above to check on the next tick if someone didn't reset our value.)
	TimeCache = FTimeStepCache();

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipeline.cpp:826

Scope (from outer to inner):

file
function     bool UMoviePipelineCustomTimeStep::UpdateTimeStep

Source code excerpt:

		{
			WorldSettings->MinUndilatedFrameTime = TimeCache.UndilatedDeltaTime;
			WorldSettings->MaxUndilatedFrameTime = TimeCache.UndilatedDeltaTime;
		}
	}

	// Clear our cached time to ensure we're always explicitly telling this what to do and never relying on the last set value.
	// (This will cause the ensure above to check on the next tick if someone didn't reset our value.)
	TimeCache = MoviePipeline::FFrameTimeStepCache();

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipeline.cpp:843

Scope (from outer to inner):

file
function     void UMoviePipelineCustomTimeStep::CacheWorldSettings

Source code excerpt:

	{
		PrevMinUndilatedFrameTime = WorldSettings->MinUndilatedFrameTime;
		PrevMaxUndilatedFrameTime = WorldSettings->MaxUndilatedFrameTime;
	}
}

void UMoviePipelineCustomTimeStep::RestoreCachedWorldSettings()
{
	if (AWorldSettings* WorldSettings = GetWorld()->GetWorldSettings())
	{
		WorldSettings->MinUndilatedFrameTime = PrevMinUndilatedFrameTime;
		WorldSettings->MaxUndilatedFrameTime = PrevMaxUndilatedFrameTime;
	}
}

void UMoviePipelineCustomTimeStep::SetCachedFrameTiming(const MoviePipeline::FFrameTimeStepCache& InTimeCache)
{ 
	if (ensureMsgf(!FMath::IsNearlyZero(InTimeCache.UndilatedDeltaTime), TEXT("An incorrect or uninitialized time step was used! Delta Time of 0 isn't allowed.")))

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/WorldSettings.h:827

Scope (from outer to inner):

file
class        class AWorldSettings : public AInfo, public IInterface_AssetUserData

Source code excerpt:

	/** Largest possible frametime, not considering dilation. Equiv to 1/SlowestFPS. */
	UPROPERTY(config, EditAnywhere, Category = Tick, AdvancedDisplay, meta = (UIMin = "0", ClampMin = "0"))
	float MaxUndilatedFrameTime;

	UPROPERTY(config, EditAnywhere, Category = Broadphase)
	FBroadphaseSettings BroadphaseSettings;

	/** valid only during replication - information about the player(s) being replicated to
	 * (there could be more than one in the case of a splitscreen client)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Timeline.cpp:749

Scope (from outer to inner):

file
function     void UTimelineComponent::TickComponent

Source code excerpt:

		{
			// Clamp DeltaTime in the same way as before.
			// UWorld::Tick called AWorldSettings::FixupDeltaSeconds, which clamped between Min and MaxUndilatedFrameTime.
			DeltaTime = FMath::Clamp(DeltaTime, WorldSettings->MinUndilatedFrameTime, WorldSettings->MaxUndilatedFrameTime);
		}
	}

	TheTimeline.TickTimeline(DeltaTime);

	if (!IsNetSimulating())

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldSettings.cpp:159

Scope (from outer to inner):

file
function     void AWorldSettings::PostInitProperties

Source code excerpt:

	}

	if (MaxUndilatedFrameTime < 0)
	{
		MaxUndilatedFrameTime = 0;
	}

	if (!HasAnyFlags(RF_ClassDefaultObject))
	{
		UpdateNumberOfBookmarks();
		UpdateBookmarkClass();

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldSettings.cpp:281

Scope (from outer to inner):

file
function     float AWorldSettings::FixupDeltaSeconds

Source code excerpt:

	float const Dilation = GetEffectiveTimeDilation();
	float const MinFrameTime = MinUndilatedFrameTime * Dilation;
	float const MaxFrameTime = MaxUndilatedFrameTime * Dilation;

	// clamp frame time according to desired limits
	return FMath::Clamp(DeltaSeconds, MinFrameTime, MaxFrameTime);	
}

float AWorldSettings::SetTimeDilation(float NewTimeDilation)