MovementTimeDiscrepancyDriftAllowance
MovementTimeDiscrepancyDriftAllowance
#Overview
name: MovementTimeDiscrepancyDriftAllowance
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 MovementTimeDiscrepancyDriftAllowance is to provide a tolerance for small discrepancies in movement time between the client and server in networked gameplay. It is part of Unreal Engine’s network synchronization system for character movement.
This setting variable is primarily used by the Character Movement Component, which is a core part of Unreal Engine’s gameplay framework. It’s specifically utilized in the GameNetworkManager class, which manages network-related gameplay settings.
The value of this variable is set in the GameNetworkManager constructor, initialized to 0.0f. However, it’s declared with the UPROPERTY(GlobalConfig) macro, which means it can be configured globally through project settings or config files.
MovementTimeDiscrepancyDriftAllowance interacts with other time discrepancy-related variables in the GameNetworkManager, such as MovementTimeDiscrepancyMinTimeMargin and MovementTimeDiscrepancyResolutionRate. It’s used in calculations within the ProcessClientTimeStampForTimeDiscrepancy function of the CharacterMovementComponent.
Developers must be aware that this variable affects how lenient the engine is with movement time discrepancies. A higher value allows for more drift, which can make the game feel smoother but may slightly compromise accuracy. A value of 0.0f (the default) means no drift is allowed.
Best practices when using this variable include:
- Carefully tuning it based on your game’s specific needs and network conditions.
- Testing thoroughly with various network conditions to ensure it doesn’t negatively impact gameplay.
- Considering it in conjunction with other network-related settings for a holistic approach to network smoothing.
- Documenting any changes made to this value, as it can have subtle but important effects on gameplay feel.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:45, section: [/Script/Engine.GameNetworkManager]
- INI Section:
/Script/Engine.GameNetworkManager
- Raw value:
0.0f
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/GameNetworkManager.h:235
Scope (from outer to inner):
file
class class AGameNetworkManager : public AInfo
Source code excerpt:
*/
UPROPERTY(GlobalConfig)
float MovementTimeDiscrepancyDriftAllowance;
/**
* Whether client moves should be force corrected during time discrepancy resolution, useful for projects that have lenient
* move error tolerance/ClientAuthorativePosition enabled.
*/
UPROPERTY(GlobalConfig)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:9081
Scope (from outer to inner):
file
function void UCharacterMovementComponent::ProcessClientTimeStampForTimeDiscrepancy
Source code excerpt:
{
// Apply drift allowance - forgiving percent difference per time for error
const float DriftAllowance = GameNetworkManager->MovementTimeDiscrepancyDriftAllowance;
if (DriftAllowance > 0.f)
{
if (NewTimeDiscrepancy > 0.f)
{
NewTimeDiscrepancy = FMath::Max(NewTimeDiscrepancy - ServerDelta * DriftAllowance, 0.f);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameNetworkManager.cpp:47
Scope (from outer to inner):
file
function AGameNetworkManager::AGameNetworkManager
Source code excerpt:
MovementTimeDiscrepancyMinTimeMargin = -0.25f;
MovementTimeDiscrepancyResolutionRate = 1.0f;
MovementTimeDiscrepancyDriftAllowance = 0.0f;
bMovementTimeDiscrepancyForceCorrectionsDuringResolution = false;
bUseDistanceBasedRelevancy = true;
}
void AGameNetworkManager::EnableStandbyCheatDetection(bool bIsEnabled)
{