t.UnsteadyFPS
t.UnsteadyFPS
#Overview
name: t.UnsteadyFPS
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Causes FPS to bounce around randomly in the 8-32 range.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of t.UnsteadyFPS is to simulate an unstable frame rate for testing and debugging purposes. This setting variable is designed to cause the frames per second (FPS) to fluctuate randomly within a specific range, typically between 8 and 32 FPS.
This setting variable is primarily used in the Engine module of Unreal Engine, specifically within the UEngine class. It’s part of the engine’s performance testing and simulation capabilities.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable
The associated variable CVarUnsteadyFPS directly interacts with t.UnsteadyFPS. They share the same value and purpose. CVarUnsteadyFPS is used in the engine code to check the current setting and apply the unsteady FPS behavior.
Developers must be aware that enabling this variable will intentionally cause the game’s frame rate to become unstable. This can significantly affect gameplay, rendering, and overall performance. It should only be used for testing purposes and not in production builds.
Best practices when using this variable include:
- Use it only during development and testing phases.
- Be cautious when interpreting performance metrics while this setting is enabled, as it artificially introduces instability.
- Always disable it before final performance optimization and when preparing builds for release.
- Use in conjunction with other performance analysis tools to understand how your game behaves under varying frame rates.
Regarding the associated variable CVarUnsteadyFPS:
The purpose of CVarUnsteadyFPS is to provide a programmatic interface to the t.UnsteadyFPS setting. It allows the engine code to check and apply the unsteady FPS behavior.
This variable is used in the Engine module, specifically in the UEngine class’s GetMaxTickRate function. This function is crucial for determining the maximum frame rate of the game.
The value of CVarUnsteadyFPS is set automatically when t.UnsteadyFPS is changed, as they are bound together through the console variable system.
CVarUnsteadyFPS directly interacts with the engine’s tick rate calculation. When enabled, it causes the max tick rate to fluctuate randomly between 8 and 32 FPS.
Developers should be aware that this variable’s effects are applied in the engine’s core timing logic. Enabling it will affect all systems that depend on frame rate or delta time.
Best practices for CVarUnsteadyFPS are similar to those for t.UnsteadyFPS. Additionally, developers should consider using CVarUnsteadyFPS.GetValueOnAnyThread() when they need to check the current state of this setting in their own code, especially if they’re extending or customizing the engine’s timing systems.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:11199
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarUnsteadyFPS(
TEXT("t.UnsteadyFPS"),0,
TEXT("Causes FPS to bounce around randomly in the 8-32 range."));
void UEngine::InitializeRunningAverageDeltaTime()
{
// Running average delta time, initial value at 100 FPS so fast machines don't have to creep up
// to a good frame rate due to code limiting upward "mobility".
#Associated Variable and Callsites
This variable is associated with another variable named CVarUnsteadyFPS
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:11198
Scope: file
Source code excerpt:
TEXT("Controls the size of the hitch caused by CauseHitches in ms."));
static TAutoConsoleVariable<int32> CVarUnsteadyFPS(
TEXT("t.UnsteadyFPS"),0,
TEXT("Causes FPS to bounce around randomly in the 8-32 range."));
void UEngine::InitializeRunningAverageDeltaTime()
{
// Running average delta time, initial value at 100 FPS so fast machines don't have to creep up
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:11277
Scope (from outer to inner):
file
function float UEngine::GetMaxTickRate
Source code excerpt:
}
if (CVarUnsteadyFPS.GetValueOnAnyThread())
{
static float LastMaxTickRate = 20.f;
float RandDelta = FMath::FRandRange(-5.f, 5.f);
MaxTickRate = FMath::Clamp(LastMaxTickRate + RandDelta, 8.f, 32.f);
LastMaxTickRate = MaxTickRate;
}