AbilitySystem.Fix.ClientSideMontageBlendOutTime
AbilitySystem.Fix.ClientSideMontageBlendOutTime
#Overview
name: AbilitySystem.Fix.ClientSideMontageBlendOutTime
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable a fix to replicate the Montage BlendOutTime for (recently) stopped Montages
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of AbilitySystem.Fix.ClientSideMontageBlendOutTime is to enable a fix for replicating the Montage BlendOutTime for recently stopped Montages in the Gameplay Ability System.
This setting variable is primarily used in the Gameplay Abilities plugin, which is part of Unreal Engine’s Ability System. It specifically affects the montage replication system within this plugin.
The value of this variable is set as a console variable (CVar) with a default value of true. It can be changed at runtime through console commands or programmatically.
The associated variable CVarGasFixClientSideMontageBlendOutTime directly interacts with this setting. They share the same value and purpose.
Developers must be aware that this variable affects the behavior of montage replication, particularly for recently stopped montages. When enabled, it allows the system to replicate the BlendOutTime, which can improve the visual consistency of animations across the network.
Best practices when using this variable include:
- Keeping it enabled (true) unless specific issues arise from its use.
- Testing the gameplay ability system thoroughly with this setting both enabled and disabled to ensure proper functionality in all scenarios.
- Being mindful of potential performance implications, as additional replication may occur when this fix is enabled.
Regarding the associated variable CVarGasFixClientSideMontageBlendOutTime:
This is the actual console variable that controls the behavior described above. It is defined using TAutoConsoleVariable, which allows it to be changed at runtime. The variable is used in the AnimMontage_UpdateReplicatedData function of the UAbilitySystemComponent class to determine whether to replicate the BlendOutTime for stopped montages.
Developers should be aware that this variable’s value is checked using GetValueOnAnyThread with a force game thread flag, which allows it to work correctly during replay playback. When enabled, it triggers a manual search through MontageInstances to find and replicate the appropriate BlendOutTime.
The best practice for using this associated variable is to treat it as you would the main setting variable, as they are effectively the same thing. Any changes or considerations applied to AbilitySystem.Fix.ClientSideMontageBlendOutTime should also be applied to CVarGasFixClientSideMontageBlendOutTime.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemComponent_Abilities.cpp:48
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarReplayMontageErrorThreshold(TEXT("replay.MontageErrorThreshold"), 0.5f, TEXT("Tolerance level for when montage playback position correction occurs in replays"));
static TAutoConsoleVariable<bool> CVarAbilitySystemSetActivationInfoMultipleTimes(TEXT("AbilitySystem.SetActivationInfoMultipleTimes"), false, TEXT("Set this to true if some replicated Gameplay Abilities aren't setting their owning actors correctly"));
static TAutoConsoleVariable<bool> CVarGasFixClientSideMontageBlendOutTime(TEXT("AbilitySystem.Fix.ClientSideMontageBlendOutTime"), true, TEXT("Enable a fix to replicate the Montage BlendOutTime for (recently) stopped Montages"));
static TAutoConsoleVariable<bool> CVarUpdateMontageSectionIdToPlay(TEXT("AbilitySystem.UpdateMontageSectionIdToPlay"), true, TEXT("During tick, update the section ID that replicated montages should use"));
static TAutoConsoleVariable<bool> CVarReplicateMontageNextSectionId(TEXT("AbilitySystem.ReplicateMontageNextSectionId"), true, TEXT("Apply the replicated next section Id to montages when skipping position replication"));
static TAutoConsoleVariable<bool> CVarEnsureAbilitiesEndGracefully(TEXT("AbilitySystem.EnsureAbilitiesEndGracefully"), true, TEXT("When shutting down (during ClearAllAbilities) we should check if all GameplayAbilities gracefully ended. This should be disabled if you have NonInstanced abilities that are designed for multiple concurrent executions."));
void UAbilitySystemComponent::InitializeComponent()
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarGasFixClientSideMontageBlendOutTime
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemComponent_Abilities.cpp:48
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarReplayMontageErrorThreshold(TEXT("replay.MontageErrorThreshold"), 0.5f, TEXT("Tolerance level for when montage playback position correction occurs in replays"));
static TAutoConsoleVariable<bool> CVarAbilitySystemSetActivationInfoMultipleTimes(TEXT("AbilitySystem.SetActivationInfoMultipleTimes"), false, TEXT("Set this to true if some replicated Gameplay Abilities aren't setting their owning actors correctly"));
static TAutoConsoleVariable<bool> CVarGasFixClientSideMontageBlendOutTime(TEXT("AbilitySystem.Fix.ClientSideMontageBlendOutTime"), true, TEXT("Enable a fix to replicate the Montage BlendOutTime for (recently) stopped Montages"));
static TAutoConsoleVariable<bool> CVarUpdateMontageSectionIdToPlay(TEXT("AbilitySystem.UpdateMontageSectionIdToPlay"), true, TEXT("During tick, update the section ID that replicated montages should use"));
static TAutoConsoleVariable<bool> CVarReplicateMontageNextSectionId(TEXT("AbilitySystem.ReplicateMontageNextSectionId"), true, TEXT("Apply the replicated next section Id to montages when skipping position replication"));
static TAutoConsoleVariable<bool> CVarEnsureAbilitiesEndGracefully(TEXT("AbilitySystem.EnsureAbilitiesEndGracefully"), true, TEXT("When shutting down (during ClearAllAbilities) we should check if all GameplayAbilities gracefully ended. This should be disabled if you have NonInstanced abilities that are designed for multiple concurrent executions."));
void UAbilitySystemComponent::InitializeComponent()
{
#Loc: <Workspace>/Engine/Plugins/Runtime/GameplayAbilities/Source/GameplayAbilities/Private/AbilitySystemComponent_Abilities.cpp:3041
Scope (from outer to inner):
file
function void UAbilitySystemComponent::AnimMontage_UpdateReplicatedData
Source code excerpt:
// Use AnyThread because GetValueOnGameThread will fail check() when doing replays
constexpr bool bForceGameThreadValue = true;
if (CVarGasFixClientSideMontageBlendOutTime.GetValueOnAnyThread(bForceGameThreadValue))
{
// Replicate blend out time. This requires a manual search since Montage_GetBlendTime will fail
// in GetActiveInstanceForMontage for Montages that are stopped.
for (const FAnimMontageInstance* MontageInstance : AnimInstance->MontageInstances)
{
if (MontageInstance->Montage == LocalAnimMontageInfo.AnimMontage)