p.Chaos.Collision.ABTestSolver
p.Chaos.Collision.ABTestSolver
#Overview
name: p.Chaos.Collision.ABTestSolver
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.Collision.ABTestSolver is to enable A/B testing for collision solvers in the Chaos physics system of Unreal Engine 5. This setting variable is primarily used for development and testing purposes, specifically for comparing the performance and results of different collision solving algorithms.
This setting variable is used in the Chaos physics module, which is part of Unreal Engine’s experimental physics system. Based on the callsites, it’s clear that this variable is utilized in the collision constraints subsystem of the Chaos physics engine.
The value of this variable is set through the Unreal Engine console system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands.
The associated variable bCollisionsEnableSolverABTest directly interacts with p.Chaos.Collision.ABTestSolver. They share the same value, with bCollisionsEnableSolverABTest being the C++ boolean variable that’s actually used in the code logic.
Developers must be aware that this variable is intended for testing and development purposes. Enabling it will likely impact performance, as it runs two collision solvers simultaneously for comparison. It should not be enabled in production builds or final game releases.
Best practices when using this variable include:
- Only enable it when actively developing or debugging collision systems.
- Use it to compare the results of the standard collision solver with the SIMD (Single Instruction, Multiple Data) version.
- Be prepared for potential performance impacts when enabled.
- Disable it for any performance profiling or final builds.
Regarding the associated variable bCollisionsEnableSolverABTest:
The purpose of bCollisionsEnableSolverABTest is to serve as the in-code boolean flag that controls whether the A/B testing for collision solvers is active.
This variable is used within the Chaos physics module, specifically in the collision constraints system. It’s checked when creating the group solver for collisions.
The value of this variable is set through the console variable p.Chaos.Collision.ABTestSolver, which we discussed earlier.
When this variable is true, it causes the creation of an FABTestingCollisionContainerSolver instead of a standard collision solver. This testing solver likely runs both the standard and SIMD versions of the collision solver for comparison.
Developers should be aware that this flag directly impacts the type of collision solver used, and enabling it will have performance implications due to the simultaneous execution of two solvers.
Best practices for using this variable include:
- Only enable it in development builds when actively working on or testing collision systems.
- Use it in conjunction with appropriate logging or profiling tools to compare the results of the two solvers.
- Always ensure it’s disabled for release builds or when performing general performance testing.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionConstraints.cpp:106
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
{
bool bCollisionsEnableSolverABTest = false;
FAutoConsoleVariableRef CVarCollisionsEnableSolverABTest(TEXT("p.Chaos.Collision.ABTestSolver"), bCollisionsEnableSolverABTest, TEXT(""));
}
// An AB Testing collision solver for use while developing the Simd version
using FABTestingCollisionContainerSolver = Private::TABTestingConstraintContainerSolver<FPBDCollisionContainerSolver, Private::FPBDCollisionContainerSolverSimd>;
// Simd AB testing callback
#Associated Variable and Callsites
This variable is associated with another variable named bCollisionsEnableSolverABTest
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionConstraints.cpp:105
Scope (from outer to inner):
file
namespace Chaos
namespace CVars
Source code excerpt:
namespace CVars
{
bool bCollisionsEnableSolverABTest = false;
FAutoConsoleVariableRef CVarCollisionsEnableSolverABTest(TEXT("p.Chaos.Collision.ABTestSolver"), bCollisionsEnableSolverABTest, TEXT(""));
}
// An AB Testing collision solver for use while developing the Simd version
using FABTestingCollisionContainerSolver = Private::TABTestingConstraintContainerSolver<FPBDCollisionContainerSolver, Private::FPBDCollisionContainerSolverSimd>;
// Simd AB testing callback
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDCollisionConstraints.cpp:378
Scope (from outer to inner):
file
namespace Chaos
function TUniquePtr<FConstraintContainerSolver> FPBDCollisionConstraints::CreateGroupSolver
Source code excerpt:
case Private::ECollisionSolverType::GaussSeidelSimd:
#if CHAOS_ABTEST_CONSTRAINTSOLVER_ENABLED
if (CVars::bCollisionsEnableSolverABTest)
{
// Create an AB testing collision solver for simd testing
return MakeUnique<FABTestingCollisionContainerSolver>(
MakeUnique<FPBDCollisionContainerSolver>(*this, Priority),
MakeUnique<Private::FPBDCollisionContainerSolverSimd>(*this, Priority),
Priority,