bEnableEnhancedDeterminism

bEnableEnhancedDeterminism

#Overview

name: bEnableEnhancedDeterminism

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bEnableEnhancedDeterminism is to control enhanced determinism in the physics simulation within Unreal Engine 5. This setting is part of the physics system and is used to increase the predictability and consistency of physics simulations across different runs or platforms.

This setting variable is primarily used by the physics subsystem of Unreal Engine 5, specifically within the Chaos physics engine. It is referenced in the PhysicsCore module, which is a core component of Unreal Engine’s physics implementation.

The value of this variable is set in the UPhysicsSettingsCore class, which is derived from UDeveloperSettings. By default, it is initialized to false in the constructor of UPhysicsSettingsCore.

bEnableEnhancedDeterminism interacts with the SceneSolver in the Chaos physics system. When enabled, it sets the solver to a deterministic mode using the SetIsDeterministic method.

Developers should be aware that enabling enhanced determinism may come at the cost of slightly increased resource usage, as mentioned in the comment associated with the variable declaration. This trade-off should be considered when deciding whether to enable this feature.

Best practices when using this variable include:

  1. Only enable it when deterministic physics behavior is crucial for your game’s functionality or for debugging purposes.
  2. Be aware of the potential performance impact and test thoroughly when enabling this feature.
  3. Consider the implications on networked gameplay, as deterministic physics can help with consistency across clients.
  4. Use this setting in conjunction with other physics settings to achieve the desired balance between determinism, performance, and gameplay feel.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:333, section: [/Script/Engine.PhysicsSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/ChaosScene.cpp:92

Scope (from outer to inner):

file
function     FChaosScene::FChaosScene
lambda-function

Source code excerpt:

	{
		UPhysicsSettingsCore* Settings = UPhysicsSettingsCore::Get();
		SceneSolver->RegisterSimOneShotCallback([InSolver = SceneSolver, SolverConfigCopy = Settings->SolverOptions, bIsDeterministic = Settings->bEnableEnhancedDeterminism]()
		{
			InSolver->ApplyConfig(SolverConfigCopy);
			InSolver->SetIsDeterministic(bIsDeterministic);
		});
	}

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Private/PhysicsSettingsCore.cpp:32

Scope (from outer to inner):

file
function     UPhysicsSettingsCore::UPhysicsSettingsCore

Source code excerpt:

	, RagdollAggregateThreshold(4)
	, TriangleMeshTriangleMinAreaThreshold(5.0f)
	, bEnableEnhancedDeterminism(false)
	, bEnableShapeSharing(false)
	, bEnablePCM(true)
	, bEnableStabilization(false)
	, bWarnMissingLocks(true)
	, bEnable2DPhysics(false)
	, bDefaultHasComplexCollision_DEPRECATED(true)

#Loc: <Workspace>/Engine/Source/Runtime/PhysicsCore/Public/PhysicsSettingsCore.h:46

Scope (from outer to inner):

file
class        class UPhysicsSettingsCore: public UDeveloperSettings

Source code excerpt:

	/** If set to true, the scene will use enhanced determinism at the cost of a bit more resources. See eENABLE_ENHANCED_DETERMINISM to learn about the specifics */
	UPROPERTY(config,EditAnywhere,Category = Simulation)
	bool bEnableEnhancedDeterminism;

	/** Enables shape sharing between sync and async scene for static rigid actors */
	UPROPERTY(config,EditAnywhere,AdvancedDisplay,Category = Simulation)
	bool bEnableShapeSharing;

	/** Enables persistent contact manifolds. This will generate fewer contact points, but with more accuracy. Reduces stability of stacking, but can help energy conservation.*/