demo.WithLevelStreamingFixes

demo.WithLevelStreamingFixes

#Overview

name: demo.WithLevelStreamingFixes

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.WithLevelStreamingFixes is to provide fixes for level streaming in Unreal Engine’s demo recording and playback system. This setting variable is specifically designed to address issues related to level streaming when recording or playing back game demos.

The Unreal Engine subsystem that relies on this setting variable is primarily the demo recording and playback system, which is part of the Engine module. This can be inferred from the file location where the variable is defined: Engine/Source/Runtime/Engine/Private/DemoNetDriver.cpp.

The value of this variable is set as a console variable, which means it can be changed at runtime through the console or configuration files. By default, it is set to 0 (disabled).

There are several other variables that interact with it, particularly other demo-related console variables defined in the same file, such as CVarWithDemoTimeBurnIn, CVarWithDeltaCheckpoints, and CVarWithGameSpecificFrameData.

Developers must be aware that enabling this variable (setting it to 1) will provide fixes for level streaming, but it will break backwards compatibility with previously recorded demos. This is crucial information for maintaining compatibility with existing demo files.

Best practices when using this variable include:

  1. Only enable it when necessary, especially when dealing with level streaming issues in demos.
  2. Be aware of the backwards compatibility implications when enabling this feature.
  3. Test thoroughly with both new and existing demos when changing this setting.
  4. Consider the impact on World Partition, as the code suggests that this setting is automatically enabled for partitioned worlds.

Regarding the associated variable CVarWithLevelStreamingFixes:

The purpose of CVarWithLevelStreamingFixes is the same as demo.WithLevelStreamingFixes, as they are essentially the same variable. CVarWithLevelStreamingFixes is the C++ representation of the console variable.

This variable is used in the Engine module, specifically in the demo recording and playback system. It’s referenced in both DemoNetDriver.cpp and ReplayHelper.cpp, indicating its importance in the replay system.

The value of CVarWithLevelStreamingFixes is set through the console variable system, allowing for runtime configuration.

It interacts with other demo-related variables and is checked in conjunction with the World Partition system to determine if level streaming fixes should be applied.

Developers should be aware that this variable is checked in critical parts of the replay system, such as when starting a recording. Its value can affect how level streaming is handled during demo recording and playback.

Best practices for using CVarWithLevelStreamingFixes include:

  1. Understand its relationship with the console variable demo.WithLevelStreamingFixes.
  2. Consider its impact on World Partition worlds, where it’s automatically enabled.
  3. Use it in conjunction with other demo-related settings for optimal demo recording and playback performance.
  4. Be cautious when modifying its value, as it can affect demo compatibility and level streaming behavior.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

static FAutoConsoleVariableRef CVarDemoSaveRollbackActorState( TEXT( "demo.SaveRollbackActorState" ), GDemoSaveRollbackActorState, TEXT( "If true, rollback actors will save some replicated state to apply when respawned." ) );

TAutoConsoleVariable<int32> CVarWithLevelStreamingFixes(TEXT("demo.WithLevelStreamingFixes"), 0, TEXT("If 1, provides fixes for level streaming (but breaks backwards compatibility)."));
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."));

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

static FAutoConsoleVariableRef CVarDemoSaveRollbackActorState( TEXT( "demo.SaveRollbackActorState" ), GDemoSaveRollbackActorState, TEXT( "If true, rollback actors will save some replicated state to apply when respawned." ) );

TAutoConsoleVariable<int32> CVarWithLevelStreamingFixes(TEXT("demo.WithLevelStreamingFixes"), 0, TEXT("If 1, provides fixes for level streaming (but breaks backwards compatibility)."));
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."));

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

Scope: file

Source code excerpt:

#include "UObject/Package.h"

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;

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

Scope (from outer to inner):

file
function     void FReplayHelper::StartRecording

Source code excerpt:


	// World Partition needs bHasLevelStreamingFixes to be true
	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;