net.PackageMap.DebugAll

net.PackageMap.DebugAll

#Overview

name: net.PackageMap.DebugAll

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 net.PackageMap.DebugAll is to enable debugging of PackageMap serialization for all objects in the Unreal Engine networking system. This setting variable is used for diagnostic and troubleshooting purposes in the networking subsystem.

This setting variable is primarily used by the Engine’s networking subsystem, specifically within the NetDriver and PackageMapClient modules. These modules are responsible for managing network connections and serializing objects for network replication.

The value of this variable is set through the console command system. It’s defined as a TAutoConsoleVariable with an initial value of 0, which means it’s disabled by default.

net.PackageMap.DebugAll interacts with another debug variable, net.PackageMap.DebugObject. Together, they provide different levels of debugging granularity. While net.PackageMap.DebugAll enables debugging for all objects, net.PackageMap.DebugObject allows debugging for specific objects.

Developers must be aware that enabling this variable can significantly impact performance due to the increased logging output. It should only be used during development and debugging phases, not in production builds.

Best practices when using this variable include:

  1. Only enable it when actively debugging network serialization issues.
  2. Use it in conjunction with net.PackageMap.DebugObject for more targeted debugging when possible.
  3. Remember to disable it after debugging to avoid performance overhead.
  4. Be prepared for a large volume of log output when enabled, especially in complex networked games.
  5. Use it in non-shipping and non-test builds only, as the code checks prevent its use in those configurations.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/HAL/ConsoleManager.cpp:3801

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarNetPackageMapDebugAllObjects(
	TEXT("net.PackageMap.DebugAll"),
	0,
	TEXT("Debugs PackageMap serialization of all objects"),	
	ECVF_Default);

static TAutoConsoleVariable<FString> CVarNetPackageMapDebugObject(
	TEXT("net.PackageMap.DebugObject"),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/NetDriver.cpp:5298

Scope (from outer to inner):

file
function     int32 UNetDriver::ServerReplicateActors_ProcessPrioritizedActorsRange

Source code excerpt:

#if !( UE_BUILD_SHIPPING || UE_BUILD_TEST )
		static IConsoleVariable* DebugObjectCvar = IConsoleManager::Get().FindConsoleVariable( TEXT( "net.PackageMap.DebugObject" ) );
		static IConsoleVariable* DebugAllObjectsCvar = IConsoleManager::Get().FindConsoleVariable( TEXT( "net.PackageMap.DebugAll" ) );
		if ( ActorInfo &&
			 ( ( DebugObjectCvar && !DebugObjectCvar->GetString().IsEmpty() && ActorInfo->Actor->GetName().Contains( DebugObjectCvar->GetString() ) ) ||
			   ( DebugAllObjectsCvar && DebugAllObjectsCvar->GetInt() != 0 ) ) )
		{
			UE_LOG( LogNetPackageMap, Log, TEXT( "Evaluating actor for replication %s" ), *ActorInfo->Actor->GetName() );
		}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PackageMapClient.cpp:289

Scope (from outer to inner):

file
function     bool UPackageMapClient::SerializeObject

Source code excerpt:

#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
	static IConsoleVariable* DebugObjectCvar = IConsoleManager::Get().FindConsoleVariable(TEXT("net.PackageMap.DebugObject"));
	static IConsoleVariable* DebugAllObjectsCvar = IConsoleManager::Get().FindConsoleVariable(TEXT("net.PackageMap.DebugAll"));
	if (Object &&
		((DebugObjectCvar && !DebugObjectCvar->GetString().IsEmpty() && Object->GetName().Contains(DebugObjectCvar->GetString())) ||
		(DebugAllObjectsCvar && DebugAllObjectsCvar->GetInt() != 0)))
	{
		UE_LOG(LogNetPackageMap, Log, TEXT("Serialized Object %s"), *Object->GetName());
	}