ai.crowd.DebugSelectedActors

ai.crowd.DebugSelectedActors

#Overview

name: ai.crowd.DebugSelectedActors

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 ai.crowd.DebugSelectedActors is to enable debug drawing for selected crowd agents in the Unreal Engine’s AI module, specifically within the crowd simulation system.

This setting variable is primarily used by the AI module, particularly in the crowd management and navigation subsystem. Based on the callsites, it’s clear that this variable is utilized within the CrowdManager.cpp file, which is part of the AIModule.

The value of this variable is set through a console variable (cvar) system. It’s initialized to 0 and can be changed at runtime using the console command “ai.crowd.DebugSelectedActors”.

The associated variable DebugSelectedActors interacts directly with ai.crowd.DebugSelectedActors. They share the same value, with DebugSelectedActors being the actual int32 variable used in the code, while ai.crowd.DebugSelectedActors is the console variable name used to manipulate it.

Developers must be aware that this is a debugging feature. When enabled (set to 1), it will cause additional processing and drawing operations, which may impact performance. Therefore, it should be used judiciously, primarily during development and debugging phases.

Best practices when using this variable include:

  1. Only enable it when actively debugging crowd agent behavior.
  2. Disable it in release builds or when performance is a concern.
  3. Use it in conjunction with other debugging tools and variables (like DebugVisLog) for a comprehensive view of crowd agent behavior.
  4. Be aware that it only affects selected agents, so ensure the correct agents are selected when using this feature.

Regarding the associated variable DebugSelectedActors:

Developers should treat DebugSelectedActors as a read-only variable within their code, relying on the console variable system to modify its value rather than changing it directly.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:44

Scope (from outer to inner):

file
namespace    FCrowdDebug

Source code excerpt:

	/** if set, debug information will be displayed for agent selected in editor */
	int32 DebugSelectedActors = 0;
	FAutoConsoleVariableRef CVarDebugSelectedActors(TEXT("ai.crowd.DebugSelectedActors"), DebugSelectedActors,
		TEXT("Enable debug drawing for selected crowd agent.\n0: Disable, 1: Enable"), ECVF_Default);

	/** if set, basic debug information will be recorded in VisLog for all agents */
	int32 DebugVisLog = 0;
	FAutoConsoleVariableRef CVarDebugVisLog(TEXT("ai.crowd.DebugVisLog"), DebugVisLog,
		TEXT("Enable detailed vislog recording for all crowd agents.\n0: Disable, 1: Enable"), ECVF_Default);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:43

Scope (from outer to inner):

file
namespace    FCrowdDebug

Source code excerpt:

{
	/** if set, debug information will be displayed for agent selected in editor */
	int32 DebugSelectedActors = 0;
	FAutoConsoleVariableRef CVarDebugSelectedActors(TEXT("ai.crowd.DebugSelectedActors"), DebugSelectedActors,
		TEXT("Enable debug drawing for selected crowd agent.\n0: Disable, 1: Enable"), ECVF_Default);

	/** if set, basic debug information will be recorded in VisLog for all agents */
	int32 DebugVisLog = 0;
	FAutoConsoleVariableRef CVarDebugVisLog(TEXT("ai.crowd.DebugVisLog"), DebugVisLog,
		TEXT("Enable detailed vislog recording for all crowd agents.\n0: Disable, 1: Enable"), ECVF_Default);

#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/Navigation/CrowdManager.cpp:1173

Scope (from outer to inner):

file
function     void UCrowdManager::DebugTick

Source code excerpt:

	// on screen debugging
	const dtCrowdAgent* SelectedAgent = DetourAgentDebug->idx >= 0 ? DetourCrowd->getAgent(DetourAgentDebug->idx) : NULL;
	if (SelectedAgent && FCrowdDebug::DebugSelectedActors)
	{
		if (FCrowdDebug::DrawDebugCorners)
		{
			DrawDebugCorners(SelectedAgent);
		}