MaxGlobalTimeDilation
MaxGlobalTimeDilation
#Overview
name: MaxGlobalTimeDilation
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 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MaxGlobalTimeDilation is to set an upper limit on the global time dilation in Unreal Engine 5. It represents the highest acceptable value for slowing down or speeding up the game’s time flow globally.
This setting variable is primarily used in the Engine module, specifically within the GameFramework system. It is defined in the AWorldSettings class, which is responsible for managing various world-related settings.
The value of MaxGlobalTimeDilation is set in the AWorldSettings class as a configurable property. It can be modified through the Unreal Editor or programmatically.
MaxGlobalTimeDilation interacts with other time-related variables, such as MinGlobalTimeDilation and TimeDilation. It works in conjunction with these variables to control the overall time flow of the game.
Developers must be aware that:
- MaxGlobalTimeDilation acts as a clamp for the upper limit of time dilation.
- Setting this value too high might result in unexpected behavior in physics simulations or gameplay mechanics.
- It affects the entire game world and all actors within it.
Best practices when using this variable include:
- Setting a reasonable upper limit that doesn’t break game mechanics or physics simulations.
- Using it in conjunction with MinGlobalTimeDilation to define a safe range for time dilation.
- Being cautious when modifying it during runtime, as it can significantly impact gameplay.
- Considering the impact on networked multiplayer games, where time dilation changes need to be synchronized across clients.
- Testing thoroughly with different MaxGlobalTimeDilation values to ensure game stability and performance.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseGame.ini:184, section: [/Script/Engine.WorldSettings]
- INI Section:
/Script/Engine.WorldSettings
- Raw value:
20.0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/WorldSettings.h:819
Scope (from outer to inner):
file
class class AWorldSettings : public AInfo, public IInterface_AssetUserData
Source code excerpt:
/** Highest acceptable global time dilation. */
UPROPERTY(config, EditAnywhere, Category = Tick, AdvancedDisplay, meta = (UIMin = "0", ClampMin = "0"))
float MaxGlobalTimeDilation;
/** Smallest possible frametime, not considering dilation. Equiv to 1/FastestFPS. */
UPROPERTY(config, EditAnywhere, Category = Tick, AdvancedDisplay, meta = (UIMin = "0", ClampMin = "0"))
float MinUndilatedFrameTime;
/** Largest possible frametime, not considering dilation. Equiv to 1/SlowestFPS. */
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameplayStatics.cpp:560
Scope (from outer to inner):
file
function void UGameplayStatics::SetGlobalTimeDilation
Source code excerpt:
if (TimeDilation != ActualTimeDilation)
{
UE_LOG(LogBlueprintUserMessages, Warning, TEXT("Time Dilation must be between %f and %f. Clamped value to that range."), WorldSettings->MinGlobalTimeDilation, WorldSettings->MaxGlobalTimeDilation);
}
}
}
}
bool UGameplayStatics::SetGamePaused(const UObject* WorldContextObject, bool bPaused)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldSettings.cpp:149
Scope (from outer to inner):
file
function void AWorldSettings::PostInitProperties
Source code excerpt:
}
if (MaxGlobalTimeDilation < 0)
{
MaxGlobalTimeDilation = 0;
}
if (MinUndilatedFrameTime < 0)
{
MinUndilatedFrameTime = 0;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldSettings.cpp:289
Scope (from outer to inner):
file
function float AWorldSettings::SetTimeDilation
Source code excerpt:
float AWorldSettings::SetTimeDilation(float NewTimeDilation)
{
TimeDilation = FMath::Clamp(NewTimeDilation, MinGlobalTimeDilation, MaxGlobalTimeDilation);
return TimeDilation;
}
void AWorldSettings::NotifyBeginPlay()
{
UWorld* World = GetWorld();