MinUndilatedFrameTime

MinUndilatedFrameTime

#Overview

name: MinUndilatedFrameTime

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 MinUndilatedFrameTime is to set a lower bound for the frame time in Unreal Engine’s game loop, effectively limiting the maximum frame rate. This variable is part of the engine’s timing and frame rate control system.

MinUndilatedFrameTime is primarily used in the Engine module, specifically within the WorldSettings class. It’s also referenced in the MovieRenderPipeline plugin, which suggests it plays a role in movie rendering and frame timing for cinematics.

The value of this variable is typically set in the WorldSettings class, which is part of the game’s configuration. It can be modified through the Unreal Editor or programmatically at runtime.

MinUndilatedFrameTime often interacts with MaxUndilatedFrameTime, its counterpart that sets the upper bound for frame time. Together, these variables define the acceptable range for frame times.

Developers should be aware that:

  1. This variable affects the game’s performance and visual smoothness.
  2. Setting it too low might cause unnecessary CPU/GPU load, while setting it too high might result in choppy gameplay.
  3. It’s used in frame time clamping, which can impact the consistency of gameplay across different hardware.

Best practices when using this variable include:

  1. Carefully consider the target platform and desired performance when setting this value.
  2. Test thoroughly on various hardware configurations to ensure consistent gameplay experience.
  3. Be cautious when modifying it at runtime, as it can affect game feel and physics simulations.
  4. Consider the relationship between this value and the target frame rate of your game.
  5. Use in conjunction with MaxUndilatedFrameTime to define a reasonable frame time range.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseGame.ini:181, 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:703

Scope (from outer to inner):

file
function     bool UMovieGraphEngineTimeStep::Initialize

Source code excerpt:

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

	return true;
}

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

Scope (from outer to inner):

file
function     void UMovieGraphEngineTimeStep::Shutdown

Source code excerpt:

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

void UMovieGraphEngineTimeStep::SetCachedFrameTiming(const FTimeStepCache& InTimeCache)
{

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

Scope (from outer to inner):

file
function     bool UMovieGraphEngineTimeStep::UpdateTimeStep

Source code excerpt:

		if (AWorldSettings* WorldSettings = GetWorld()->GetWorldSettings())
		{
			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.)

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

Scope (from outer to inner):

file
function     bool UMoviePipelineCustomTimeStep::UpdateTimeStep

Source code excerpt:

		if (AWorldSettings* WorldSettings = GetWorld()->GetWorldSettings())
		{
			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.)

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

Scope (from outer to inner):

file
function     void UMoviePipelineCustomTimeStep::CacheWorldSettings

Source code excerpt:

	if (AWorldSettings* WorldSettings = GetWorld()->GetWorldSettings())
	{
		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)
{ 

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

Scope (from outer to inner):

file
class        class AWorldSettings : public AInfo, public IInterface_AssetUserData

Source code excerpt:

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

	/** 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)

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

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:154

Scope (from outer to inner):

file
function     void AWorldSettings::PostInitProperties

Source code excerpt:

	}

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

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

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

Scope (from outer to inner):

file
function     float AWorldSettings::FixupDeltaSeconds

Source code excerpt:

	// DeltaSeconds is assumed to be fully dilated at this time, so we will dilate the clamp range as well
	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);	
}