bMovementTimeDiscrepancyForceCorrectionsDuringResolution
bMovementTimeDiscrepancyForceCorrectionsDuringResolution
#Overview
name: bMovementTimeDiscrepancyForceCorrectionsDuringResolution
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 bMovementTimeDiscrepancyForceCorrectionsDuringResolution is to enforce time discrepancy resolution in networked character movement, particularly when default project movement error checking is lenient or when ClientAuthorativePosition is enabled.
This setting variable is primarily used by the Unreal Engine’s networking and character movement systems. Specifically, it is utilized in the CharacterMovementComponent and GameNetworkManager classes, which are part of the Engine module.
The value of this variable is set in the GameNetworkManager constructor (AGameNetworkManager::AGameNetworkManager) and can be configured globally through the engine’s configuration files due to the UPROPERTY(GlobalConfig) attribute.
This variable interacts with other movement-related variables in the GameNetworkManager class, such as MovementTimeDiscrepancyResolutionRate and MovementTimeDiscrepancyDriftAllowance. It also influences the ServerData.bForceClientUpdate flag in the CharacterMovementComponent.
Developers must be aware that enabling this variable will force client updates during time discrepancy resolution, which can lead to more frequent corrections in character positions. This may result in more noticeable rubber-banding effects for clients but can help maintain better synchronization between client and server.
Best practices when using this variable include:
- Only enable it when necessary, such as in projects with lenient movement error checking or when using ClientAuthorativePosition.
- Carefully balance it with other network settings to achieve the desired trade-off between smooth gameplay and accurate synchronization.
- Test thoroughly in various network conditions to ensure it doesn’t negatively impact the player experience.
- Consider providing in-game options for players to adjust related settings if the forced corrections are noticeable.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:46, section: [/Script/Engine.GameNetworkManager]
- INI Section:
/Script/Engine.GameNetworkManager
- Raw value:
false
- 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:242
Scope (from outer to inner):
file
class class AGameNetworkManager : public AInfo
Source code excerpt:
*/
UPROPERTY(GlobalConfig)
bool bMovementTimeDiscrepancyForceCorrectionsDuringResolution;
/** Update network speeds for listen servers based on number of connected players. */
ENGINE_API virtual void UpdateNetSpeeds(bool bIsLanMatch);
/** Timer which calls UpdateNetSpeeds() once a second. */
ENGINE_API virtual void UpdateNetSpeedsTimer();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:9175
Scope (from outer to inner):
file
function void UCharacterMovementComponent::ProcessClientTimeStampForTimeDiscrepancy
Source code excerpt:
// This is useful when default project movement error checking is lenient or ClientAuthorativePosition is enabled
// to ensure time discrepancy resolution is enforced
if (GameNetworkManager->bMovementTimeDiscrepancyForceCorrectionsDuringResolution)
{
ServerData.bForceClientUpdate = true;
}
// Movement time discrepancy resolution
// When the server has detected a significant time difference between what the client ServerMove RPCs are reporting
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameNetworkManager.cpp:48
Scope (from outer to inner):
file
function AGameNetworkManager::AGameNetworkManager
Source code excerpt:
MovementTimeDiscrepancyResolutionRate = 1.0f;
MovementTimeDiscrepancyDriftAllowance = 0.0f;
bMovementTimeDiscrepancyForceCorrectionsDuringResolution = false;
bUseDistanceBasedRelevancy = true;
}
void AGameNetworkManager::EnableStandbyCheatDetection(bool bIsEnabled)
{
UNetDriver* Driver = GetWorld()->GetNetDriver();