ClusterUnion.UseLocalRoleForAuthorityCheck

ClusterUnion.UseLocalRoleForAuthorityCheck

#Overview

name: ClusterUnion.UseLocalRoleForAuthorityCheck

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 ClusterUnion.UseLocalRoleForAuthorityCheck is to determine how authority is checked for cluster union components in the Unreal Engine’s physics system. This setting variable is part of the physics engine subsystem, specifically related to the ClusterUnion functionality.

Based on the details in the Callsites section, this setting variable is used within the Engine module, particularly in the PhysicsEngine subsystem. It’s referenced in the ClusterUnionComponent.cpp file, which suggests it’s specifically tied to the ClusterUnionComponent functionality.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through the console. By default, it’s set to true.

This variable interacts directly with the associated boolean variable bUseLocalRoleForAuthorityCheck. They share the same value, and the console variable essentially controls the value of this boolean.

Developers must be aware that this variable affects how authority is determined for ClusterUnionComponents. When set to true, only the local role of the component’s owner is checked to determine authority, which could have implications for networked gameplay.

Best practices when using this variable include:

  1. Understanding the networking implications of using local role for authority checks.
  2. Ensuring consistency across networked instances if modified.
  3. Using the console command to adjust this setting during development and testing to observe its effects.

Regarding the associated variable bUseLocalRoleForAuthorityCheck:

The purpose of bUseLocalRoleForAuthorityCheck is to act as the runtime boolean that the ClusterUnionComponent uses to determine how to check for authority.

This variable is used directly in the UClusterUnionComponent::IsAuthority() function. When true, it causes the function to return true if the owner’s local role is ROLE_Authority.

The value of this variable is set by the console variable we discussed earlier, allowing for runtime modification.

This variable doesn’t appear to interact with other variables beyond its relationship with the console variable.

Developers should be aware that changing this variable will directly affect how authority is determined for ClusterUnionComponents, which could have significant implications for gameplay, especially in networked environments.

Best practices for this variable include:

  1. Carefully considering the networking architecture before modifying this value.
  2. Testing thoroughly in both single-player and multiplayer scenarios when changes are made.
  3. Documenting any non-default usage of this variable to ensure consistency across the development team.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ClusterUnionComponent.cpp:27

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


	bool bUseLocalRoleForAuthorityCheck = true;
	FAutoConsoleVariableRef CVarUseLocalRoleForAuthorityCheck(TEXT("ClusterUnion.UseLocalRoleForAuthorityCheck"), bUseLocalRoleForAuthorityCheck, TEXT("If true, we will only check this component's owner local role to determine authority"));

	bool bPreAllocateLocalBoneDataMap = true;
	FAutoConsoleVariableRef CVarPreAllocateLocalBoneDataMap(TEXT("ClusterUnion.PreAllocateLocalBoneDataMap"), bPreAllocateLocalBoneDataMap, TEXT("If true, it will reserve an expected size for the local map used to cache updated bone data"));

	float LocalBoneDataMapGrowFactor = 1.2f;
	FAutoConsoleVariableRef CVarLocalBoneDataMapGrowFactor(TEXT("ClusterUnion.LocalBoneDataMapGrowFactor"), LocalBoneDataMapGrowFactor, TEXT("Grow factor to apply to the size of bone data array of pre-existing component when preallocating the local bones data map"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ClusterUnionComponent.cpp:26

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	FAutoConsoleVariableRef CVarUseClusterUnionAccelerationStructure(TEXT("ClusterUnion.UseAccelerationStructure"), bUseClusterUnionAccelerationStructure, TEXT("Whether component level sweeps and overlaps against cluster unions should use an acceleration structure instead."));

	bool bUseLocalRoleForAuthorityCheck = true;
	FAutoConsoleVariableRef CVarUseLocalRoleForAuthorityCheck(TEXT("ClusterUnion.UseLocalRoleForAuthorityCheck"), bUseLocalRoleForAuthorityCheck, TEXT("If true, we will only check this component's owner local role to determine authority"));

	bool bPreAllocateLocalBoneDataMap = true;
	FAutoConsoleVariableRef CVarPreAllocateLocalBoneDataMap(TEXT("ClusterUnion.PreAllocateLocalBoneDataMap"), bPreAllocateLocalBoneDataMap, TEXT("If true, it will reserve an expected size for the local map used to cache updated bone data"));

	float LocalBoneDataMapGrowFactor = 1.2f;
	FAutoConsoleVariableRef CVarLocalBoneDataMapGrowFactor(TEXT("ClusterUnion.LocalBoneDataMapGrowFactor"), LocalBoneDataMapGrowFactor, TEXT("Grow factor to apply to the size of bone data array of pre-existing component when preallocating the local bones data map"));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/ClusterUnionComponent.cpp:651

Scope (from outer to inner):

file
function     bool UClusterUnionComponent::IsAuthority

Source code excerpt:

bool UClusterUnionComponent::IsAuthority() const
{
	if (bUseLocalRoleForAuthorityCheck)
	{
		if (AActor* Owner = GetOwner())
        {
        	return Owner->GetLocalRole() == ROLE_Authority;
        }