tick.DoAsyncEndOfFrameTasks.ValidateReplicatedProperties

tick.DoAsyncEndOfFrameTasks.ValidateReplicatedProperties

#Overview

name: tick.DoAsyncEndOfFrameTasks.ValidateReplicatedProperties

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 tick.DoAsyncEndOfFrameTasks.ValidateReplicatedProperties is to validate that replicated properties haven’t changed during the Slate tick. This setting is primarily used for debugging and ensuring the integrity of networked game state.

This setting variable is primarily used in the Unreal Engine’s core game loop and networking subsystem. Based on the callsites, it’s specifically utilized in the LaunchEngineLoop, which is a crucial part of the engine’s runtime.

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

This variable interacts with the associated variable CVarDoAsyncEndOfFrameTasksValidateReplicatedProperties. They share the same value and purpose.

Developers must be aware of several things when using this variable:

  1. Enabling this validation (by setting it to a non-zero value) may impact performance, so it should primarily be used for debugging.
  2. The results of this validation will not be valid if the “demo.ClientRecordAsyncEndOfFrame” setting is also enabled.
  3. This validation is only performed when a DemoNetDriver (used for network replay functionality) is present.

Best practices when using this variable include:

  1. Use it judiciously in development and testing environments to catch potential replication issues.
  2. Disable it in production builds to avoid unnecessary performance overhead.
  3. When investigating replication issues, ensure that “demo.ClientRecordAsyncEndOfFrame” is disabled for accurate results.
  4. Consider using this in conjunction with other network debugging tools for a comprehensive analysis of replication behavior.

Regarding the associated variable CVarDoAsyncEndOfFrameTasksValidateReplicatedProperties:

This is the actual console variable that controls the behavior described above. It’s an instance of TAutoConsoleVariable, which means it’s an integer console variable that can be changed at runtime.

The purpose and usage of CVarDoAsyncEndOfFrameTasksValidateReplicatedProperties are identical to tick.DoAsyncEndOfFrameTasks.ValidateReplicatedProperties. It’s used in the game loop to determine whether to perform the validation of replicated properties.

Developers should be aware that changing this variable at runtime will immediately affect the validation behavior. They can modify it through the console or through C++ code using the GetValueOnGameThread() method.

Best practices for using CVarDoAsyncEndOfFrameTasksValidateReplicatedProperties include:

  1. Use GetValueOnGameThread() to safely access its value in game thread code.
  2. Consider exposing this setting in a developer-only UI for easy toggling during testing.
  3. Document any usage of this variable in your project to ensure other team members are aware of its potential performance implications.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:319

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarDoAsyncEndOfFrameTasksValidateReplicatedProperties(
	TEXT("tick.DoAsyncEndOfFrameTasks.ValidateReplicatedProperties"),
	0,
	TEXT("If true, validates that replicated properties haven't changed during the Slate tick. Results will not be valid if demo.ClientRecordAsyncEndOfFrame is also enabled.")
	);

static FAutoConsoleTaskPriority CPrio_AsyncEndOfFrameGameTasks(
	TEXT("TaskGraph.TaskPriorities.AsyncEndOfFrameGameTasks"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:318

Scope: file

Source code excerpt:

	);

static TAutoConsoleVariable<int32> CVarDoAsyncEndOfFrameTasksValidateReplicatedProperties(
	TEXT("tick.DoAsyncEndOfFrameTasks.ValidateReplicatedProperties"),
	0,
	TEXT("If true, validates that replicated properties haven't changed during the Slate tick. Results will not be valid if demo.ClientRecordAsyncEndOfFrame is also enabled.")
	);

static FAutoConsoleTaskPriority CPrio_AsyncEndOfFrameGameTasks(

#Loc: <Workspace>/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:5986

Scope: file

Source code excerpt:

		UDemoNetDriver* const CurrentDemoNetDriver = GameViewportWorld ? GameViewportWorld->GetDemoNetDriver() : nullptr;

		const bool bValidateReplicatedProperties = CurrentDemoNetDriver && CVarDoAsyncEndOfFrameTasksValidateReplicatedProperties.GetValueOnGameThread() != 0;

		if (bDoConcurrentSlateTick)
		{
			const float DeltaSeconds = FApp::GetDeltaTime();

			if (CurrentDemoNetDriver && CurrentDemoNetDriver->ShouldTickFlushAsyncEndOfFrame())