p.Chaos.GC.UseReplicationV2
p.Chaos.GC.UseReplicationV2
#Overview
name: p.Chaos.GC.UseReplicationV2
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When true use new replication data model
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.GC.UseReplicationV2 is to control the usage of a new replication data model for Geometry Collection components in Unreal Engine’s Chaos physics system.
This setting variable is primarily used in the Geometry Collection subsystem, which is part of Unreal Engine’s Chaos physics system. It specifically affects the replication behavior of Geometry Collection components.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be modified at runtime through console commands or configuration files. By default, it is set to true.
The associated variable GeometryCollectionUseReplicationV2 directly interacts with p.Chaos.GC.UseReplicationV2. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable controls a significant change in the replication model for Geometry Collections. When set to true, it enables a new replication data model, which may affect network behavior and performance.
Best practices when using this variable include:
- Testing thoroughly in networked environments to ensure compatibility with the new replication model.
- Being consistent across all instances of a project to avoid mismatched replication behaviors.
- Considering performance implications when enabling or disabling this feature.
Regarding the associated variable GeometryCollectionUseReplicationV2:
The purpose of GeometryCollectionUseReplicationV2 is the same as p.Chaos.GC.UseReplicationV2 - to control the usage of the new replication data model for Geometry Collection components.
This variable is used directly in the GeometryCollectionComponent class to determine the behavior of certain methods, such as UpdateRepData, ProcessRepStateDataOnPT, and ProcessRepDynamicDataOnPT.
The value of GeometryCollectionUseReplicationV2 is set by the console variable p.Chaos.GC.UseReplicationV2, allowing for runtime modification.
Developers should be aware that this variable directly affects the replication logic in Geometry Collection components. When true, it enables new methods for handling replication data.
Best practices for using GeometryCollectionUseReplicationV2 include:
- Ensuring all related systems and network code are compatible with the new replication model when enabled.
- Monitoring performance differences between the old and new replication models.
- Updating any custom code that interacts with Geometry Collection replication to account for both replication models.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:135
Scope: file
Source code excerpt:
bool GeometryCollectionUseReplicationV2 = true;
FAutoConsoleVariableRef CVarGeometryCollectionUseReplicationV2(TEXT("p.Chaos.GC.UseReplicationV2"), GeometryCollectionUseReplicationV2, TEXT("When true use new replication data model"));
int32 GeometryCollectionNetAwakeningMode = 1;
FAutoConsoleVariableRef CVarGeometryCollectionNetAwakeningMode(TEXT("p.Chaos.GC.NetAwakeningMode"), GeometryCollectionNetAwakeningMode, TEXT("Changes how GC components ensure that their owner is awake for replication. 0 = ForceDormancyAwake, 1 = Use Flush Net Dormancy"));
DEFINE_LOG_CATEGORY_STATIC(UGCC_LOG, Error, All);
DEFINE_LOG_CATEGORY_STATIC(LogGeometryCollectionComponent, Warning, All);
#Associated Variable and Callsites
This variable is associated with another variable named GeometryCollectionUseReplicationV2
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:134
Scope: file
Source code excerpt:
FAutoConsoleVariableRef CVarGeometryCollectionRootProxyComponents(TEXT("p.Chaos.GC.EnableRootProxyComponents"), GeometryCollectionEnableRootProxyComponents, TEXT("when on ( by default ) , create root proxy components"));
bool GeometryCollectionUseReplicationV2 = true;
FAutoConsoleVariableRef CVarGeometryCollectionUseReplicationV2(TEXT("p.Chaos.GC.UseReplicationV2"), GeometryCollectionUseReplicationV2, TEXT("When true use new replication data model"));
int32 GeometryCollectionNetAwakeningMode = 1;
FAutoConsoleVariableRef CVarGeometryCollectionNetAwakeningMode(TEXT("p.Chaos.GC.NetAwakeningMode"), GeometryCollectionNetAwakeningMode, TEXT("Changes how GC components ensure that their owner is awake for replication. 0 = ForceDormancyAwake, 1 = Use Flush Net Dormancy"));
DEFINE_LOG_CATEGORY_STATIC(UGCC_LOG, Error, All);
DEFINE_LOG_CATEGORY_STATIC(LogGeometryCollectionComponent, Warning, All);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:2096
Scope (from outer to inner):
file
function void UGeometryCollectionComponent::UpdateRepData
Source code excerpt:
void UGeometryCollectionComponent::UpdateRepData()
{
if (GeometryCollectionUseReplicationV2)
{
return UpdateRepStateAndDynamicData();
}
check(GetNetMode() != ENetMode::NM_Client);
using namespace Chaos;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:3024
Scope (from outer to inner):
file
function void UGeometryCollectionComponent::ProcessRepStateDataOnPT
Source code excerpt:
void UGeometryCollectionComponent::ProcessRepStateDataOnPT()
{
ensure(GeometryCollectionUseReplicationV2);
if (Chaos::FPhysicsSolver* CurrSolver = GetSolver(*this))
{
// enqueue a callback to process the replicated state data on the physics thread
CurrSolver->EnqueueCommandImmediate(
[PhysicsProxy = PhysicsProxy, RepStateDataCopy = RepStateData, &VersionProcessed = VersionProcessed]
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:3040
Scope (from outer to inner):
file
function void UGeometryCollectionComponent::ProcessRepDynamicDataOnPT
Source code excerpt:
void UGeometryCollectionComponent::ProcessRepDynamicDataOnPT()
{
ensure(GeometryCollectionUseReplicationV2);
if (Chaos::FPhysicsSolver* CurrSolver = GetSolver(*this))
{
AActor* Owner = GetOwner();
const bool bReplicateMovement = Owner ? GetOwner()->IsReplicatingMovement() : true;