np2.TimeDilationEscalationDecayMax
np2.TimeDilationEscalationDecayMax
#Overview
name: np2.TimeDilationEscalationDecayMax
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Value is a multiplier, Default: 0.5. The max decay value for escalated time dilation. Lower value means higher decay.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of np2.TimeDilationEscalationDecayMax is to control the maximum decay value for escalated time dilation in Unreal Engine’s network physics system. It acts as a multiplier that affects how quickly the time dilation effect decays.
This setting variable is primarily used in the Engine module, specifically within the PlayerController component. It’s part of the network physics subsystem, which handles synchronization and smoothing of physics simulations across networked game sessions.
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be adjusted at runtime through the console. Its default value is 0.5f, but it can be changed dynamically.
np2.TimeDilationEscalationDecayMax interacts closely with other time dilation-related variables, such as np2.TimeDilationEscalationDecay, np2.TimeDilationMax, and np2.TimeDilationMin. These variables work together to control the bounds and behavior of time dilation in the network physics system.
Developers must be aware that this variable directly impacts the responsiveness and smoothness of networked physics. A lower value results in a higher decay rate, which can lead to more rapid changes in time dilation.
Best practices when using this variable include:
- Carefully tuning it in conjunction with other time dilation variables to achieve the desired network physics behavior.
- Testing thoroughly with various network conditions to ensure it provides a good balance between responsiveness and stability.
- Considering the implications on gameplay, especially for fast-paced or physics-heavy games.
Regarding the associated variable TimeDilationEscalationDecayMax:
This is the actual float variable that stores the value set by np2.TimeDilationEscalationDecayMax. It’s used directly in the code to calculate the time dilation decay.
The purpose of TimeDilationEscalationDecayMax is the same as np2.TimeDilationEscalationDecayMax - it represents the maximum decay value for escalated time dilation.
It’s used in the ServerSendLatestAsyncPhysicsTimestamp_Implementation function of the PlayerController class to calculate the TimeDilationDecay value, which in turn affects the CalculatedTimeDilation.
Developers should be aware that modifying TimeDilationEscalationDecayMax directly in code will not persist across sessions or be adjustable via the console. Instead, they should use the np2.TimeDilationEscalationDecayMax console variable to ensure consistent behavior and runtime adjustability.
Best practices for TimeDilationEscalationDecayMax include:
- Avoiding direct modification of this variable in code unless absolutely necessary.
- Using the associated console variable (np2.TimeDilationEscalationDecayMax) for adjustments and testing.
- Considering its impact in conjunction with other time dilation variables when fine-tuning network physics behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:144
Scope (from outer to inner):
file
namespace NetworkPhysicsCvars
Source code excerpt:
float TimeDilationEscalationDecayMax = 0.5f;
FAutoConsoleVariableRef CVarTimeDilationEscalationDecayMax(TEXT("np2.TimeDilationEscalationDecayMax"), TimeDilationEscalationDecayMax, TEXT("Value is a multiplier, Default: 0.5. The max decay value for escalated time dilation. Lower value means higher decay."));
float TimeDilationMax = 1.1f;
FAutoConsoleVariableRef CVarTimeDilationMax(TEXT("np2.TimeDilationMax"), TimeDilationMax, TEXT("Max value of the time dilation multiplier."));
float TimeDilationMin = 0.9f;
FAutoConsoleVariableRef CVarTimeDilationMin(TEXT("np2.TimeDilationMin"), TimeDilationMin, TEXT("Min value of the time dilation multiplier"));
#Associated Variable and Callsites
This variable is associated with another variable named TimeDilationEscalationDecayMax
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:143
Scope (from outer to inner):
file
namespace NetworkPhysicsCvars
Source code excerpt:
FAutoConsoleVariableRef CVarTimeDilationEscalationDecay(TEXT("np2.TimeDilationEscalationDecay"), TimeDilationEscalationDecay, TEXT("Value is a multiplier, Default: 0.05. For each escalated TimeDilation amount, also decay by this much. Disable by setting to 0."));
float TimeDilationEscalationDecayMax = 0.5f;
FAutoConsoleVariableRef CVarTimeDilationEscalationDecayMax(TEXT("np2.TimeDilationEscalationDecayMax"), TimeDilationEscalationDecayMax, TEXT("Value is a multiplier, Default: 0.5. The max decay value for escalated time dilation. Lower value means higher decay."));
float TimeDilationMax = 1.1f;
FAutoConsoleVariableRef CVarTimeDilationMax(TEXT("np2.TimeDilationMax"), TimeDilationMax, TEXT("Max value of the time dilation multiplier."));
float TimeDilationMin = 0.9f;
FAutoConsoleVariableRef CVarTimeDilationMin(TEXT("np2.TimeDilationMin"), TimeDilationMin, TEXT("Min value of the time dilation multiplier"));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:6265
Scope (from outer to inner):
file
function void APlayerController::ServerSendLatestAsyncPhysicsTimestamp_Implementation
Source code excerpt:
// Calculate desired dilation and send to client
const float TimeDilationDecay = FMath::Clamp(1.0f - (NetworkPhysicsCvars::TimeDilationEscalationDecay * FMath::Abs(CurrentFrameBufferOffset)), NetworkPhysicsCvars::TimeDilationEscalationDecayMax, 1.0f);
float CalculatedTimeDilation = 1.0f + ((NetworkPhysicsCvars::TimeDilationAmount * -CurrentFrameBufferOffset) * TimeDilationDecay);
CalculatedTimeDilation = FMath::Clamp(CalculatedTimeDilation, NetworkPhysicsCvars::TimeDilationMin, NetworkPhysicsCvars::TimeDilationMax);
ClientAckTimeDilation(CalculatedTimeDilation, ActualTimestamp.LocalFrame);
}