p.SerializeEvolution

p.SerializeEvolution

#Overview

name: p.SerializeEvolution

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.SerializeEvolution is to control the serialization of the Chaos physics evolution process in Unreal Engine 5. This setting is primarily used for debugging and testing purposes within the Chaos physics system.

This setting variable is used in the Chaos module, which is part of Unreal Engine’s experimental physics system. Specifically, it’s used in the PBDRigidsEvolutionGBF (Position Based Dynamics Rigid Evolution Game and Broadcast Framework) class, which is responsible for advancing the physics simulation.

The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 and can be changed at runtime using console commands.

The associated variable SerializeEvolution interacts directly with p.SerializeEvolution. They share the same value and are used interchangeably in the code.

Developers should be aware that this variable is only used in non-shipping builds (#if !UE_BUILD_SHIPPING). It’s primarily a debugging tool and should not be relied upon for gameplay or release builds.

When using this variable, best practices include:

  1. Only enable it when necessary for debugging or testing purposes.
  2. Be aware of potential performance implications when enabled, as serialization can be a costly operation.
  3. Ensure it’s disabled in shipping builds to prevent unnecessary overhead.

Regarding the associated variable SerializeEvolution:

The purpose of SerializeEvolution is the same as p.SerializeEvolution. It’s an integer variable that controls whether the physics evolution should be serialized to disk.

This variable is used directly in the AdvanceOneTimeStepImpl function of the FPBDRigidsEvolutionGBF class. When SerializeEvolution is non-zero, it triggers a call to SerializeToDisk(*this) at specific points during the physics step.

The value of SerializeEvolution is set through the console variable system, initialized to 0, and can be changed at runtime.

As with p.SerializeEvolution, developers should be aware that this is a debugging tool, only available in non-shipping builds, and should be used cautiously due to potential performance impacts.

Best practices for using SerializeEvolution include:

  1. Use it sparingly and only when investigating specific physics-related issues.
  2. Remember to disable it after debugging to avoid unnecessary disk writes and performance overhead.
  3. Be prepared to handle and analyze the serialized data when using this feature.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:165

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:


		int32 SerializeEvolution = 0;
		FAutoConsoleVariableRef CVarSerializeEvolution(TEXT("p.SerializeEvolution"), SerializeEvolution, TEXT(""));

		bool bChaos_CollisionStore_Enabled = true;
		FAutoConsoleVariableRef CVarCollisionStoreEnabled(TEXT("p.Chaos.CollisionStore.Enabled"), bChaos_CollisionStore_Enabled, TEXT(""));

		// Put the solver into a mode where it reset particles to their initial positions each frame.
		// This is used to test collision detection and - it will be removed

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:164

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:



		int32 SerializeEvolution = 0;
		FAutoConsoleVariableRef CVarSerializeEvolution(TEXT("p.SerializeEvolution"), SerializeEvolution, TEXT(""));

		bool bChaos_CollisionStore_Enabled = true;
		FAutoConsoleVariableRef CVarCollisionStoreEnabled(TEXT("p.Chaos.CollisionStore.Enabled"), bChaos_CollisionStore_Enabled, TEXT(""));

		// Put the solver into a mode where it reset particles to their initial positions each frame.
		// This is used to test collision detection and - it will be removed

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:439

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsEvolutionGBF::AdvanceOneTimeStepImpl

Source code excerpt:


#if !UE_BUILD_SHIPPING
	if (SerializeEvolution)
	{
		SerializeToDisk(*this);
	}
#endif

	{

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:732

Scope (from outer to inner):

file
namespace    Chaos
function     void FPBDRigidsEvolutionGBF::AdvanceOneTimeStepImpl

Source code excerpt:


#if !UE_BUILD_SHIPPING
	if(SerializeEvolution)
	{
		SerializeToDisk(*this);
	}
#endif
}