SmoothedFrameRateRange

SmoothedFrameRateRange

#Overview

name: SmoothedFrameRateRange

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of SmoothedFrameRateRange is to define a range of frame rates within which the engine will apply frame rate smoothing. This setting is primarily used for controlling the game’s performance and visual stability.

SmoothedFrameRateRange is used in the Engine and UnrealEd modules of Unreal Engine 5. Specifically, it’s utilized in the UEngine and UEditorEngine classes, which are core components of the engine’s runtime and editor systems, respectively.

The value of this variable is set through configuration files or can be modified in the editor. It’s defined as a UPROPERTY with the ‘config’ and ‘EditAnywhere’ specifiers, allowing it to be serialized and edited in the Unreal Editor.

SmoothedFrameRateRange interacts with the engine’s tick rate calculation system. It’s used in conjunction with other variables and functions like GetMaxTickRate() to determine the appropriate frame rate for the game or editor.

Developers must be aware that this variable affects both the lower and upper bounds of the frame rate. It can be used to prevent the frame rate from dropping too low or from becoming unnecessarily high, which could waste system resources.

Best practices when using this variable include:

  1. Setting appropriate lower and upper bounds based on your game’s performance requirements and target platforms.
  2. Considering the impact on both performance and visual quality when adjusting these values.
  3. Testing thoroughly on various hardware configurations to ensure the chosen range provides a smooth experience across different systems.
  4. Being cautious when modifying this value at runtime, as it could lead to sudden changes in game performance.
  5. Coordinating with other frame rate-related settings to ensure consistent behavior across the entire engine.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:314, section: [/Script/Engine.Engine]

Location: <Workspace>/Engine/Config/BaseEngine.ini:1833, section: [/Script/UnrealEd.EditorEngine]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorEngine.cpp:2378

Scope (from outer to inner):

file
function     float UEditorEngine::GetMaxTickRate

Source code excerpt:

		{
			MaxTickRate = 1.0f / DeltaTime;
			if (SmoothedFrameRateRange.HasLowerBound())
			{
				MaxTickRate = FMath::Max(MaxTickRate, SmoothedFrameRateRange.GetLowerBoundValue());
			}
			if (SmoothedFrameRateRange.HasUpperBound())
			{
				MaxTickRate = FMath::Min(MaxTickRate, SmoothedFrameRateRange.GetUpperBoundValue());
			}
		}

		// Laptops should throttle to 60 hz in editor to reduce battery drain
		static const auto CVarDontLimitOnBattery = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DontLimitOnBattery"));
		const bool bLimitOnBattery = (FPlatformMisc::IsRunningOnBattery() && CVarDontLimitOnBattery->GetValueOnGameThread() == 0);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:1485

Scope (from outer to inner):

file
class        class UEngine : public UObject , public FExec

Source code excerpt:

	/** Range of framerates in which smoothing will kick in */
	UPROPERTY(config, EditAnywhere, Category=Framerate, meta=(UIMin=0, UIMax=200, EditCondition="!bUseFixedFrameRate"))
	FFloatRange SmoothedFrameRateRange;

private:
	/** Controls how the Engine process the Framerate/Timestep */
	UPROPERTY(transient)
	TObjectPtr<UEngineCustomTimeStep> CustomTimeStep;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:11253

Scope (from outer to inner):

file
function     float UEngine::GetMaxTickRate

Source code excerpt:


		// Clamp FPS into ini defined min/ max range.
		if (SmoothedFrameRateRange.HasLowerBound())
		{
			MaxTickRate = FMath::Max( MaxTickRate, SmoothedFrameRateRange.GetLowerBoundValue() );
		}
		if (SmoothedFrameRateRange.HasUpperBound())
		{
			MaxTickRate = FMath::Min( MaxTickRate, SmoothedFrameRateRange.GetUpperBoundValue() );
		}
	}

	if (CVarCauseHitches.GetValueOnAnyThread())
	{
		static float RunningHitchTimer = 0.f;