demo.WithGameSpecificFrameData

demo.WithGameSpecificFrameData

#Overview

name: demo.WithGameSpecificFrameData

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of demo.WithGameSpecificFrameData is to control whether game-specific data should be recorded with each demo frame in Unreal Engine’s replay system.

This setting variable is primarily used in the replay and demo recording subsystem of Unreal Engine. It’s part of the Engine module, specifically within the DemoNetDriver component.

The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with a default value of 0 (false). Users can change this value at runtime through console commands or configuration files.

The associated variable CVarWithGameSpecificFrameData directly interacts with demo.WithGameSpecificFrameData. They share the same value and purpose.

Developers must be aware that enabling this variable (setting it to 1 or true) will allow game-specific data to be recorded with each demo frame. This can increase the size of replay files and potentially impact performance during recording.

Best practices when using this variable include:

  1. Only enable it when necessary for game-specific features that require frame-by-frame data in replays.
  2. Consider the performance and storage implications of enabling this feature, especially for longer gameplay sessions.
  3. Ensure that the game code properly handles the recording and playback of this additional data when the feature is enabled.
  4. Use it in conjunction with other demo-related settings like CVarWithDeltaCheckpoints for optimal replay functionality.

Regarding the associated variable CVarWithGameSpecificFrameData:

The purpose of CVarWithGameSpecificFrameData is identical to demo.WithGameSpecificFrameData. It’s the C++ variable that directly controls the console variable setting.

This variable is used in the Engine module, specifically in the DemoNetDriver and ReplayHelper components.

The value of CVarWithGameSpecificFrameData is set when the TAutoConsoleVariable is initialized, and it can be modified at runtime through the console variable system.

It interacts directly with the demo.WithGameSpecificFrameData console variable, effectively serving as its C++ representation within the engine code.

Developers should be aware that this variable is used to check the state of the setting in various parts of the replay system code. Any changes to its behavior could have wide-ranging effects on the replay functionality.

Best practices for CVarWithGameSpecificFrameData include:

  1. Use GetValueOnAnyThread() when accessing its value, as shown in the provided code snippets.
  2. Consider the thread safety implications when modifying or reading this variable in multithreaded contexts.
  3. When modifying the behavior associated with this variable, ensure all relevant parts of the replay system are updated accordingly.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:80

Scope: file

Source code excerpt:

TAutoConsoleVariable<int32> CVarWithDemoTimeBurnIn(TEXT("demo.WithTimeBurnIn"), 0, TEXT("If true, adds an on screen message with the current DemoTime and Changelist."));
TAutoConsoleVariable<int32> CVarWithDeltaCheckpoints(TEXT("demo.WithDeltaCheckpoints"), 0, TEXT("If true, record checkpoints as a delta from the previous checkpoint."));
TAutoConsoleVariable<int32> CVarWithGameSpecificFrameData(TEXT("demo.WithGameSpecificFrameData"), 0, TEXT("If true, allow game specific data to be recorded with each demo frame."));

static TAutoConsoleVariable<float> CVarDemoIncreaseRepPrioritizeThreshold(TEXT("demo.IncreaseRepPrioritizeThreshold"), 0.9, TEXT("The % of Replicated to Prioritized actors at which prioritize time will be decreased."));
static TAutoConsoleVariable<float> CVarDemoDecreaseRepPrioritizeThreshold(TEXT("demo.DecreaseRepPrioritizeThreshold"), 0.7, TEXT("The % of Replicated to Prioritized actors at which prioritize time will be increased."));
static TAutoConsoleVariable<float> CVarDemoMinimumRepPrioritizeTime(TEXT("demo.MinimumRepPrioritizePercent"), 0.3, TEXT("Minimum percent of time that must be spent prioritizing actors, regardless of throttling."));
static TAutoConsoleVariable<float> CVarDemoMaximumRepPrioritizeTime(TEXT("demo.MaximumRepPrioritizePercent"), 0.7, TEXT("Maximum percent of time that may be spent prioritizing actors, regardless of throttling."));

#Associated Variable and Callsites

This variable is associated with another variable named CVarWithGameSpecificFrameData. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp:80

Scope: file

Source code excerpt:

TAutoConsoleVariable<int32> CVarWithDemoTimeBurnIn(TEXT("demo.WithTimeBurnIn"), 0, TEXT("If true, adds an on screen message with the current DemoTime and Changelist."));
TAutoConsoleVariable<int32> CVarWithDeltaCheckpoints(TEXT("demo.WithDeltaCheckpoints"), 0, TEXT("If true, record checkpoints as a delta from the previous checkpoint."));
TAutoConsoleVariable<int32> CVarWithGameSpecificFrameData(TEXT("demo.WithGameSpecificFrameData"), 0, TEXT("If true, allow game specific data to be recorded with each demo frame."));

static TAutoConsoleVariable<float> CVarDemoIncreaseRepPrioritizeThreshold(TEXT("demo.IncreaseRepPrioritizeThreshold"), 0.9, TEXT("The % of Replicated to Prioritized actors at which prioritize time will be decreased."));
static TAutoConsoleVariable<float> CVarDemoDecreaseRepPrioritizeThreshold(TEXT("demo.DecreaseRepPrioritizeThreshold"), 0.7, TEXT("The % of Replicated to Prioritized actors at which prioritize time will be increased."));
static TAutoConsoleVariable<float> CVarDemoMinimumRepPrioritizeTime(TEXT("demo.MinimumRepPrioritizePercent"), 0.3, TEXT("Minimum percent of time that must be spent prioritizing actors, regardless of throttling."));
static TAutoConsoleVariable<float> CVarDemoMaximumRepPrioritizeTime(TEXT("demo.MaximumRepPrioritizePercent"), 0.7, TEXT("Maximum percent of time that may be spent prioritizing actors, regardless of throttling."));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ReplayHelper.cpp:22

Scope: file

Source code excerpt:

extern TAutoConsoleVariable<int32> CVarWithLevelStreamingFixes;
extern TAutoConsoleVariable<int32> CVarWithDeltaCheckpoints;
extern TAutoConsoleVariable<int32> CVarWithGameSpecificFrameData;
extern TAutoConsoleVariable<int32> CVarEnableCheckpoints;
extern TAutoConsoleVariable<float> CVarCheckpointUploadDelayInSeconds;
extern TAutoConsoleVariable<float> CVarCheckpointSaveMaxMSPerFrameOverride;
extern TAutoConsoleVariable<int32> CVarDemoUseNetRelevancy;
extern TAutoConsoleVariable<int32> CVarDemoClientRecordAsyncEndOfFrame;
extern TAutoConsoleVariable<float> CVarDemoRecordHz;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ReplayHelper.cpp:160

Scope (from outer to inner):

file
function     void FReplayHelper::StartRecording

Source code excerpt:

	bHasLevelStreamingFixes = !!CVarWithLevelStreamingFixes.GetValueOnAnyThread() || World->IsPartitionedWorld();
	bHasDeltaCheckpoints = !!CVarWithDeltaCheckpoints.GetValueOnAnyThread() && ReplayStreamer->IsCheckpointTypeSupported(EReplayCheckpointType::Delta);
	bHasGameSpecificFrameData = !!CVarWithGameSpecificFrameData.GetValueOnAnyThread();

	const TCHAR* FriendlyNameOption = DemoURL.GetOption(TEXT("DemoFriendlyName="), nullptr);

	bRecordMapChanges = DemoURL.GetOption(TEXT("RecordMapChanges"), nullptr) != nullptr;

	TArray<int32> UserIndices;