net.OodleMinSizeForCompression

net.OodleMinSizeForCompression

#Overview

name: net.OodleMinSizeForCompression

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of net.OodleMinSizeForCompression is to set a minimum size threshold for outgoing network packets to be considered for compression using the Oodle Network compression system in Unreal Engine 5.

This setting variable is primarily used by the Oodle Network compression plugin, which is part of Unreal Engine’s networking subsystem. It’s specifically referenced in the OodleNetworkHandlerComponent, which is responsible for handling packet compression.

The value of this variable is set through a console variable (CVar) named “net.OodleMinSizeForCompression”. It can be modified at runtime using console commands or through configuration files.

The associated variable GOodleMinSizeForCompression directly interacts with net.OodleMinSizeForCompression. They share the same value, with GOodleMinSizeForCompression being the actual integer variable used in the code.

Developers must be aware that this variable affects the performance and efficiency of network communications. Setting it too low might result in attempting to compress very small packets, which could potentially increase overhead instead of reducing it. Setting it too high might miss opportunities for beneficial compression.

Best practices when using this variable include:

  1. Carefully tuning the value based on your game’s network traffic patterns.
  2. Monitoring network performance metrics to find the optimal balance between compression benefits and processing overhead.
  3. Considering the typical size of your game’s network packets when setting this value.

Regarding the associated variable GOodleMinSizeForCompression:

Developers should be aware that changes to net.OodleMinSizeForCompression will be reflected in GOodleMinSizeForCompression, and it’s this latter variable that’s used in the actual compression decision logic.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Compression/OodleNetwork/Source/Private/OodleNetworkHandlerComponent.cpp:158

Scope: file

Source code excerpt:


FAutoConsoleVariableRef CVarOodleMinSizeForCompression(
	TEXT("net.OodleMinSizeForCompression"),
	GOodleMinSizeForCompression,
	TEXT("The minimum size an outgoing packet must be, for it to be considered for compression (does not count overhead of handler components which process packets after Oodle)."));


TAutoConsoleVariable<FString> CVarOodleServerEnableMode(
	TEXT("net.OodleServerEnableMode"), "",

#Loc: <Workspace>/Engine/Plugins/Compression/OodleNetwork/Source/Public/OodleNetworkAnalytics.h:68

Scope: file

Source code excerpt:

	uint64 OutNotCompressedClientDisabledNum;

	/** The number of outgoing packets that were not compressed, due to the packet being smaller that the CVar 'net.OodleMinSizeForCompression'. */
	uint64 OutNotCompressedTooSmallNum;


	/** The compressed length + decompression data overhead, of all outgoing packets. The most accurate measure of compression savings. */
	uint64 OutCompressedWithOverheadLengthTotal;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Compression/OodleNetwork/Source/Private/OodleNetworkHandlerComponent.cpp:155

Scope: file

Source code excerpt:

 */

static int32 GOodleMinSizeForCompression = 0;

FAutoConsoleVariableRef CVarOodleMinSizeForCompression(
	TEXT("net.OodleMinSizeForCompression"),
	GOodleMinSizeForCompression,
	TEXT("The minimum size an outgoing packet must be, for it to be considered for compression (does not count overhead of handler components which process packets after Oodle)."));


TAutoConsoleVariable<FString> CVarOodleServerEnableMode(
	TEXT("net.OodleServerEnableMode"), "",
	TEXT("When to enable compression on the server (overrides the 'ServerEnableMode' .ini setting)."));

#Loc: <Workspace>/Engine/Plugins/Compression/OodleNetwork/Source/Private/OodleNetworkHandlerComponent.cpp:1261

Scope (from outer to inner):

file
function     void OodleNetworkHandlerComponent::Outgoing

Source code excerpt:


		// Skip compression when the packet is below the minimum size
		if (!bSkipCompression && (GOodleMinSizeForCompression > 0 && static_cast<int32>(UncompressedBytes) < GOodleMinSizeForCompression))
		{
			bSkipCompression = true;
			bSkipCompressionTooSmall = true;
		}

		if (CurDict != nullptr && !bSkipCompression)