MoveRepSize

MoveRepSize

#Overview

name: MoveRepSize

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 MoveRepSize is to represent the average size of replicated move packets sent from players to the server in bytes. This setting variable is primarily used for network optimization and performance tuning in Unreal Engine’s networking system.

MoveRepSize is primarily used by the GameFramework module, specifically within the character movement and network management systems. The AGameNetworkManager class and UCharacterMovementComponent rely on this setting variable.

The value of MoveRepSize is initially set in the AGameNetworkManager constructor with a default value of 42.0f bytes. It is declared as a UPROPERTY with the GlobalConfig flag, which means it can be modified through configuration files.

MoveRepSize interacts with other network-related variables, such as ClientNetSendMoveDeltaTimeThrottled and CurrentNetSpeed. It is used in calculations to determine the appropriate delta time for sending client movement updates to the server.

Developers must be aware that MoveRepSize directly affects the frequency of movement updates sent from clients to the server. A larger value will result in less frequent updates, potentially reducing network traffic but increasing the potential for movement discrepancies between client and server.

Best practices when using this variable include:

  1. Carefully tuning the value based on your game’s specific movement requirements and network conditions.
  2. Monitoring its impact on network performance and player experience.
  3. Considering adjusting it dynamically based on network conditions or game states.
  4. Testing thoroughly with various network conditions to ensure optimal performance.
  5. Balancing it with other network-related settings to achieve the best trade-off between responsiveness and network efficiency.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseGame.ini:23, section: [/Script/Engine.GameNetworkManager]

#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:110

Scope (from outer to inner):

file
class        class AGameNetworkManager : public AInfo

Source code excerpt:

	/** Average size of replicated move packet (ServerMove() packet size) from player */
	UPROPERTY(GlobalConfig)
	float MoveRepSize;

	/** MAXPOSITIONERRORSQUARED is the square of the max position error that is accepted (not corrected) in net play */
	UPROPERTY(GlobalConfig)
	float MAXPOSITIONERRORSQUARED;

	/** MAXNEARZEROVELOCITYSQUARED is the square of the max velocity that is considered zero (not corrected) in net play */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:12438

Scope (from outer to inner):

file
function     float UCharacterMovementComponent::GetClientNetSendDeltaTime

Source code excerpt:

		else
		{
			NetMoveDelta = FMath::Max(GameNetworkManager->ClientNetSendMoveDeltaTimeThrottled, 2 * GameNetworkManager->MoveRepSize / Player->CurrentNetSpeed);
		}

		// Lower frequency for standing still and not rotating camera
		if (Acceleration.IsZero() && Velocity.IsZero() && ClientData->LastAckedMove.IsValid() && ClientData->LastAckedMove->IsMatchingStartControlRotation(PC))
		{
			NetMoveDelta = FMath::Max(GameNetworkManager->ClientNetSendMoveDeltaTimeStationary, NetMoveDelta);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameNetworkManager.cpp:23

Scope (from outer to inner):

file
function     AGameNetworkManager::AGameNetworkManager

Source code excerpt:

	SeverePingThreshold = 500;

	MoveRepSize = 42.0f;
	MAXPOSITIONERRORSQUARED = 3.0f;
	MAXNEARZEROVELOCITYSQUARED = 9.0f;
	CLIENTADJUSTUPDATECOST = 180.0f;
	MAXCLIENTUPDATEINTERVAL = 0.25f;
	MaxClientForcedUpdateDuration=1.0f;
	ServerForcedUpdateHitchThreshold = 0.150f;