bEnableDynamicMaxFPS

bEnableDynamicMaxFPS

#Overview

name: bEnableDynamicMaxFPS

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 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bEnableDynamicMaxFPS is to control whether the iOS platform should use a dynamic maximum frame rate or a constant one for frame pacing. This setting is primarily used in the iOS-specific frame pacer implementation.

This setting variable is relied upon by the iOS platform-specific subsystem, particularly in the frame pacing module. It’s part of the IOSRuntimeSettings, which suggests it’s specific to iOS device configurations.

The value of this variable is set in the IOSRuntimeSettings class, which is likely initialized from a configuration file (GEngineIni). It’s defined as a UPROPERTY with GlobalConfig and EditAnywhere attributes, indicating that it can be modified in the Unreal Engine editor and is saved in a config file.

This variable interacts with the UIScreen.maximumFramesPerSecond property of iOS devices. When enabled, it allows the frame pacer to use the device’s maximum supported frame rate instead of a constant value (IOSDisplayConstants::MaxRefreshRate).

Developers must be aware that this setting only affects iOS devices. Enabling it may result in different frame rates on different iOS devices, depending on their capabilities. This could potentially impact game performance and battery life.

Best practices when using this variable include:

  1. Consider the target devices for your game. If you’re targeting a wide range of iOS devices, enabling this might provide better performance on high-end devices.
  2. Test thoroughly on various iOS devices to ensure consistent performance when enabled.
  3. Be aware of the potential impact on battery life, as higher frame rates typically consume more power.
  4. Use in conjunction with other frame rate and power management settings to optimize the balance between performance and battery life.
  5. Consider providing an in-game option for users to toggle this feature, allowing them to choose between performance and battery life.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/ApplicationCore/Private/IOS/IOSPlatformFramePacer.cpp:181

Scope (from outer to inner):

file
function     uint32 FIOSPlatformRHIFramePacer::GetMaxRefreshRate

Source code excerpt:

	return IOSDisplayConstants::MaxRefreshRate;
#else
	static bool bEnableDynamicMaxFPS = false;
	static bool bInitialized = false;
	
	if (!bInitialized)
	{
		GConfig->GetBool(TEXT("/Script/IOSRuntimeSettings.IOSRuntimeSettings"), TEXT("bEnableDynamicMaxFPS"), bEnableDynamicMaxFPS, GEngineIni);
		bInitialized = true;
	}
	
	return bEnableDynamicMaxFPS ? [UIScreen mainScreen].maximumFramesPerSecond : IOSDisplayConstants::MaxRefreshRate;
#endif
}

bool FIOSPlatformRHIFramePacer::SupportsFramePace(int32 QueryFramePace)
{
	// Support frame rates that are an integer multiple of max refresh rate, or 0 for no pacing

#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Classes/IOSRuntimeSettings.h:280

Scope (from outer to inner):

file
class        class UIOSRuntimeSettings : public UObject

Source code excerpt:

    //Whether or not to allow taking the MaxRefreshRate from the device instead of a constant (60fps) in IOSPlatformFramePacer
    UPROPERTY(GlobalConfig, EditAnywhere, Category = PowerUsage, meta = (ConfigHierarchyEditable))
    bool bEnableDynamicMaxFPS;

    // Enable the use of RSync for remote builds on a mac
    UPROPERTY(GlobalConfig, EditAnywhere, Category = "Remote Build", meta = (DisplayName = "Use RSync for building IOS", ConfigHierarchyEditable))
    bool bUseRSync;

    // The name or ip address of the remote mac which will be used to build IOS

#Loc: <Workspace>/Engine/Source/Runtime/IOS/IOSRuntimeSettings/Private/IOSRuntimeSettings.cpp:36

Scope (from outer to inner):

file
function     UIOSRuntimeSettings::UIOSRuntimeSettings

Source code excerpt:

	VersionInfo = TEXT("1.0.0");
    FrameRateLock = EPowerUsageFrameRateLock::PUFRL_30;
	bEnableDynamicMaxFPS = false;
	bSupportsIPad = true;
	bSupportsIPhone = true;
	bEnableSplitView = false;
	bEnableSimulatorSupport = false;
	MinimumiOSVersion = EIOSVersion::IOS_Minimum;
    bBuildAsFramework = true;