MaxAllowedTestingTime
MaxAllowedTestingTime
#Overview
name: MaxAllowedTestingTime
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 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MaxAllowedTestingTime is to set a time limit for Environment Query System (EQS) testing in Unreal Engine 5. It defines the maximum duration, in seconds, that the EQS is allowed to spend on testing queries during each update cycle.
This setting variable is primarily used by the AI Module, specifically within the Environment Query System. It’s a critical part of the UEnvQueryManager class, which manages the execution of environment queries.
The value of MaxAllowedTestingTime is typically set in the engine configuration files, as indicated by the UPROPERTY(config) decorator. It can also be set programmatically, as seen in the UEnvQueryManager constructor where it’s initialized to 0.01 seconds.
MaxAllowedTestingTime interacts closely with other EQS-related variables, particularly bTestQueriesUsingBreadth, which determines the order in which queries are tested (breadth-first or depth-first).
Developers must be aware that this variable directly impacts the performance and responsiveness of the AI system. Setting it too low might result in incomplete or inaccurate query results, while setting it too high could cause frame rate drops or unresponsive AI behavior.
Best practices when using this variable include:
- Balancing it carefully with the complexity and number of your environment queries.
- Monitoring its impact on performance using profiling tools.
- Adjusting it based on the target platform’s capabilities.
- Consider exposing it as a configurable setting for different quality levels or debug purposes.
- Be cautious when modifying it at runtime, as it can significantly affect AI behavior and performance.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:212, section: [/Script/AIModule.EnvQueryManager]
- INI Section:
/Script/AIModule.EnvQueryManager
- Raw value:
0.01
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Classes/EnvironmentQuery/EnvQueryManager.h:33
Scope: file
Source code excerpt:
/** how long are we allowed to test per update, in seconds. */
UPROPERTY(config)
float MaxAllowedTestingTime = 0.003f;
/** whether we update EQS queries based on:
running a test on one query and move to the next (breadth) - default behavior,
or test an entire query before moving to the next one (depth). */
UPROPERTY(config)
bool bTestQueriesUsingBreadth = false;
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Classes/EnvironmentQuery/EnvQueryManager.h:337
Scope (from outer to inner):
file
class class UEnvQueryManager : public UAISubsystem, public FSelfRegisteringExec
Source code excerpt:
/** how long are we allowed to test per update, in seconds. */
UPROPERTY(config)
float MaxAllowedTestingTime;
/** whether we update EQS queries based on:
running a test on one query and move to the next (breadth) - default behavior,
or test an entire query before moving to the next one (depth). */
UPROPERTY(config)
bool bTestQueriesUsingBreadth;
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/EnvironmentQuery/EnvQueryManager.cpp:178
Scope (from outer to inner):
file
function UEnvQueryManager::UEnvQueryManager
Source code excerpt:
{
NextQueryID = 0;
MaxAllowedTestingTime = 0.01f;
bTestQueriesUsingBreadth = true;
NumRunningQueriesAbortedSinceLastUpdate = 0;
QueryCountWarningThreshold = 0;
QueryCountWarningInterval = 30.0;
#if !(UE_BUILD_SHIPPING)
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/EnvironmentQuery/EnvQueryManager.cpp:440
Scope (from outer to inner):
file
function void UEnvQueryManager::Tick
Source code excerpt:
#endif
double TimeLeft = MaxAllowedTestingTime;
int32 QueriesFinishedDuringUpdate = 0;
{
SCOPE_CYCLE_COUNTER(STAT_AI_EQS_TickWork);
const int32 NumRunningQueries = RunningQueries.Num();
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/EnvironmentQuery/EnvQueryManager.cpp:569
Scope (from outer to inner):
file
function void UEnvQueryManager::Tick
Source code excerpt:
if (QueryInstancePtr && bWorkHasBeenDone)
{
EQSDebugger.StoreTickTime(*QueryInstancePtr, StepProcessingTime, MaxAllowedTestingTime);
}
#endif // USE_EQS_DEBUGGER
}
}
}
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/EnvironmentQuery/EnvQueryManager.cpp:1138
Scope (from outer to inner):
file
function void UEnvQueryManager::Configure
Source code excerpt:
UE_VLOG_ALWAYS_UELOG(this, LogEQS, Log, TEXT("Applying new FEnvQueryManagerConfig: %s"), *NewConfig.ToString());
MaxAllowedTestingTime = NewConfig.MaxAllowedTestingTime;
bTestQueriesUsingBreadth = NewConfig.bTestQueriesUsingBreadth;
QueryCountWarningThreshold = NewConfig.QueryCountWarningThreshold;
QueryCountWarningInterval = NewConfig.QueryCountWarningInterval;
ExecutionTimeWarningSeconds = NewConfig.ExecutionTimeWarningSeconds;
HandlingResultTimeWarningSeconds = NewConfig.HandlingResultTimeWarningSeconds;
GenerationTimeWarningSeconds = NewConfig.GenerationTimeWarningSeconds;
#Loc: <Workspace>/Engine/Source/Runtime/AIModule/Private/EnvironmentQuery/EnvQueryManager.cpp:1321
Scope (from outer to inner):
file
function FString FEnvQueryManagerConfig::ToString
Source code excerpt:
FString FEnvQueryManagerConfig::ToString() const
{
return FString::Printf(TEXT("MaxAllowedTestingTime=%f bTestQueriesUsingBreadth=%d QueryCountWarningThreshold=%d QueryCountWarningInterval=%f ExecutionTimeWarningSeconds=%f HandlingResultTimeWarningSeconds=%f GenerationTimeWarningSeconds=%f"), MaxAllowedTestingTime, bTestQueriesUsingBreadth, QueryCountWarningThreshold, QueryCountWarningInterval, ExecutionTimeWarningSeconds, HandlingResultTimeWarningSeconds, GenerationTimeWarningSeconds);
}