net.ReservedNetGuidSize

net.ReservedNetGuidSize

#Overview

name: net.ReservedNetGuidSize

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.ReservedNetGuidSize is to specify the reserved size in bytes for NetGUID serialization. It is used as a placeholder for later serialization in the networking system of Unreal Engine 5.

This setting variable is primarily used in the networking subsystem of Unreal Engine, specifically in the package map client module. It is referenced in the PackageMapClient.cpp file, which is part of the Engine’s runtime.

The value of this variable is set through a console variable (CVarReservedNetGuidSize) with a default value of 512 bytes. It can be modified at runtime through console commands or configuration files.

The associated variable CVarReservedNetGuidSize interacts directly with net.ReservedNetGuidSize. It is an instance of TAutoConsoleVariable that allows for runtime modification and access to the value.

Developers must be aware that this variable affects the memory allocation for NetGUID serialization. Setting it too low might lead to insufficient space for serialization, while setting it too high could waste memory.

Best practices when using this variable include:

  1. Only modify it if you have a specific need to change the default serialization buffer size.
  2. Monitor performance and memory usage when adjusting this value to find the optimal setting for your specific use case.
  3. Consider the network traffic and complexity of your game when deciding whether to adjust this value.

Regarding the associated variable CVarReservedNetGuidSize:

The purpose of CVarReservedNetGuidSize is to provide a programmatic interface to access and modify the net.ReservedNetGuidSize value within the C++ code.

This console variable is used in the Engine’s networking subsystem, specifically in the PackageMapClient module.

The value of CVarReservedNetGuidSize is set when the console variable is initialized, using the same default value (512) as net.ReservedNetGuidSize.

CVarReservedNetGuidSize interacts directly with net.ReservedNetGuidSize, effectively serving as its in-code representation.

Developers should be aware that changes to CVarReservedNetGuidSize will directly affect the behavior of net.ReservedNetGuidSize.

Best practices for using CVarReservedNetGuidSize include:

  1. Use GetValueOnAnyThread() when accessing the value in a multi-threaded context.
  2. Consider using this variable for runtime adjustments or diagnostics of the NetGUID serialization buffer size.
  3. Document any code that modifies this variable, as it can have engine-wide effects on networking performance.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarReservedNetGuidSize(
	TEXT("net.ReservedNetGuidSize"),
	512,
	TEXT("Reserved size in bytes for NetGUID serialization, used as a placeholder for later serialization")
);

static float GGuidCacheTrackAsyncLoadingGUIDThreshold = 0.f;
static FAutoConsoleVariableRef CVarTrackAsyncLoadingGUIDTreshold(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarReservedNetGuidSize(
	TEXT("net.ReservedNetGuidSize"),
	512,
	TEXT("Reserved size in bytes for NetGUID serialization, used as a placeholder for later serialization")
);

static float GGuidCacheTrackAsyncLoadingGUIDThreshold = 0.f;

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

Scope (from outer to inner):

file
function     bool UPackageMapClient::ExportNetGUIDForReplay

Source code excerpt:

		TGuardValue<bool> ExportingGUID(GuidCache->IsExportingNetGUIDBunch, true);

		const int32 MaxReservedSize(CVarReservedNetGuidSize.GetValueOnAnyThread());

		TArray<uint8>& GUIDMemory = ExportGUIDArchives.Emplace_GetRef();
		GUIDMemory.Reserve(MaxReservedSize);

		FNetGUIDCache::ENetworkChecksumMode RestoreMode = GuidCache->NetworkChecksumMode;