Concert.Replication.SimulateAuthorityTimeouts

Concert.Replication.SimulateAuthorityTimeouts

#Overview

name: Concert.Replication.SimulateAuthorityTimeouts

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 Concert.Replication.SimulateAuthorityTimeouts is to simulate authority request timeouts in the Concert replication system of Unreal Engine 5. This setting is used for testing and debugging purposes, allowing developers to simulate network issues without actually having to create them.

This setting variable is primarily used in the ConcertSyncClient module, which is part of the Concert plugin for Unreal Engine. The Concert plugin is designed for real-time collaboration and synchronization in multi-user environments.

The value of this variable is set as a console variable (CVar) in the engine. It’s defined as a boolean value, defaulting to false. This means that by default, the simulation of authority timeouts is turned off.

The associated variable CVarSimulateAuthorityTimeouts directly interacts with Concert.Replication.SimulateAuthorityTimeouts. They share the same value and purpose.

Developers must be aware that when this variable is set to true, it will cause the client to pretend that authority requests have timed out instead of actually sending them to the server. This can significantly affect the behavior of the replication system and should only be used for testing purposes.

Best practices when using this variable include:

  1. Only enable it in development or testing environments, never in production.
  2. Use it in conjunction with other debugging tools to isolate and identify issues related to authority timeout handling.
  3. Always disable it after testing to ensure normal operation of the replication system.
  4. Document its usage clearly in any test cases or debugging procedures.

Regarding the associated variable CVarSimulateAuthorityTimeouts:

The purpose of CVarSimulateAuthorityTimeouts is identical to Concert.Replication.SimulateAuthorityTimeouts. It’s the C++ variable that directly controls the behavior specified by the console variable.

This variable is used in the RequestAuthorityChange function of the FReplicationManagerState_Connected class. When the variable is true, instead of sending an actual authority change request, the function immediately returns a future with a timeout response.

Developers should be aware that this variable is checked on the game thread (GetValueOnGameThread()), which means changes to this variable will only take effect on the next frame or tick of the game thread.

Best practices for CVarSimulateAuthorityTimeouts are the same as for Concert.Replication.SimulateAuthorityTimeouts. Additionally, developers should ensure that any code depending on authority changes handles timeout scenarios correctly, as this variable allows for easy testing of those code paths.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncClient/Source/ConcertSyncClient/Private/Replication/Manager/ReplicationManagerState_Connected.cpp:22

Scope (from outer to inner):

file
namespace    UE::ConcertSyncClient::Replication

Source code excerpt:

{
	TAutoConsoleVariable<bool> CVarSimulateAuthorityTimeouts(
		TEXT("Concert.Replication.SimulateAuthorityTimeouts"),
		false,
		TEXT("Whether the client should pretend that authority requests timed out instead of sending to the server.")
		);
	TAutoConsoleVariable<bool> CVarSimulateQueryTimeouts(
		TEXT("Concert.Replication.SimulateQueryTimeouts"),
		false,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncClient/Source/ConcertSyncClient/Private/Replication/Manager/ReplicationManagerState_Connected.cpp:21

Scope (from outer to inner):

file
namespace    UE::ConcertSyncClient::Replication

Source code excerpt:

namespace UE::ConcertSyncClient::Replication
{
	TAutoConsoleVariable<bool> CVarSimulateAuthorityTimeouts(
		TEXT("Concert.Replication.SimulateAuthorityTimeouts"),
		false,
		TEXT("Whether the client should pretend that authority requests timed out instead of sending to the server.")
		);
	TAutoConsoleVariable<bool> CVarSimulateQueryTimeouts(
		TEXT("Concert.Replication.SimulateQueryTimeouts"),

#Loc: <Workspace>/Engine/Plugins/Developer/Concert/ConcertSync/ConcertSyncClient/Source/ConcertSyncClient/Private/Replication/Manager/ReplicationManagerState_Connected.cpp:133

Scope (from outer to inner):

file
namespace    UE::ConcertSyncClient::Replication
function     TFuture<FConcertReplication_ChangeAuthority_Response> FReplicationManagerState_Connected::RequestAuthorityChange

Source code excerpt:

	TFuture<FConcertReplication_ChangeAuthority_Response> FReplicationManagerState_Connected::RequestAuthorityChange(FConcertReplication_ChangeAuthority_Request Args)
	{
		if (CVarSimulateAuthorityTimeouts.GetValueOnGameThread())
		{
			return MakeFulfilledPromise<FConcertReplication_ChangeAuthority_Response>(FConcertReplication_ChangeAuthority_Response{ EReplicationResponseErrorCode::Timeout }).GetFuture();
		}
		if (CVarSimulateAuthorityRejection.GetValueOnGameThread())
		{
			return RejectAll(MoveTemp(Args));