np2.NumRedundantCmds
np2.NumRedundantCmds
#Overview
name: np2.NumRedundantCmds
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
(DEPRECATED 5.4, only part of the legacy physics frame offset logic) Number of redundant user cmds to send per frame
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of np2.NumRedundantCmds is to control the number of redundant user commands sent per frame as part of the legacy physics frame offset logic in Unreal Engine’s networking system. However, it’s important to note that this variable is deprecated as of Unreal Engine 5.4.
This setting variable is primarily used in the Engine module, specifically within the PlayerController component of the networking system. Based on the callsites, it’s clear that this variable is part of the NetworkPhysicsCvars namespace, indicating its relevance to network physics calculations.
The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands. Its default value is 3, as seen in the source code.
The associated variable NumRedundantCmds directly interacts with np2.NumRedundantCmds. They share the same value, with NumRedundantCmds being the actual int32 variable used in the code, while np2.NumRedundantCmds is the console variable name.
Developers must be aware that this variable is deprecated as of Unreal Engine 5.4. The comment clearly states that it’s only part of the legacy physics frame offset logic. This suggests that the engine is moving away from this approach, and developers should look for alternative, more current methods for handling network physics synchronization.
Best practices when using this variable include:
- Avoid relying on it for new development, given its deprecated status.
- If working with older projects that still use this variable, consider updating to newer networking synchronization methods.
- Be cautious when modifying its value, as it could affect network performance and synchronization.
Regarding the associated variable NumRedundantCmds:
The purpose of NumRedundantCmds is the same as np2.NumRedundantCmds - it determines the number of redundant user commands to send per frame in the legacy physics frame offset logic.
This variable is used directly in the APlayerController::PushClientInput function to calculate the range of frames for which to send client input to the server. It’s part of the Engine module’s networking system, specifically the player controller logic.
The value of NumRedundantCmds is set at the same time as np2.NumRedundantCmds, through the FAutoConsoleVariableRef mechanism.
Developers should be aware that this variable is part of a deprecated system and should be treated with the same caution as np2.NumRedundantCmds. Its use in the PushClientInput function suggests it plays a role in ensuring reliable transmission of client input to the server, but newer methods may have replaced this approach in more recent versions of Unreal Engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:111
Scope (from outer to inner):
file
namespace NetworkPhysicsCvars
Source code excerpt:
/* DEPRECATED 5.4 */
int32 NumRedundantCmds = 3;
FAutoConsoleVariableRef CVarNumRedundantCmds(TEXT("np2.NumRedundantCmds"), NumRedundantCmds, TEXT("(DEPRECATED 5.4, only part of the legacy physics frame offset logic) Number of redundant user cmds to send per frame"));
#if (UE_BUILD_SHIPPING || UE_BUILD_TEST)
int32 EnableDebugRPC = 0;
#else
int32 EnableDebugRPC = 1;
#endif
#Associated Variable and Callsites
This variable is associated with another variable named NumRedundantCmds
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:110
Scope (from outer to inner):
file
namespace NetworkPhysicsCvars
Source code excerpt:
{
/* DEPRECATED 5.4 */
int32 NumRedundantCmds = 3;
FAutoConsoleVariableRef CVarNumRedundantCmds(TEXT("np2.NumRedundantCmds"), NumRedundantCmds, TEXT("(DEPRECATED 5.4, only part of the legacy physics frame offset logic) Number of redundant user cmds to send per frame"));
#if (UE_BUILD_SHIPPING || UE_BUILD_TEST)
int32 EnableDebugRPC = 0;
#else
int32 EnableDebugRPC = 1;
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:1751
Scope (from outer to inner):
file
function void APlayerController::PushClientInput
Source code excerpt:
// Do the RPC right here, including the redundant send. This should probably be time based and managed somewhere else like in Tick eventually
for (int32 Frame = FMath::Max(1, InRecvClientInputFrame - NetworkPhysicsCvars::NumRedundantCmds + 1); Frame <= InRecvClientInputFrame; ++Frame)
{
ServerRecvClientInputFrame(Frame, InputBuffer_DEPRECATED.Get(Frame));
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
}