LowestAllowedChunkIndexForAutoGeneration

LowestAllowedChunkIndexForAutoGeneration

#Overview

name: LowestAllowedChunkIndexForAutoGeneration

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of LowestAllowedChunkIndexForAutoGeneration is to set a minimum threshold for automatically generated chunk IDs in the Game Features system of Unreal Engine 5. This variable is used to ensure that automatically generated chunk IDs are within an acceptable range.

This setting variable is primarily relied upon by the Game Features plugin, specifically within the UGameFeatureAction_AddChunkOverride class. This class is part of the content chunking system, which allows for dynamic loading and unloading of game content.

The value of this variable is set as a config property of the UGameFeatureAction_AddChunkOverride class. It can be modified through project settings or config files.

LowestAllowedChunkIndexForAutoGeneration interacts with the auto-generation process of chunk IDs. It’s used to validate whether a newly generated chunk ID is acceptable or not.

Developers must be aware that:

  1. If an auto-generated chunk ID is lower than this value, a warning will be logged, and the user will be prompted to manually assign a valid chunk ID.
  2. This variable helps prevent conflicts with reserved or system-used chunk IDs.
  3. It’s crucial for maintaining a consistent and safe range of chunk IDs across the project.

Best practices when using this variable include:

  1. Set it to a value that leaves enough room for system-reserved chunk IDs.
  2. Keep it consistent across all instances of the project to avoid conflicts.
  3. Document the chosen value and the reasoning behind it for the development team.
  4. Regularly review and adjust this value as the project grows to ensure it still meets the project’s needs.
  5. Use it in conjunction with other chunk management practices to maintain a clean and efficient content streaming system.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeatureAction_AddChunkOverride.cpp:184

Scope (from outer to inner):

file
function     int32 UGameFeatureAction_AddChunkOverride::GetLowestAllowedChunkId

Source code excerpt:

	if (const UGameFeatureAction_AddChunkOverride* Action = UGameFeatureAction_AddChunkOverride::StaticClass()->GetDefaultObject<UGameFeatureAction_AddChunkOverride>())
	{
		return Action->LowestAllowedChunkIndexForAutoGeneration;
	}
	else
	{
		ensureMsgf(false, TEXT("Unable to get class default object for UGameFeatureAction_AddChunkOverride"));
		return INDEX_NONE;
	}

#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Private/GameFeatureAction_AddChunkOverride.cpp:300

Scope (from outer to inner):

file
function     int32 UGameFeatureAction_AddChunkOverride::GenerateUniqueChunkId

Source code excerpt:

	}

	if (NewChunkId < LowestAllowedChunkIndexForAutoGeneration)
	{
		UE_LOG(LogAddChunkOverride, Warning, TEXT("Autogenerated ChunkId(%d) is lower than the config specified LowestAllowedChunkIndexForAutoGeneration(%d)"), NewChunkId, LowestAllowedChunkIndexForAutoGeneration);
		FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("AddChunkOverride_InvalidId", "Autogenerated ChunkID is lower than config specified LowestAllowedChunkIndexForAutoGeneration. Please manually assign a valid Chunk Id"));
		NewChunkId = -1;
	}
	else if (GameFeatureAction_AddChunkOverride::ChunkIdToPluginMap.Contains(NewChunkId))
	{
		UE_LOG(LogAddChunkOverride, Warning, TEXT("ChunkId(%d) is in use by %s. Unable to autogenerate unique id. Lowest allowed ChunkId(%d)"), NewChunkId, *GameFeatureAction_AddChunkOverride::ChunkIdToPluginMap[NewChunkId], LowestAllowedChunkIndexForAutoGeneration);
		FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT("AddChunkOverride_UsedChunkId", "Unable to auto generate unique valid Chunk Id. Please manually assign a valid Chunk Id"));
		NewChunkId = -1;
	}

	return NewChunkId;
}

#Loc: <Workspace>/Engine/Plugins/Runtime/GameFeatures/Source/GameFeatures/Public/GameFeatureAction_AddChunkOverride.h:84

Scope (from outer to inner):

file
class        class UGameFeatureAction_AddChunkOverride final : public UGameFeatureAction

Source code excerpt:

	 */
	UPROPERTY(config)
	int32 LowestAllowedChunkIndexForAutoGeneration = INDEX_NONE;
#endif

	void AddChunkIdOverride();
	void RemoveChunkIdOverride();

#if WITH_EDITOR