p.SkipDesyncTest
p.SkipDesyncTest
#Overview
name: p.SkipDesyncTest
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Skips hard desync test, this means all particles will assume to be clean except spawning at different times. This is useful for a perf lower bound, not actually correct
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.SkipDesyncTest
is to control the desynchronization test in the Chaos physics system of Unreal Engine 5. It is used to skip the hard desync test, which assumes all particles are clean except for those spawning at different times. This variable is primarily used for performance testing and is not intended for correct simulation behavior.
This setting variable is primarily used in the Chaos physics subsystem, which is part of the Experimental module in Unreal Engine 5. It’s specifically utilized in the rewind and resimulation functionality of the physics system.
The value of this variable is set through a console variable (CVar) named “p.SkipDesyncTest”. It’s initialized to 0 by default, meaning the desync test is not skipped.
The SkipDesyncTest
variable interacts directly with the associated variable of the same name. They share the same value and are used interchangeably in the code.
Developers must be aware that:
- This variable is meant for performance testing and not for accurate physics simulation.
- Setting this variable to a non-zero value will skip important synchronization checks, which could lead to incorrect physics behavior.
- It’s part of the experimental Chaos physics system, so its behavior may change in future engine versions.
Best practices when using this variable include:
- Only use it for performance profiling or debugging purposes.
- Always reset it to 0 for final builds or when accurate physics simulation is required.
- Be cautious when interpreting results from simulations where this variable is set to skip the desync test.
Regarding the associated variable SkipDesyncTest
:
- It’s an int32 variable defined in the Chaos namespace.
- It’s used in various functions within the
FRewindData
class to control whether desynchronization checks and actions are performed. - When set to a non-zero value, it prevents the
DesyncObject
function from being called and affects the behavior of particle synchronization during resimulation. - Developers should treat it with the same caution as the console variable, understanding that it’s a performance optimization tool that can affect simulation accuracy.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/RewindData.cpp:517
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
CHAOS_API int32 SkipDesyncTest = 0;
FAutoConsoleVariableRef CVarSkipDesyncTest(TEXT("p.SkipDesyncTest"), SkipDesyncTest, TEXT("Skips hard desync test, this means all particles will assume to be clean except spawning at different times. This is useful for a perf lower bound, not actually correct"));
void FRewindData::AdvanceFrameImp(IResimCacheBase* ResimCache)
{
FramesSaved = FMath::Min(FramesSaved + 1, static_cast<int32>(Managers.Capacity()));
const int32 EarliestFrame = CurFrame - FramesSaved;
#Associated Variable and Callsites
This variable is associated with another variable named SkipDesyncTest
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/RewindData.cpp:392
Scope (from outer to inner):
file
namespace Chaos
function void FRewindData::DesyncIfNecessary
Source code excerpt:
if (Handle->SyncState() == ESyncState::InSync && !History.template IsInSync<bSkipDynamics>(*Handle, FrameAndPhase, PropertiesPool))
{
if (!SkipDesyncTest)
{
//first time desyncing so need to clear history from this point into the future
DesyncObject(Info, FrameAndPhase);
}
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/RewindData.cpp:516
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
}
CHAOS_API int32 SkipDesyncTest = 0;
FAutoConsoleVariableRef CVarSkipDesyncTest(TEXT("p.SkipDesyncTest"), SkipDesyncTest, TEXT("Skips hard desync test, this means all particles will assume to be clean except spawning at different times. This is useful for a perf lower bound, not actually correct"));
void FRewindData::AdvanceFrameImp(IResimCacheBase* ResimCache)
{
FramesSaved = FMath::Min(FramesSaved + 1, static_cast<int32>(Managers.Capacity()));
const int32 EarliestFrame = CurFrame - FramesSaved;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/RewindData.cpp:550
Scope (from outer to inner):
file
namespace Chaos
function void FRewindData::AdvanceFrameImp
lambda-function
Source code excerpt:
}
if (IsResim() && Handle->SyncState() != ESyncState::InSync && !SkipDesyncTest)
{
Handle->SetEnabledDuringResim(true); //for now just mark anything out of sync as resim enabled. TODO: use bubble
DesyncFunc(Handle);
}
AdvanceDirtyFunc(Info, Handle);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/RewindData.h:1366
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
};
extern CHAOS_API int32 SkipDesyncTest;
class FPBDRigidsSolver;
class FRewindData
{
public: