demo.MinRecordHz
demo.MinRecordHz
#Overview
name: demo.MinRecordHz
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Minimum number of demo frames recorded per second (use with care)
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of demo.MinRecordHz is to set the minimum number of demo frames recorded per second in Unreal Engine’s demo recording system. This setting is part of the engine’s replay and demo functionality, which is used for recording and playback of gameplay sessions.
This setting variable is primarily used in the DemoNetDriver subsystem of Unreal Engine, which is responsible for managing network replay functionality. It’s part of the Engine module.
The value of this variable is set as a console variable (CVar) with a default value of 0. It can be modified at runtime through the console or configuration files.
demo.MinRecordHz interacts closely with demo.RecordHz, which sets the maximum number of demo frames recorded per second. These two variables work together to define the range of frame recording rates for demos.
Developers should be aware of the following when using this variable:
- Setting a minimum record rate should be done with care, as noted in the variable’s description.
- If demo.MinRecordHz is set higher than demo.RecordHz, the engine will swap their values to maintain a valid range.
- This setting affects the fidelity and file size of recorded demos. A higher minimum rate ensures more frequent updates but may increase file size.
Best practices for using this variable include:
- Keep the minimum rate at 0 or a low value unless there’s a specific need for a higher minimum recording rate.
- Ensure that demo.RecordHz is set to a value higher than demo.MinRecordHz.
- Consider the performance implications of setting a high minimum record rate, especially on lower-end hardware.
Regarding the associated variable CVarDemoMinRecordHz:
The purpose of CVarDemoMinRecordHz is to provide programmatic access to the demo.MinRecordHz console variable within the C++ code of Unreal Engine.
This variable is used in the DemoNetDriver and ReplayHelper systems of the Engine module.
The value of CVarDemoMinRecordHz is set when the console variable demo.MinRecordHz is initialized or changed.
CVarDemoMinRecordHz interacts closely with CVarDemoRecordHz, which corresponds to the demo.RecordHz console variable.
Developers should be aware that:
- This variable provides a way to read the current value of demo.MinRecordHz from C++ code.
- It’s used in the demo recording logic to determine the actual recording rate.
Best practices for using CVarDemoMinRecordHz include:
- Use GetValueOnAnyThread() when accessing the value, as shown in the code examples.
- Remember that changes to the console variable will be reflected in this C++ variable.
- Consider the thread-safety implications when accessing this variable in multithreaded code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:46
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarDemoRecordHz( TEXT( "demo.RecordHz" ), 8, TEXT( "Maximum number of demo frames recorded per second" ) );
TAutoConsoleVariable<float> CVarDemoMinRecordHz(TEXT("demo.MinRecordHz"), 0, TEXT("Minimum number of demo frames recorded per second (use with care)"));
static TAutoConsoleVariable<float> CVarDemoTimeDilation( TEXT( "demo.TimeDilation" ), -1.0f, TEXT( "Override time dilation during demo playback (-1 = don't override)" ) );
static TAutoConsoleVariable<float> CVarDemoSkipTime( TEXT( "demo.SkipTime" ), 0, TEXT( "Skip fixed amount of network replay time (in seconds)" ) );
TAutoConsoleVariable<int32> CVarEnableCheckpoints( TEXT( "demo.EnableCheckpoints" ), 1, TEXT( "Whether or not checkpoints save on the server" ) );
static TAutoConsoleVariable<float> CVarGotoTimeInSeconds( TEXT( "demo.GotoTimeInSeconds" ), -1, TEXT( "For testing only, jump to a particular time" ) );
static TAutoConsoleVariable<int32> CVarDemoFastForwardDestroyTearOffActors( TEXT( "demo.FastForwardDestroyTearOffActors" ), 1, TEXT( "If true, the driver will destroy any torn-off actors immediately while fast-forwarding a replay." ) );
static TAutoConsoleVariable<int32> CVarDemoFastForwardSkipRepNotifies( TEXT( "demo.FastForwardSkipRepNotifies" ), 1, TEXT( "If true, the driver will optimize fast-forwarding by deferring calls to RepNotify functions until the fast-forward is complete. " ) );
#Associated Variable and Callsites
This variable is associated with another variable named CVarDemoMinRecordHz
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:46
Scope: file
Source code excerpt:
TAutoConsoleVariable<float> CVarDemoRecordHz( TEXT( "demo.RecordHz" ), 8, TEXT( "Maximum number of demo frames recorded per second" ) );
TAutoConsoleVariable<float> CVarDemoMinRecordHz(TEXT("demo.MinRecordHz"), 0, TEXT("Minimum number of demo frames recorded per second (use with care)"));
static TAutoConsoleVariable<float> CVarDemoTimeDilation( TEXT( "demo.TimeDilation" ), -1.0f, TEXT( "Override time dilation during demo playback (-1 = don't override)" ) );
static TAutoConsoleVariable<float> CVarDemoSkipTime( TEXT( "demo.SkipTime" ), 0, TEXT( "Skip fixed amount of network replay time (in seconds)" ) );
TAutoConsoleVariable<int32> CVarEnableCheckpoints( TEXT( "demo.EnableCheckpoints" ), 1, TEXT( "Whether or not checkpoints save on the server" ) );
static TAutoConsoleVariable<float> CVarGotoTimeInSeconds( TEXT( "demo.GotoTimeInSeconds" ), -1, TEXT( "For testing only, jump to a particular time" ) );
static TAutoConsoleVariable<int32> CVarDemoFastForwardDestroyTearOffActors( TEXT( "demo.FastForwardDestroyTearOffActors" ), 1, TEXT( "If true, the driver will destroy any torn-off actors immediately while fast-forwarding a replay." ) );
static TAutoConsoleVariable<int32> CVarDemoFastForwardSkipRepNotifies( TEXT( "demo.FastForwardSkipRepNotifies" ), 1, TEXT( "If true, the driver will optimize fast-forwarding by deferring calls to RepNotify functions until the fast-forward is complete. " ) );
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:2168
Scope (from outer to inner):
file
function void UDemoNetDriver::TickDemoRecordFrame
Source code excerpt:
}
float MinRecordHz = CVarDemoMinRecordHz.GetValueOnAnyThread();
float MaxRecordHz = CVarDemoRecordHz.GetValueOnAnyThread();
if (MaxRecordHz < MinRecordHz)
{
Swap(MinRecordHz, MaxRecordHz);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ReplayHelper.cpp:29
Scope: file
Source code excerpt:
extern TAutoConsoleVariable<int32> CVarDemoClientRecordAsyncEndOfFrame;
extern TAutoConsoleVariable<float> CVarDemoRecordHz;
extern TAutoConsoleVariable<float> CVarDemoMinRecordHz;
CSV_DECLARE_CATEGORY_EXTERN(Demo);
FReplayHelper::FReplayHelper()
: CurrentLevelIndex(0)
, DemoFrameNum(0)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ReplayHelper.cpp:281
Scope (from outer to inner):
file
function void FReplayHelper::WriteNetworkDemoHeader
Source code excerpt:
DemoHeader.CheckpointLimitInMS = CheckpointSaveMaxMSPerFrame;
DemoHeader.MinRecordHz = CVarDemoMinRecordHz.GetValueOnAnyThread();
DemoHeader.MaxRecordHz = CVarDemoRecordHz.GetValueOnAnyThread();
DemoHeader.Platform = FPlatformProperties::PlatformName();
DemoHeader.BuildConfig = FApp::GetBuildConfiguration();
DemoHeader.BuildTarget = FApp::GetBuildTargetType();