demo.ReplayStreamerAutoDemoUseDateTimePostfix

demo.ReplayStreamerAutoDemoUseDateTimePostfix

#Overview

name: demo.ReplayStreamerAutoDemoUseDateTimePostfix

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of demo.ReplayStreamerAutoDemoUseDateTimePostfix is to control the naming convention for automatic demo replays in Unreal Engine’s network replay system. Specifically, it determines whether to use the current date and time as a postfix for automatic demo names instead of numerical indices.

This setting variable is primarily used by the Network Replay Streaming subsystem of Unreal Engine. It’s part of the NetworkReplayStreaming module, which handles the recording and playback of game sessions for debugging, analysis, or replay purposes.

The value of this variable is set through the console variable system (CVarReplayStreamerAutoDemoUseDateTimePostfix). It’s initialized with a default value of 0, meaning the feature is disabled by default.

The associated variable CVarReplayStreamerAutoDemoUseDateTimePostfix directly interacts with demo.ReplayStreamerAutoDemoUseDateTimePostfix. It’s a TAutoConsoleVariable that holds the actual value of the setting.

Developers should be aware that changing this variable will affect how automatic replay files are named. When enabled (set to a non-zero value), it will use the current date and time as a postfix for replay names, which can be useful for more human-readable identification of replays. When disabled (set to 0), it will likely use a numerical index system.

Best practices when using this variable include:

  1. Consider enabling it in development environments to make it easier to identify specific replays.
  2. Be cautious about enabling it in production environments, as it might affect existing systems that expect a specific naming convention.
  3. Ensure that any code or tools that interact with replay files can handle both naming conventions.

Regarding the associated variable CVarReplayStreamerAutoDemoUseDateTimePostfix:

Its purpose is to provide a programmatic way to access and modify the demo.ReplayStreamerAutoDemoUseDateTimePostfix setting within the C++ code of the engine.

It’s used in the NetworkReplayStreaming module, specifically in the FNetworkReplayStreaming class.

The value is set through the console variable system, but can be accessed in code using the GetValueOnAnyThread() method.

It directly interacts with the demo.ReplayStreamerAutoDemoUseDateTimePostfix setting, effectively serving as its in-code representation.

Developers should be aware that changes to this variable will immediately affect the behavior of the automatic replay naming system.

Best practices include using the provided UseDateTimeAsAutomaticReplayPostfix() function to check the current state of this setting, rather than accessing the console variable directly, to ensure consistent behavior across the codebase.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/NetworkReplayStreaming/NetworkReplayStreaming/Private/NetworkReplayStreaming.cpp:68

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarReplayStreamerAutoDemoUseDateTimePostfix(
	TEXT("demo.ReplayStreamerAutoDemoUseDateTimePostfix"),
	0,
	TEXT("When enabled, uses the current time as a postfix for automatic demo names instead of indices")
);

FString FNetworkReplayStreaming::GetAutomaticReplayPrefix()
{

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/NetworkReplayStreaming/NetworkReplayStreaming/Private/NetworkReplayStreaming.cpp:67

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarReplayStreamerAutoDemoUseDateTimePostfix(
	TEXT("demo.ReplayStreamerAutoDemoUseDateTimePostfix"),
	0,
	TEXT("When enabled, uses the current time as a postfix for automatic demo names instead of indices")
);

FString FNetworkReplayStreaming::GetAutomaticReplayPrefix()

#Loc: <Workspace>/Engine/Source/Runtime/NetworkReplayStreaming/NetworkReplayStreaming/Private/NetworkReplayStreaming.cpp:85

Scope (from outer to inner):

file
function     bool FNetworkReplayStreaming::UseDateTimeAsAutomaticReplayPostfix

Source code excerpt:

bool FNetworkReplayStreaming::UseDateTimeAsAutomaticReplayPostfix()
{
	return !!CVarReplayStreamerAutoDemoUseDateTimePostfix.GetValueOnAnyThread();
}

const FString FNetworkReplayStreaming::GetAutomaticReplayPrefixExtern() const
{
	return GetAutomaticReplayPrefix();
}