IrisNetDriverConfigs

IrisNetDriverConfigs

#Overview

name: IrisNetDriverConfigs

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of IrisNetDriverConfigs is to configure and control the usage of Iris network drivers for different net driver instances within the Unreal Engine networking system. Iris is a networking subsystem in Unreal Engine 5 that provides improved performance and scalability for networked games.

This setting variable is primarily used by the Engine subsystem, specifically within the networking components. It’s referenced in the UEngine class, which is a core part of the Unreal Engine runtime.

The value of this variable is set through configuration files, specifically in the Engine.ini file. Developers can add entries to this array using the following format:

[/Script/Engine.Engine]
+IrisNetDriverConfigs=(NetDriverName="MyNetDriver",bCanUseIris=true)
+IrisNetDriverConfigs=(NetDriverDefinition="MyNetDriverDef",bCanUseIris=false)
+IrisNetDriverConfigs=(NetDriverWildcardName="SecondaryNetDriver*",bCanUseIris=true)

The IrisNetDriverConfigs variable interacts with other networking-related variables and systems, particularly those involved in creating and managing network drivers.

Developers must be aware that the order of priority for IrisNetDriverConfigs is:

  1. Exact NetDriverName match
  2. NetDriverName wildcard match
  3. NetDriverDefinition match

This priority order is important when configuring multiple net drivers or when using wildcard patterns.

Best practices when using this variable include:

  1. Be explicit in naming net drivers to avoid unintended matches with wildcard patterns.
  2. Use wildcard patterns judiciously to apply settings to groups of related net drivers.
  3. Regularly review and update these configurations as the project’s networking requirements evolve.
  4. Be cautious when enabling Iris for critical net drivers, as it may change networking behavior.
  5. Test thoroughly after making changes to these configurations to ensure network functionality remains intact.
  6. Document any custom configurations to maintain clarity across the development team.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:308, section: [/Script/Engine.Engine]

Location: <Workspace>/Engine/Config/BaseEngine.ini:309, section: [/Script/Engine.Engine]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:3098

Scope (from outer to inner):

file
class        class UEngine : public UObject , public FExec

Source code excerpt:

	/** A list of Iris NetDriverConfigs */
	UPROPERTY(Config, transient)
	TArray<FIrisNetDriverConfig> IrisNetDriverConfigs;
	
	/** A configurable list of actors that are automatically spawned upon server startup (just prior to InitGame) */
	UPROPERTY(config)
	TArray<FString> ServerActors;

	/** Runtime-modified list of server actors, allowing plugins to use serveractors, without permanently adding them to config files */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:13690

Scope (from outer to inner):

file
namespace    UE::Private

Source code excerpt:

	 * To enable iris for a netdriver you need to add the proper configuration in Engine.ini like so:
	 *		[/Script/Engine.Engine]
	 *		+IrisNetDriverConfigs=(NetDriverName="MyNetDriver",bCanUseIris=true)
	 *		+IrisNetDriverConfigs=(NetDriverDefinition="MyNetDriverDef",bCanUseIris=false)
	 *		+IrisNetDriverConfigs=(NetDriverWildcardName="SecondaryNetDriver*",bCanUseIris=true);
	 *
	 * Priority order for the IrisNetDriverConfigs are:
	 *		1. NetDriverName exact match
	 *		2. NetDriverName wildcard match
	 *		3. NetDriverDefinition match
	 *
	 */
	bool IsNetDriverUsingIris(UEngine* Engine, const FWorldContext& Context, FName InNetDriverDefinition, FName InNetDriverName)
	{
#if UE_WITH_IRIS
		FIrisNetDriverConfig* IrisConfig = nullptr;

		// Search for the exact name match
		if (IrisConfig == nullptr)
		{
			IrisConfig = Engine->IrisNetDriverConfigs.FindByPredicate([InNetDriverName](const FIrisNetDriverConfig& Config)
				{
					return Config.NetDriverName.IsNone() ? false : Config.NetDriverName == InNetDriverName;
				});
		}

		// Search for a wildcard match

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:13718

Scope (from outer to inner):

file
namespace    UE::Private
function     bool IsNetDriverUsingIris

Source code excerpt:

		{
			const FString TempNetDriverName = InNetDriverName.ToString();
			IrisConfig = Engine->IrisNetDriverConfigs.FindByPredicate([TempNetDriverName](const FIrisNetDriverConfig& Config)
				{
					return Config.NetDriverWildcardName.IsEmpty() ? false : TempNetDriverName.MatchesWildcard(Config.NetDriverWildcardName);
				});
		}

		// Search for the definition match
		if (IrisConfig == nullptr)
		{
			IrisConfig = Engine->IrisNetDriverConfigs.FindByPredicate([InNetDriverDefinition](const FIrisNetDriverConfig& Config)
				{
					return Config.NetDriverDefinition.IsNone() ? false : Config.NetDriverDefinition == InNetDriverDefinition;
				});
		}

		const bool bConfigCanUseIris = IrisConfig && IrisConfig->bCanUseIris;