Animation System {{ currentPage ? currentPage.title : "" }}

8.1  Overview

The first thing is choosing if you want to use the actual ACFAnimInstanceBP or ACFAnimInstance. The first one contains complete ready to use logic for both actions and locomotion, the second one has only base structures but you have to implement your own animgraph and state machines.

8.2 ACF Actions System

ACF Action System is the Core of ACF combat. All the actions are handled inside the ActionsManagerComponent, which acts like a kind of State Machine for the ACFCharacter. An Action, as the name itself suggest, is an animation (an AnimationMontage) played on your character that is bound somehow with some logic. Is an highly generic concept but for this reason could be actually used to do whatever you want while keeping an high level of abstraction, being extremely extendable and avoiding having tons of logic on your character. Actions are also modular so that you can use an Action logic for multiple characters avoiding code duplication and using composition and avoiding inheritance. 

8.3 Setup

The first thing to do to is to Setup the gameplay tag referred to your actions. This can be done in Project Settings  exactly as seen in the Chapter with ARS. once you have your Actions. In your Project Settings you’ll find a new tab dedicated to ACF. You have to tell to the system the base tag for basic actions that are automatically triggered by ACF like Idle (your default state), Hit (the state in which the character is send when an hit is received) and Death (the state in which the character is send when your Health (the Statistic identified with Health Tag) is <=0.

Other Configurations will be expanded in next chapters.

8.4 Actions

Character Actions are triggered from the ActionsManager Component with the TriggerAction function which takes as an Input both the Action Tag and the trigger priority. 

Actions are basically a set of character animations and logic. For each actions you can define an Animation Montage, an ActionClass with a set of implementable virtual methods and a set of configurable properties. 

High priority triggers will interrupt lower priority actions while their are executed. Trigger with the same priority will NOT interrupt actual action. Triggers with the Highest priority interrupts everything. The actions your character can execute are defined in the ACFAnimInstance. The reason why I choose to put Actions in the AnimInstance is because it would be easier to retarget for you an entire animset since, when you retarget an AnimBlueprint in Unreal, all the referenced assets are automatically retargeted to the new skeleton. 

To create a new action you need to create a new class that inherits from ACFBaseAction.

Actions have a set of methods that can be implemented. They are all commented largely in code and can be checked by passing your mouse cursor near the blueprint node of the implementable event.

Setting up an action is actually pretty easy but can be confusing the first time so I’ll try to explain how it works with an example. In the image below there is a configuration for a dual wielded attack action with combos that can be triggered only when we are in SwordAndShield Moveset.

The first 5 properties are from the ACFAttackActionsBP which is a subclass of ACFBaseAction

From ActionsConfig and belows there the properties that are common for all the actions. 

In that case we are setting that the Action.Attack  has an ActionCost of 25 Stamina points (RPG.Statistics.Stamina). If the carachter has not enough stamina, the action will not be triggered. Requirements are used to check if the Stat of the character are actually higher than the ones provided (useful for example for special attacks that may require a certain amount of Strength). 

Modifiers have been largely discussed in chapter 2, they can also be used for actions, for example for heavy attacks, that needs to be performed with a bonus in Strength or in MeleeDamage. 

PerformableiInAir: identifies if this action can be triggered while the character owner is not touching the ground. 

CanBeStored: if set to true, if this action is triggered when the character is busy doing an higher priority action, this action will be triggered once the character is not busy anymore. Please notice that stored actions are not stacked, just the last one is played.

CoolDown: when performed, this action is actually locked and cannot be performed until the cooldown is time is passed. 

PlayRandomMontageSection: if this montage has multiple section and this is set to true, a random section will be played. 

BindActionToAnimation: By default set to true, once the animation is finished, the action is automatically exited and character returns in Idle action as set in the DeveloperSettings. If this is is set to false you have to manually trigger ExitAction from the ActionsManagerComponent.

MontageReproductionTypes will be addressed in the next section. 

If you set your propriety as public you can edit them in the editor. Like in the picture above, AttackAction has a set of custom properties, in particular: 

SnapConfiguration: To actually snap to the CurrentTarget as stated in the ATSBaseTargetingComponent from the controller. 

RotationRateMultipliers to actually modify character's rotation rate during various attack phases, in particular during PreWinding (before damage activation), Winding (during damage activation), and PostWinding (after damage activation). Useful to create timed "vulnerability window" for your characters or enemies. 

DamageToActivate identifies which CollisionComponent should be activated and which trace channel (by default a NAME_None string will activate all damage traces)

8.5 Montage Reproduction Types

In ACF there are 4 different montage reproduction types. They are triggerable from the LocomotionComponent with the SetMontageReproductionType Method.

The Default method is RootMotion, which means that ActionMontages will be reproduced normally using RootMotion. 

OverrideSpeedWithCurve will overwrite RootMotion movent by applying a speed to the Character during the animation. The speed can be set by adding a speed curve to the animation or the animation montage. The name of the curve should be the same as set in the ACFAnimInstance in the property SpeedCurveName (the default name is "Speed").

OverrideSpeedAndDirectionWithCurve will do the same as OverrideSpeedWithCurve but  in addition you can specify the velocity direction (which by default is the actor forward vector) by calling the StartOverrideSpeedAndDirection method from the locomotion component.

OverrideSpeedAndSnapsToTarget do the same OverrideSpeedWithCurve but will allow to multiply final speed by a coefficent (the SnapMultiplier) that depends from the distance to the current target as defined in the ATSBaseTargetComponent from the controller. You can set the SnapConfiguration by calling StartSnapping from the LocomotionComponent.

Please note that only RootMotion currently supports replication. ACF curve-based systems are currently NOT replicated.

In the snap configuration you can set the maximum SnapMultiplier allowed and the base distance (the one for witch the SnapMultiplier will be 1). 

8.6 Movesets & Overlays

Movesets are group of locomotion animations and actions. In The ACFAnimInstance you can setup multiple Movesets.  You can switch between Movesets by calling the SwitchMovementType from the ACFCharacters. 

In ACF multiple movesets per character are used, for example, when changing weapon. You can set in the weapon his relative moveset and once the weapon is equipped the character will automatically switch to the related Moveset. 

This is used to implement complex animation systems in which every weapon has is own moveset avoiding enormous graphs replication in the Animationblueprint. In addition every moveset can have their own specific Actions that can be used only when that moveset is active. This is useful to handle special moves that can ony be triggered with a specific weapon. Actions that can be triggered independently from the Moveset are set in the CommonActions array.

The MovesetSwitchTime is the amount of time necessary to blend between Movesets.

Overlays are instead animation that are added on the top of the current moveset and blended with a tunable alpha. Sometime instead of using a new set of animation for a weapon, you would just add an overlay to an existing moveset. This is the case of overlays. Like Movesets, overlay are automatically added and removed once the character equips/unequips the weapon.

{{{ content }}}