np2.EnableDebugRPC

np2.EnableDebugRPC

#Overview

name: np2.EnableDebugRPC

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of np2.EnableDebugRPC is to control the sending of extra debug information to clients about server-side input buffering in Unreal Engine’s network physics system. This setting variable is part of the legacy physics frame offset logic and has been deprecated as of Unreal Engine 5.4.

This setting variable is primarily used in the Engine module, specifically within the PlayerController component. It’s part of the network physics prediction system, which is responsible for managing the synchronization of physics states between the server and clients in multiplayer games.

The value of this variable is set through an FAutoConsoleVariableRef, which allows it to be modified at runtime via console commands. By default, it is set to 1 (enabled) in non-shipping and non-test builds, and 0 (disabled) in shipping or test builds.

The associated variable EnableDebugRPC interacts directly with np2.EnableDebugRPC. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable is deprecated as of Unreal Engine 5.4. It’s part of the legacy physics frame offset logic and may be removed in future versions of the engine. Therefore, relying on this variable for new development is not recommended.

Best practices when using this variable include:

  1. Avoid using it in new development, as it’s deprecated.
  2. If you must use it for legacy reasons, be aware that it only affects debug information and should not be relied upon for core gameplay functionality.
  3. Consider migrating to newer network physics prediction systems that have replaced this functionality.

Regarding the associated variable EnableDebugRPC: The purpose of EnableDebugRPC is identical to np2.EnableDebugRPC. It’s an internal representation of the console variable within the C++ code.

This variable is used directly in the APlayerController::SendClientAdjustment function to determine whether to send additional debug information to clients. When enabled, it triggers a call to ClientRecvServerAckFrameDebug, which presumably sends detailed information about frame processing and buffering to the client.

The same considerations and best practices apply to EnableDebugRPC as to np2.EnableDebugRPC. Developers should treat them as deprecated and avoid relying on them for new features or gameplay systems.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:119

Scope (from outer to inner):

file
namespace    NetworkPhysicsCvars

Source code excerpt:

#endif
	/* DEPRECATED 5.4 */
	FAutoConsoleVariableRef CVarEnableDebugRPC(TEXT("np2.EnableDebugRPC"), EnableDebugRPC, TEXT("(DEPRECATED 5.4, only part of the legacy physics frame offset logic) Sends extra debug information to clients about server side input buffering"));
	
	/* DEPRECATED 5.4 */
	int32 NetworkPhysicsPredictionFrameOffset = 4;
	FAutoConsoleVariableRef CVarNetworkPhysicsPredictionFrameOffset(TEXT("np2.NetworkPhysicsPredictionFrameOffset"), NetworkPhysicsPredictionFrameOffset, TEXT("(DEPRECATED 5.4, use np2.PredictionAsyncFrameBuffer instead) Additional frame offset to be added to the local to server offset used by network prediction"));
	
	int32 PredictionAsyncFrameBuffer = 3;

#Associated Variable and Callsites

This variable is associated with another variable named EnableDebugRPC. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:114

Scope (from outer to inner):

file
namespace    NetworkPhysicsCvars

Source code excerpt:


#if (UE_BUILD_SHIPPING || UE_BUILD_TEST)
	int32 EnableDebugRPC = 0;
#else
	int32 EnableDebugRPC = 1;
#endif
	/* DEPRECATED 5.4 */
	FAutoConsoleVariableRef CVarEnableDebugRPC(TEXT("np2.EnableDebugRPC"), EnableDebugRPC, TEXT("(DEPRECATED 5.4, only part of the legacy physics frame offset logic) Sends extra debug information to clients about server side input buffering"));
	
	/* DEPRECATED 5.4 */
	int32 NetworkPhysicsPredictionFrameOffset = 4;
	FAutoConsoleVariableRef CVarNetworkPhysicsPredictionFrameOffset(TEXT("np2.NetworkPhysicsPredictionFrameOffset"), NetworkPhysicsPredictionFrameOffset, TEXT("(DEPRECATED 5.4, use np2.PredictionAsyncFrameBuffer instead) Additional frame offset to be added to the local to server offset used by network prediction"));
	
	int32 PredictionAsyncFrameBuffer = 3;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PlayerController.cpp:1710

Scope (from outer to inner):

file
function     void APlayerController::SendClientAdjustment

Source code excerpt:

		ClientRecvServerAckFrame(ServerFrameInfo_DEPRECATED.LastProcessedInputFrame, ServerFrameInfo_DEPRECATED.LastLocalFrame, ServerFrameInfo_DEPRECATED.QuantizedTimeDilation);
		
		if (NetworkPhysicsCvars::EnableDebugRPC)
		{
			ClientRecvServerAckFrameDebug(InputBuffer_DEPRECATED.HeadFrame() - ServerFrameInfo_DEPRECATED.LastProcessedInputFrame, ServerFrameInfo_DEPRECATED.TargetNumBufferedCmds);
		}
	}

	if (UPhysicsSettings::Get()->PhysicsPrediction.bEnablePhysicsPrediction)