![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "Containers/Array.h"#include "Containers/ArrayView.h"#include "Containers/ContainerAllocationPolicies.h"#include "Containers/UnrealString.h"#include "CoreMinimal.h"#include "Math/UnrealMathSSE.h"#include "Misc/AssertionMacros.h"#include "Net/Core/Connection/StateStruct.h"#include "Templates/EnableIf.h"#include "Templates/Function.h"#include "Templates/IsEnum.h"#include "Templates/Models.h"#include "Templates/UnrealTemplate.h"#include "Templates/UnrealTypeTraits.h"#include "UObject/Class.h"#include "UObject/Object.h"#include "UObject/ObjectMacros.h"#include "UObject/StructOnScope.h"#include "UObject/UObjectGlobals.h"#include "EscalationStates.generated.h"Go to the source code of this file.
Classes | |
| struct | FHasHitAnyQuotaParms |
| struct | FEscalationState |
| struct | TEscalationStateStatics< T > |
| struct | UE::Net::FEscalationCounter |
| class | UE::Net::FEscalationManager |
| class | UE::Net::TEscalationManager< CountersEnum, EscalationStateType, CounterCategoriesEnum > |
| class | UEscalationManagerConfig |
Namespaces | |
| namespace | UE |
| namespace | UE::Net |
Macros | |
| #define | ESCALATION_QUOTA_DEBUG 0 |
Typedefs | |
| using | UE::Net::FNotifySeverityUpdate = TUniqueFunction< void(const FEscalationState &OldState, const FEscalationState &NewState, ESeverityUpdate UpdateType)> |
Enumerations | |
| enum class | EQuotaType : uint8 { EscalateQuota , DeescalateQuota } |
| enum class | UE::Net::ESeverityUpdate : uint8 { UE::Net::Escalate , UE::Net::AutoEscalate , UE::Net::Deescalate } |
| enum class | UE::Net::EEscalateReason : uint8 { UE::Net::QuotaLimit , UE::Net::AutoEscalate , UE::Net::Deescalate } |
| enum class | UE::Net::EEscalateResult : uint8 { UE::Net::Escalated , UE::Net::Deescalated , UE::Net::NoChange } |
| enum | UE::Net::EEmptyCategories : uint32 { UE::Net::Max } |
| #define ESCALATION_QUOTA_DEBUG 0 |
Escalation States
Implements generic configurable 'escalation states' evolved from the RPC DoS and DDoS code, for setting threshold limits on monitored variables/conditions, and escalating through complex states of gradually higher thresholds.
Primarily used for monitoring and reacting to deteriorating network conditions, attempting mitigation and recovery from poor conditions.
Escalation State Definition
See 'State Struct Definition' in StateStruct.h. Defined escalation states are automatically implemented, as a parameter to TEscalationManager.
Additionally, you must implement the 'TEscalationStateStatics' interface in your state struct, for specifying hardcoded configuration values.
Escalation Counters
Escalation Counters are used to monitor an incrementing count and/or accumulating time value, which are incremented/accumulated every frame, and then automatically tracked internally in the Escalation Manager, to help efficiently calculate whether any thresholds/quota's have been hit.
The number of counters is hardcoded at compile time, defined using an enum in the following format (which MUST contain 'Max' after last counter): enum class ENetFaultCounters : uint8 { PacketCount, NetConnPacketFault, Max,
// NumPrealloc is optional, and will specify how many counters to inline-preallocate (beyond the already defined counters) NumPrealloc = 6 };
'GetFrameCounter' in FEscalationManager, is used to reference the current frame counter, for incrementing.
NOTE: If your escalation state calculates quotas over a period of seconds (e.g. 5/10 seconds), you must override 'GetHighestTimePeriod', and 'GetAllTimePeriods' - and specify all the time periods you need to monitor, so they are calculated/tracked behind the scenes.
Escalation Manager
The Escalation Manager implements all of the state handling/tracking and internal counter accumulation for efficient quota/threshold checks. Use TEscalationManager to implement a manager for your state/counters, like so: TEscalationManager<ENetFaultCounters, FNetFaultState> NetFaultEscalationManager;
Call 'Init' on the escalation manager to initialize it (specifying a ConfigContext if needed - see 'Configuration and Defaults' in StateStruct.h), and make sure a call to Tick is implemented (note that it takes the current time in seconds, not DeltaTime).
Quota checks
Your escalation state must implement 'HasHitAnyQuota', using the input history/counters to determine if your custom state thresholds have been hit. The various input counter values represent (partially) accumulated values for your counters, for testing thresholds over different time periods.
Second counters do not have Frame counters pre-accumulated, and Period counters do not have Second counters pre-accumulated - this is done manually.
See 'FNetFaultState' for a more detailed example of how quota checks are implemented.
Configuration
See 'Configuration and Defaults' in StateStruct.h.
Configuration works in a similar manner, except 'UEscalationManagerConfig' is subclassed instead, the 'TEscalationStateStatics' interface specifies ConfigSection and the config class to use, and escalation manager Init specifies ConfigContext.
UEscalationManagerConfig already loads the configuration state using EscalationSeverity/EscalationSeverityStates, (override 'InitConfigDefaultsInternal' to set the default configuration state). Time Quota debugging
|
strong |