p.NetEnableListenServerSmoothing
p.NetEnableListenServerSmoothing
#Overview
name: p.NetEnableListenServerSmoothing
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to enable mesh smoothing on listen servers for the local view of remote clients.\n0: Disable, 1: Enable
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.NetEnableListenServerSmoothing is to control mesh smoothing for remote clients on listen servers in Unreal Engine’s character movement system. It is primarily used for improving the visual quality of character movement in networked gameplay scenarios.
This setting variable is primarily used in the Character Movement Component, which is a core part of Unreal Engine’s gameplay framework. It’s specifically utilized in the networking and movement interpolation systems within this component.
The value of this variable is set through a console variable (cvar) system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using console commands.
The associated variable NetEnableListenServerSmoothing directly interacts with p.NetEnableListenServerSmoothing. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable specifically affects listen servers, which are servers that also act as a client. It’s designed to smooth out the movement of remote clients as seen by the listen server, which can help reduce visual jitter or inconsistencies.
Best practices when using this variable include:
- Testing gameplay both with and without this smoothing enabled to ensure it doesn’t introduce unwanted side effects.
- Considering performance implications, especially on lower-end hardware acting as listen servers.
- Balancing visual smoothness against network accuracy requirements for your specific game.
Regarding the associated variable NetEnableListenServerSmoothing:
This is an internal variable used within the CharacterMovementComponent to actually implement the smoothing behavior. It’s set based on the console variable p.NetEnableListenServerSmoothing.
It’s used in various methods within the CharacterMovementComponent, particularly in the TickComponent and MoveAutonomous functions. These functions check this variable to determine whether to apply smoothing to remote client positions.
Developers should note that modifying this variable directly is not recommended. Instead, they should use the console variable p.NetEnableListenServerSmoothing to control this behavior.
The best practice is to treat NetEnableListenServerSmoothing as a read-only variable within the engine code, and to use the console variable system for any runtime modifications to this setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:124
Scope (from outer to inner):
file
namespace CharacterMovementCVars
Source code excerpt:
static int32 NetEnableListenServerSmoothing = 1;
FAutoConsoleVariableRef CVarNetEnableListenServerSmoothing(
TEXT("p.NetEnableListenServerSmoothing"),
NetEnableListenServerSmoothing,
TEXT("Whether to enable mesh smoothing on listen servers for the local view of remote clients.\n")
TEXT("0: Disable, 1: Enable"),
ECVF_Default);
// Latent proxy prediction
#Associated Variable and Callsites
This variable is associated with another variable named NetEnableListenServerSmoothing
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/CharacterMovementComponentAsync.cpp:45
Scope (from outer to inner):
file
function void FCharacterMovementComponentAsyncInput::Simulate
Source code excerpt:
// Smooth on listen server for local view of remote clients. We may receive updates at a rate different than our own tick rate.
if (CharacterMovementCVars::NetEnableListenServerSmoothing && !bNetworkSmoothingComplete && IsNetMode(NM_ListenServer))
{
SmoothClientPosition(DeltaTime);
}
}*/
}
else if (CharacterInput->LocalRole == ROLE_SimulatedProxy)
{
// TODO Crouching
// Need to recreate geometry with smaller capsule from PT.
/*if (bShrinkProxyCapsule)
{
AdjustProxyCapsuleSize();
}*/
ensure(false);
//SimulatedTick(DeltaSeconds);
}
/* TODO RVOAvoidance
if (bUseRVOAvoidance)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:122
Scope (from outer to inner):
file
namespace CharacterMovementCVars
Source code excerpt:
// Listen server smoothing
static int32 NetEnableListenServerSmoothing = 1;
FAutoConsoleVariableRef CVarNetEnableListenServerSmoothing(
TEXT("p.NetEnableListenServerSmoothing"),
NetEnableListenServerSmoothing,
TEXT("Whether to enable mesh smoothing on listen servers for the local view of remote clients.\n")
TEXT("0: Disable, 1: Enable"),
ECVF_Default);
// Latent proxy prediction
static int32 NetEnableSkipProxyPredictionOnNetUpdate = 1;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:1627
Scope (from outer to inner):
file
function void UCharacterMovementComponent::TickComponent
Source code excerpt:
// Smooth on listen server for local view of remote clients. We may receive updates at a rate different than our own tick rate.
if (CharacterMovementCVars::NetEnableListenServerSmoothing && !bNetworkSmoothingComplete && IsNetMode(NM_ListenServer))
{
SmoothClientPosition(DeltaTime);
}
}
}
else if (CharacterOwner->GetLocalRole() == ROLE_SimulatedProxy)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/CharacterMovementComponent.cpp:10283
Scope (from outer to inner):
file
function void UCharacterMovementComponent::MoveAutonomous
Source code excerpt:
{
// Smooth local view of remote clients on listen servers
if (CharacterMovementCVars::NetEnableListenServerSmoothing &&
CharacterOwner->GetRemoteRole() == ROLE_AutonomousProxy &&
IsNetMode(NM_ListenServer))
{
SmoothCorrection(OldLocation, OldRotation, UpdatedComponent->GetComponentLocation(), UpdatedComponent->GetComponentQuat());
}
}