ClusterUnion.FlushNetDormancyOnSyncProxy

ClusterUnion.FlushNetDormancyOnSyncProxy

#Overview

name: ClusterUnion.FlushNetDormancyOnSyncProxy

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.FlushNetDormancyOnSyncProxy is to control the network behavior of the Cluster Union system in Unreal Engine 5, specifically regarding the synchronization of rigid states between the server and clients.

This setting variable is primarily used in the physics engine subsystem, particularly within the Cluster Union component. It’s part of the Engine module, focusing on network replication and physics synchronization.

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

The associated variable bFlushNetDormancyOnSyncProxy directly interacts with this setting. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects network performance and synchronization behavior. When set to true, it ensures that new rigid states on the authority (server) are immediately propagated to clients, even if the object is in a net dormant state.

Best practices when using this variable include:

  1. Consider the network performance implications of frequent dormancy flushing.
  2. Use it in conjunction with other network optimization techniques.
  3. Test thoroughly in networked environments to ensure desired behavior.

Regarding the associated variable bFlushNetDormancyOnSyncProxy:

It’s a boolean variable used within the UClusterUnionComponent class. Its primary purpose is to determine whether to flush net dormancy when syncing the cluster union from a proxy.

This variable is used in the SyncClusterUnionFromProxy function of the UClusterUnionComponent. When true, it causes the owner actor to flush its net dormancy, ensuring that the new rigid state data is immediately sent to clients.

Developers should be cautious when modifying this variable, as it can significantly impact network traffic and synchronization behavior. It’s particularly important in scenarios where precise physics replication is crucial, even at the cost of increased network activity.

Best practices for using bFlushNetDormancyOnSyncProxy include:

  1. Consider the trade-off between responsiveness and network efficiency.
  2. Use it judiciously, especially in games with many physics objects or limited network bandwidth.
  3. Combine it with other optimizations to balance network load and physics accuracy.

#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:42

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


	bool bFlushNetDormancyOnSyncProxy = true;
	FAutoConsoleVariableRef CVarFlushNetDormancyOnSyncProxy(TEXT("ClusterUnion.FlushNetDormancyOnSyncProxy"), bFlushNetDormancyOnSyncProxy, TEXT("When there is a new rigid state on the authority, flush net dormancy so that even if this object is net dorman the rigid state will come through to the client."));

	bool GSkipZeroStateInOnRep = true;
	FAutoConsoleVariableRef CVarSkipZeroState(TEXT("ClusterUnion.SkipZeroStateInOnRep"), GSkipZeroStateInOnRep, TEXT("Whether we skip 0 (uninitialized) states when running the onrep for the replicated rigid state of the cluster union"));

	template<typename PayloadType>
	struct TClusterUnionAABBTreeStorageTraits

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	FAutoConsoleVariableRef CVarDirtyRigidStateOnlyIfChanged(TEXT("ClusterUnion.DirtyRigidStateOnlyIfChanged"), bDirtyRigidStateOnlyIfChanged, TEXT("Add a check for changed rigid state before marking it dirty and updating the replicated data. No need to flush an update if there was no change."));

	bool bFlushNetDormancyOnSyncProxy = true;
	FAutoConsoleVariableRef CVarFlushNetDormancyOnSyncProxy(TEXT("ClusterUnion.FlushNetDormancyOnSyncProxy"), bFlushNetDormancyOnSyncProxy, TEXT("When there is a new rigid state on the authority, flush net dormancy so that even if this object is net dorman the rigid state will come through to the client."));

	bool GSkipZeroStateInOnRep = true;
	FAutoConsoleVariableRef CVarSkipZeroState(TEXT("ClusterUnion.SkipZeroStateInOnRep"), GSkipZeroStateInOnRep, TEXT("Whether we skip 0 (uninitialized) states when running the onrep for the replicated rigid state of the cluster union"));

	template<typename PayloadType>
	struct TClusterUnionAABBTreeStorageTraits

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

Scope (from outer to inner):

file
function     void UClusterUnionComponent::SyncClusterUnionFromProxy

Source code excerpt:

			// Make sure that the new dirty data gets flushed through to clients even if the actor
			// has been made net dormant.
			if (bFlushNetDormancyOnSyncProxy)
			{
				if (AActor* Owner = GetOwner())
				{
					Owner->FlushNetDormancy();
				}
			}