p.Chaos.Solver.Deterministic
p.Chaos.Solver.Deterministic
#Overview
name: p.Chaos.Solver.Deterministic
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override determinism. 0: disabled; 1: enabled; -1: use config
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Solver.Deterministic is to control the determinism of the Chaos physics solver in Unreal Engine 5. This setting variable is used to override the deterministic behavior of the solver.
This setting variable is primarily used in the Chaos physics system, which is part of the Experimental module in Unreal Engine 5. It’s specifically utilized within the PBDRigidsSolver (Position Based Dynamics Rigid Solver) component of the Chaos system.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, which means determinism is enabled by default. The variable can be changed at runtime using console commands.
The associated variable ChaosSolverDeterministic interacts directly with p.Chaos.Solver.Deterministic. They share the same value, and ChaosSolverDeterministic is used in the actual logic of the solver.
Developers must be aware that this variable has three possible states: 0: Determinism is disabled 1: Determinism is enabled -1: Use the configuration setting
When using this variable, developers should consider the following best practices:
- Understand the implications of enabling or disabling determinism in physics simulations.
- Use the configuration setting (-1) for most production scenarios to allow for easier management across different environments.
- Only override this setting (0 or 1) when specifically testing or debugging determinism-related issues.
- Be aware that changing this setting can affect the reproducibility of physics simulations across different runs or platforms.
Regarding the associated variable ChaosSolverDeterministic:
The purpose of ChaosSolverDeterministic is to directly control the deterministic behavior within the Chaos solver’s code.
It’s used in the Chaos physics system, specifically within the PBDRigidsSolver component.
The value is set by the p.Chaos.Solver.Deterministic console variable.
This variable interacts with other parts of the solver, particularly in the PrepareAdvanceBy and IsDetemerministic functions of the FPBDRigidsSolver class.
Developers should be aware that this variable affects the solver’s behavior and can impact performance and simulation consistency.
Best practices for using ChaosSolverDeterministic include:
- Avoid modifying it directly in code; instead, use the p.Chaos.Solver.Deterministic console variable.
- Consider the impact on physics simulation behavior when changing this value.
- Use it in conjunction with other solver settings for comprehensive control over the physics simulation.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:319
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
int32 ChaosSolverDeterministic = 1;
FAutoConsoleVariableRef CVarChaosSolverDeterministic(TEXT("p.Chaos.Solver.Deterministic"), ChaosSolverDeterministic, TEXT("Override determinism. 0: disabled; 1: enabled; -1: use config"));
// Copied from RBAN
FRealSingle ChaosSolverJointPositionTolerance = 0.025f;
FAutoConsoleVariableRef CVarChaosSolverJointPositionTolerance(TEXT("p.Chaos.Solver.Joint.PositionTolerance"), ChaosSolverJointPositionTolerance, TEXT("PositionTolerance."));
FRealSingle ChaosSolverJointAngleTolerance = 0.001f;
FAutoConsoleVariableRef CVarChaosSolverJointAngleTolerance(TEXT("p.Chaos.Solver.Joint.AngleTolerance"), ChaosSolverJointAngleTolerance, TEXT("AngleTolerance."));
#Associated Variable and Callsites
This variable is associated with another variable named ChaosSolverDeterministic
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:318
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
FAutoConsoleVariableRef CVarChaosSolverProjectionIterations(TEXT("p.Chaos.Solver.Iterations.Projection"), ChaosSolverProjectionIterations, TEXT("Override number of solver projection iterations (-1 to use config)"));
int32 ChaosSolverDeterministic = 1;
FAutoConsoleVariableRef CVarChaosSolverDeterministic(TEXT("p.Chaos.Solver.Deterministic"), ChaosSolverDeterministic, TEXT("Override determinism. 0: disabled; 1: enabled; -1: use config"));
// Copied from RBAN
FRealSingle ChaosSolverJointPositionTolerance = 0.025f;
FAutoConsoleVariableRef CVarChaosSolverJointPositionTolerance(TEXT("p.Chaos.Solver.Joint.PositionTolerance"), ChaosSolverJointPositionTolerance, TEXT("PositionTolerance."));
FRealSingle ChaosSolverJointAngleTolerance = 0.001f;
FAutoConsoleVariableRef CVarChaosSolverJointAngleTolerance(TEXT("p.Chaos.Solver.Joint.AngleTolerance"), ChaosSolverJointAngleTolerance, TEXT("AngleTolerance."));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:1360
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsSolver::PrepareAdvanceBy
Source code excerpt:
SetCollisionDepenetrationVelocity(ChaosSolverDepenetrationVelocity);
}
if (ChaosSolverDeterministic >= 0)
{
UpdateIsDeterministic();
}
}
UE_LOG(LogPBDRigidsSolver, Verbose, TEXT("PBDRigidsSolver::Tick(%3.5f)"), DeltaTime);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/PBDRigidsSolver.cpp:2714
Scope (from outer to inner):
file
namespace Chaos
function bool FPBDRigidsSolver::IsDetemerministic
Source code excerpt:
bool FPBDRigidsSolver::IsDetemerministic() const
{
return bIsDeterministic || (MRewindData != nullptr) || (ChaosSolverDeterministic >= 1) || FPhysicsSolverBase::IsNetworkPhysicsPredictionEnabled();
}
void FPBDRigidsSolver::SetIsDeterministic(const bool bInIsDeterministic)
{
if (bIsDeterministic != bInIsDeterministic)
{