s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond

s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond

#Overview

name: s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond

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 s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond is to control the rate at which the adaptive AddToWorld time slice can be reduced in Unreal Engine’s world management system.

This setting variable is primarily used in the Engine module, specifically within the world management subsystem. It’s referenced in the World.cpp file, which is a core part of Unreal Engine’s runtime environment.

The value of this variable is set through the console variable system. It’s initialized to 0.0f and can be modified at runtime using the console command system.

The associated variable GAdaptiveAddToWorldTimeSliceMaxReducePerSecond directly interacts with s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond. They share the same value, with the console variable acting as an interface for runtime modification.

Developers must be aware that this variable affects the performance of adding objects to the game world. Setting it to 0 will cause the time slice to reduce instantly, which might lead to performance spikes. A non-zero value allows for a more gradual reduction.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your project and target hardware.
  2. Testing different values to find the optimal balance between responsiveness and performance stability.
  3. Considering it in conjunction with s.AdaptiveAddToWorld.TimeSliceMaxIncreasePerSecond for a comprehensive approach to time slice management.

Regarding the associated variable GAdaptiveAddToWorldTimeSliceMaxReducePerSecond:

The purpose of GAdaptiveAddToWorldTimeSliceMaxReducePerSecond is to store the actual value used in the engine’s calculations for adaptive world management.

It’s used directly in the FAdaptiveAddToWorld class, specifically in the EndUpdate function. This suggests it’s part of the core logic for adapting the time slice for adding objects to the world.

The value is set through the console variable system, allowing for runtime adjustments.

It interacts directly with s.AdaptiveAddToWorld.TimeSliceMaxReducePerSecond, effectively implementing the behavior defined by that setting.

Developers should be aware that modifying this variable directly in code (rather than through the console variable) might lead to inconsistencies with the exposed setting.

Best practices include:

  1. Primarily interacting with this variable through the console variable system rather than direct code modification.
  2. Considering its impact on frame-to-frame performance when adjusting its value.
  3. Using it in conjunction with other adaptive world management variables for a holistic approach to performance optimization.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:187

Scope: file

Source code excerpt:


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"));

class FAdaptiveAddToWorld
{
	struct FHistoryEntry
	{

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:186

Scope: file

Source code excerpt:

	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"));

class FAdaptiveAddToWorld
{
	struct FHistoryEntry
	{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:293

Scope (from outer to inner):

file
class        class FAdaptiveAddToWorld
function     void EndUpdate

Source code excerpt:

					NewBaseTimeSlice = FMath::Min(NewBaseTimeSlice, BaseTimeSlice + GAdaptiveAddToWorldTimeSliceMaxIncreasePerSecond * DeltaT);
				}
				if (DesiredBaseTimeSlice < BaseTimeSlice && GAdaptiveAddToWorldTimeSliceMaxReducePerSecond > 0.0)
				{
					NewBaseTimeSlice = FMath::Max(NewBaseTimeSlice, BaseTimeSlice - GAdaptiveAddToWorldTimeSliceMaxReducePerSecond * DeltaT);
				}
				BaseTimeSlice = NewBaseTimeSlice;
			}
		}
		else
		{