FramePacingMode
FramePacingMode
#Overview
name: FramePacingMode
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 15
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of FramePacingMode is to control how frame pacing is managed in the Unreal Engine 5 game. Frame pacing is a technique used to regulate the timing of frame delivery to ensure smooth gameplay and consistent performance across different devices and platforms.
This setting variable is primarily used in the Lyra game project, which is likely a sample or template project for Unreal Engine 5. It is part of the performance and rendering systems, specifically tailored for different platforms (desktop, mobile, and console).
The ULyraPlatformSpecificRenderingSettings class in the LyraGame module relies on this setting variable. It is used in various parts of the game’s settings and performance management systems, including the video settings registry and local settings.
The value of this variable is set in the ULyraPlatformSpecificRenderingSettings class, likely through configuration files or platform-specific settings.
Other variables that interact with FramePacingMode include:
- MobileFrameRateLimits
- FrameRateLimit
- MobileFrameRateLimit
- DesiredMobileFrameRateLimit
Developers must be aware of the following when using this variable:
- It has different implications for different platforms (desktop, mobile, console).
- It affects how frame rate limits are applied and how quality settings are managed.
- It can influence the behavior of auto-benchmarking and device profile selection.
Best practices when using this variable include:
- Ensure it is set appropriately for the target platform.
- Consider its impact on frame rate limits and quality settings when making performance optimizations.
- Test thoroughly on all target platforms to ensure the desired frame pacing behavior is achieved.
- Be aware of its interaction with other performance-related settings and adjust them accordingly.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/Android/AndroidGame.ini:20, section: [LyraPlatformSpecificRenderingSettings_Android LyraPlatformSpecificRenderingSettings]
- INI Section:
LyraPlatformSpecificRenderingSettings_Android LyraPlatformSpecificRenderingSettings
- Raw value:
MobileStyle
- Is Array:
False
Location: <Workspace>/Projects/Lyra/Config/IOS/IOSGame.ini:20, section: [LyraPlatformSpecificRenderingSettings_IOS LyraPlatformSpecificRenderingSettings]
- INI Section:
LyraPlatformSpecificRenderingSettings_IOS LyraPlatformSpecificRenderingSettings
- Raw value:
MobileStyle
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Performance/LyraPerformanceSettings.h:103
Scope (from outer to inner):
file
class class ULyraPlatformSpecificRenderingSettings : public UPlatformSettings
Source code excerpt:
// How is frame pacing controlled
UPROPERTY(EditAnywhere, Config, Category=VideoSettings)
ELyraFramePacingMode FramePacingMode = ELyraFramePacingMode::DesktopStyle;
// Potential frame rates to display for mobile
// Note: This is further limited by Lyra.DeviceProfile.Mobile.MaxFrameRate from the
// platform-specific device profile and what the platform frame pacer reports as supported
UPROPERTY(EditAnywhere, Config, Category=VideoSettings, meta=(EditCondition="FramePacingMode==ELyraFramePacingMode::MobileStyle", ForceUnits=Hz))
TArray<int32> MobileFrameRateLimits;
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraGameSettingRegistry_Video.cpp:33
Scope: file
Source code excerpt:
};
// Checks the platform-specific value for FramePacingMode
class FGameSettingEditCondition_FramePacingMode : public FGameSettingEditCondition
{
public:
FGameSettingEditCondition_FramePacingMode(ELyraFramePacingMode InDesiredMode, EFramePacingEditCondition InMatchMode = EFramePacingEditCondition::EnableIf)
: DesiredMode(InDesiredMode)
, MatchMode(InMatchMode)
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraGameSettingRegistry_Video.cpp:45
Scope (from outer to inner):
file
class class FGameSettingEditCondition_FramePacingMode : public FGameSettingEditCondition
function virtual void GatherEditState
Source code excerpt:
virtual void GatherEditState(const ULocalPlayer * InLocalPlayer, FGameSettingEditableState & InOutEditState) const override
{
const ELyraFramePacingMode ActualMode = ULyraPlatformSpecificRenderingSettings::Get()->FramePacingMode;
const bool bMatches = (ActualMode == DesiredMode);
const bool bMatchesAreBad = (MatchMode == EFramePacingEditCondition::DisableIf);
if (bMatches == bMatchesAreBad)
{
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraGameSettingRegistry_Video.cpp:311
Scope (from outer to inner):
file
function UGameSettingCollection* ULyraGameSettingRegistry::InitializeVideoSettings
lambda-function
Source code excerpt:
{
const ULyraPlatformSpecificRenderingSettings* PlatformSettings = ULyraPlatformSpecificRenderingSettings::Get();
if (PlatformSettings->FramePacingMode == ELyraFramePacingMode::MobileStyle)
{
ULyraSettingsLocal::Get()->ResetToMobileDeviceDefaults();
}
else
{
const ULyraLocalPlayer* LyraLocalPlayer = CastChecked<ULyraLocalPlayer>(LocalPlayer);
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraGameSettingRegistry_Video.cpp:327
Scope (from outer to inner):
file
function UGameSettingCollection* ULyraGameSettingRegistry::InitializeVideoSettings
lambda-function
Source code excerpt:
{
const ULyraPlatformSpecificRenderingSettings* PlatformSettings = ULyraPlatformSpecificRenderingSettings::Get();
const bool bCanUseDueToMobile = (PlatformSettings->FramePacingMode == ELyraFramePacingMode::MobileStyle);
const ULyraLocalPlayer* LyraLocalPlayer = CastChecked<ULyraLocalPlayer>(LocalPlayer);
const bool bCanBenchmark = LyraLocalPlayer->GetLocalSettings()->CanRunAutoBenchmark();
if (!bCanUseDueToMobile && !bCanBenchmark)
{
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:373
Scope (from outer to inner):
file
function void ULyraSettingsLocal::LoadSettings
Source code excerpt:
// Console platforms use rhi.SyncInterval to limit framerate
const ULyraPlatformSpecificRenderingSettings* PlatformSettings = ULyraPlatformSpecificRenderingSettings::Get();
if (PlatformSettings->FramePacingMode == ELyraFramePacingMode::ConsoleStyle)
{
FrameRateLimit = 0.0f;
}
// Enable HRTF if needed
bDesiredHeadphoneMode = bUseHeadphoneMode;
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:455
Scope (from outer to inner):
file
function float ULyraSettingsLocal::GetEffectiveFrameRateLimit
Source code excerpt:
#endif
if (PlatformSettings->FramePacingMode == ELyraFramePacingMode::ConsoleStyle)
{
return 0.0f;
}
float EffectiveFrameRateLimit = Super::GetEffectiveFrameRateLimit();
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:467
Scope (from outer to inner):
file
function float ULyraSettingsLocal::GetEffectiveFrameRateLimit
Source code excerpt:
}
if (PlatformSettings->FramePacingMode == ELyraFramePacingMode::DesktopStyle)
{
if (FPlatformMisc::IsRunningOnBattery())
{
EffectiveFrameRateLimit = CombineFrameRateLimits(EffectiveFrameRateLimit, FrameRateLimit_OnBattery);
}
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:702
Scope (from outer to inner):
file
function int32 ULyraSettingsLocal::GetMaxSupportedOverallQualityLevel
Source code excerpt:
{
const ULyraPlatformSpecificRenderingSettings* PlatformSettings = ULyraPlatformSpecificRenderingSettings::Get();
if ((PlatformSettings->FramePacingMode == ELyraFramePacingMode::MobileStyle) && DeviceDefaultScalabilitySettings.bHasOverrides)
{
return LyraSettingsHelpers::GetHighestLevelOfAnyScalabilityChannel(DeviceDefaultScalabilitySettings.Qualities);
}
else
{
return 3;
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:715
Scope (from outer to inner):
file
function void ULyraSettingsLocal::SetMobileFPSMode
Source code excerpt:
{
const ULyraPlatformSpecificRenderingSettings* PlatformSettings = ULyraPlatformSpecificRenderingSettings::Get();
if (PlatformSettings->FramePacingMode == ELyraFramePacingMode::MobileStyle)
{
if (MobileFrameRateLimit != NewLimitFPS)
{
MobileFrameRateLimit = NewLimitFPS;
UpdateGameModeDeviceProfileAndFps();
}
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:741
Scope (from outer to inner):
file
function void ULyraSettingsLocal::ClampMobileFPSQualityLevels
Source code excerpt:
{
const ULyraPlatformSpecificRenderingSettings* PlatformSettings = ULyraPlatformSpecificRenderingSettings::Get();
if (PlatformSettings->FramePacingMode == ELyraFramePacingMode::MobileStyle)
{
const int32 QualityLimit = LyraSettingsHelpers::GetApplicableOverallQualityLimit(DesiredMobileFrameRateLimit);
const int32 CurrentQualityLevel = GetHighestLevelOfAnyScalabilityChannel();
if ((QualityLimit >= 0) && (CurrentQualityLevel > QualityLimit))
{
SetOverallScalabilityLevel(QualityLimit);
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:761
Scope (from outer to inner):
file
function void ULyraSettingsLocal::ClampMobileQuality
Source code excerpt:
{
const ULyraPlatformSpecificRenderingSettings* PlatformSettings = ULyraPlatformSpecificRenderingSettings::Get();
if (PlatformSettings->FramePacingMode == ELyraFramePacingMode::MobileStyle)
{
// Clamp the resultant settings to the device default, it's known viable maximum.
// This is a clamp rather than override to preserve allowed user settings
Scalability::FQualityLevels CurrentLevels = Scalability::GetQualityLevels();
/** On mobile, disables the 3D Resolution clamp that reverts the setting set by the user on boot.*/
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:1217
Scope (from outer to inner):
file
function int32 ULyraSettingsLocal::GetOverallScalabilityLevel
Source code excerpt:
const ULyraPlatformSpecificRenderingSettings* PlatformSettings = ULyraPlatformSpecificRenderingSettings::Get();
if (PlatformSettings->FramePacingMode == ELyraFramePacingMode::MobileStyle)
{
Result = GetHighestLevelOfAnyScalabilityChannel();
}
return Result;
}
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:1236
Scope (from outer to inner):
file
function void ULyraSettingsLocal::SetOverallScalabilityLevel
Source code excerpt:
const ULyraPlatformSpecificRenderingSettings* PlatformSettings = ULyraPlatformSpecificRenderingSettings::Get();
if (PlatformSettings->FramePacingMode == ELyraFramePacingMode::MobileStyle)
{
// Restore the resolution quality, mobile decouples this from overall quality
ScalabilityQuality.ResolutionQuality = CurrentMobileResolutionQuality;
// Changing the overall quality can end up adjusting the frame rate on mobile since there are limits
const int32 ConstrainedFrameRateLimit = LyraSettingsHelpers::ConstrainFrameRateToBeCompatibleWithOverallQuality(DesiredMobileFrameRateLimit, Value);
#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraSettingsLocal.cpp:1691
Scope (from outer to inner):
file
function void ULyraSettingsLocal::UpdateGameModeDeviceProfileAndFps
Source code excerpt:
}
switch (PlatformSettings->FramePacingMode)
{
case ELyraFramePacingMode::MobileStyle:
UpdateMobileFramePacing();
break;
case ELyraFramePacingMode::ConsoleStyle:
UpdateConsoleFramePacing();