p.GeometryCollectionRepMaxExtrapolationTime

p.GeometryCollectionRepMaxExtrapolationTime

#Overview

name: p.GeometryCollectionRepMaxExtrapolationTime

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.GeometryCollectionRepMaxExtrapolationTime is to control the maximum duration for which replicated physics data will persist and extrapolate velocities for a Geometry Collection in Unreal Engine 5.

This setting variable is primarily used in the Geometry Collection Engine module, which is part of Unreal Engine’s experimental features for handling complex physics simulations and destruction effects.

The value of this variable is set to 3.0 seconds by default, as seen in the source code:

float GeometryCollectionRepMaxExtrapolationTime = 3.f;

It is defined as a console variable, allowing developers to modify its value at runtime:

FAutoConsoleVariableRef CVarGeometryCollectionRepMaxExtrapolationTime(TEXT("p.GeometryCollectionRepMaxExtrapolationTime"), GeometryCollectionRepMaxExtrapolationTime, TEXT("Number of seconds that replicated physics data will persist for a GC, extrapolating velocities"));

The variable interacts with the replication system for Geometry Collections. It is used in the ProcessRepDataCommon and ProcessRepDynamicDataCommon functions to determine when to stop tracking the last received replication data:

if (RepExtrapTime > GeometryCollectionRepMaxExtrapolationTime)
{
    return false;
}

Developers should be aware that this variable affects network replication behavior for Geometry Collections. Setting it too low might result in choppy movement for replicated objects, while setting it too high could lead to inaccuracies in physics simulation over the network.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your project and network conditions.
  2. Testing thoroughly with various network conditions to ensure smooth gameplay.
  3. Considering the trade-off between smooth movement and accurate physics representation.

The associated variable GeometryCollectionRepMaxExtrapolationTime is the actual float value that stores the maximum extrapolation time. It is used directly in the code and shares the same value as the console variable. This variable is used in the same context and with the same considerations as the console variable. Developers should be aware that modifying the console variable will affect this associated variable, and vice versa.

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

Scope: file

Source code excerpt:


float GeometryCollectionRepMaxExtrapolationTime = 3.f;
FAutoConsoleVariableRef CVarGeometryCollectionRepMaxExtrapolationTime(TEXT("p.GeometryCollectionRepMaxExtrapolationTime"), GeometryCollectionRepMaxExtrapolationTime, TEXT("Number of seconds that replicated physics data will persist for a GC, extrapolating velocities"));

bool bGeometryCollectionDebugDrawRep = 0;
FAutoConsoleVariableRef CVarGeometryCollectionDebugDrawRep(TEXT("p.Chaos.DebugDraw.GeometryCollectionReplication"), bGeometryCollectionDebugDrawRep,
	TEXT("If true debug draw deltas and corrections for geometry collection replication"));

bool bGeometryCollectionRepUseClusterVelocityMatch = true;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:2496

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarGeometryCollectionRepAngularMatchTime(TEXT("p.GeometryCollectionRepAngularMatchTime"), GeometryCollectionRepAngularMatchTime, TEXT("In seconds, how quickly should the angle match the replicated target angle"));

float GeometryCollectionRepMaxExtrapolationTime = 3.f;
FAutoConsoleVariableRef CVarGeometryCollectionRepMaxExtrapolationTime(TEXT("p.GeometryCollectionRepMaxExtrapolationTime"), GeometryCollectionRepMaxExtrapolationTime, TEXT("Number of seconds that replicated physics data will persist for a GC, extrapolating velocities"));

bool bGeometryCollectionDebugDrawRep = 0;
FAutoConsoleVariableRef CVarGeometryCollectionDebugDrawRep(TEXT("p.Chaos.DebugDraw.GeometryCollectionReplication"), bGeometryCollectionDebugDrawRep,
	TEXT("If true debug draw deltas and corrections for geometry collection replication"));

bool bGeometryCollectionRepUseClusterVelocityMatch = true;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:2677

Scope (from outer to inner):

file
namespace    anonymous
function     bool ProcessRepDataCommon

Source code excerpt:

		// If we've extrapolated past a threshold, then stop tracking
		// the last received rep data
		if (RepExtrapTime > GeometryCollectionRepMaxExtrapolationTime)
		{
			return false;
		}

		// Create a little little function for applying a lambda to each
		// corresponding pair of replicated and local clusters.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:2873

Scope (from outer to inner):

file
namespace    anonymous
function     bool ProcessRepDynamicDataCommon

Source code excerpt:

		// If we've extrapolated past a threshold, then stop tracking
		// the last received rep data
		if (RepExtrapTime > GeometryCollectionRepMaxExtrapolationTime)
		{
			return false;
		}

		const bool bHardSnap = ReplicationShouldHardSnap(RepDynamicData.Version, VersionProcessed, bReplicateMovement, LastHardsnapTimeInMs);