s.AdaptiveAddToWorld.TimeSliceMaxIncreasePerSecond
s.AdaptiveAddToWorld.TimeSliceMaxIncreasePerSecond
#Overview
name: s.AdaptiveAddToWorld.TimeSliceMaxIncreasePerSecond
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Max rate at which the adptive AddToWorld timeslice will increase. Set to 0 to increase instantly
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of s.AdaptiveAddToWorld.TimeSliceMaxIncreasePerSecond is to control the rate at which the adaptive AddToWorld time slice increases in Unreal Engine’s world management system.
This setting variable is primarily used in the Engine module, specifically in the world management subsystem. It’s part of the adaptive time slicing mechanism for adding objects to the world.
The value of this variable is set through the Unreal Engine console or configuration files. It’s defined as a static float and exposed as a console variable using FAutoConsoleVariableRef.
This variable interacts closely with GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond, which is the associated C++ variable that directly holds the value. It also works in conjunction with s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond to manage the adaptive time slice behavior.
Developers must be aware that:
- Setting this value to 0 will cause the time slice to increase instantly.
- This variable affects performance by controlling how quickly the engine can adapt to increased load when adding objects to the world.
Best practices when using this variable include:
- Carefully tuning the value based on your game’s specific needs and performance characteristics.
- Using it in conjunction with other adaptive AddToWorld settings for optimal performance.
- Monitoring its effects during development and adjusting as necessary.
Regarding the associated variable GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond:
The purpose of this variable is to directly store the maximum rate at which the adaptive AddToWorld time slice can increase per second.
It’s used within the FAdaptiveAddToWorld class in the Engine module, specifically in the EndUpdate function.
The value is set by the console variable s.AdaptiveAddToWorld.TimeSliceMaxIncreasePerSecond.
It interacts with the BaseTimeSlice and DesiredBaseTimeSlice variables to control the adaptive time slicing behavior.
Developers should be aware that this variable directly affects the engine’s ability to adapt to increased load when adding objects to the world. A higher value allows for faster adaptation but may lead to more abrupt changes in performance.
Best practices include:
- Adjusting this value in tandem with s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond for balanced adaptation.
- Testing different values to find the optimal balance between responsiveness and stability for your specific game.
- Monitoring performance metrics when adjusting this value to ensure it’s having the desired effect.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:183
Scope: file
Source code excerpt:
static float GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond = 0.0f;
FAutoConsoleVariableRef CVarAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond(TEXT("s.AdaptiveAddToWorld.TimeSliceMaxIncreasePerSecond"), GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond,
TEXT("Max rate at which the adptive AddToWorld timeslice will increase. Set to 0 to increase instantly"));
static float GAdaptiveAddToWorldTimeSliceMaxReducePerSecond = 0.0f;
FAutoConsoleVariableRef CVarAdaptiveAddToWorldTimesliceReductionSpeedPerSecond(TEXT("s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond"), GAdaptiveAddToWorldTimeSliceMaxReducePerSecond,
TEXT("Max rate at which the adptive AddToWorld timeslice will reduce. Set to 0 to reduce instantly"));
#Associated Variable and Callsites
This variable is associated with another variable named GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:182
Scope: file
Source code excerpt:
TEXT("Target max time remaining in seconds. If our estimated completion time is longer than this, the timeslice will increase. Lower values are more aggressive"));
static float GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond = 0.0f;
FAutoConsoleVariableRef CVarAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond(TEXT("s.AdaptiveAddToWorld.TimeSliceMaxIncreasePerSecond"), GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond,
TEXT("Max rate at which the adptive AddToWorld timeslice will increase. Set to 0 to increase instantly"));
static float GAdaptiveAddToWorldTimeSliceMaxReducePerSecond = 0.0f;
FAutoConsoleVariableRef CVarAdaptiveAddToWorldTimesliceReductionSpeedPerSecond(TEXT("s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond"), GAdaptiveAddToWorldTimeSliceMaxReducePerSecond,
TEXT("Max rate at which the adptive AddToWorld timeslice will reduce. Set to 0 to reduce instantly"));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:289
Scope (from outer to inner):
file
class class FAdaptiveAddToWorld
function void EndUpdate
Source code excerpt:
// Limit the timeslice change based on MaxIncreasePerSecond/ MaxReducePerSecond
float NewBaseTimeSlice = DesiredBaseTimeSlice;
if (DesiredBaseTimeSlice > BaseTimeSlice && GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond > 0.0)
{
NewBaseTimeSlice = FMath::Min(NewBaseTimeSlice, BaseTimeSlice + GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond * DeltaT);
}
if (DesiredBaseTimeSlice < BaseTimeSlice && GAdaptiveAddToWorldTimeSliceMaxReducePerSecond > 0.0)
{
NewBaseTimeSlice = FMath::Max(NewBaseTimeSlice, BaseTimeSlice - GAdaptiveAddToWorldTimeSliceMaxReducePerSecond * DeltaT);
}
BaseTimeSlice = NewBaseTimeSlice;