text
stringlengths 0
17.2k
|
---|
This guarantees that some of its Abilities, Attributes, and Effects persist between possessing Pawns. This logic provides an easier process to retain the GAS state between the game phase changes. However, special care is required when initializing and de-initializing the Pawn-specific GAS state every time you Possess or Unpossess a Pawn. |
Lyra accommodates this through the ULyraHeroComponent and the ULyraPawnExtensionComponent. These Components are responsible for granting a specific set of Abilities, Attributes, and Gameplay Effects to the PlayerState's AbilitySystemComponent when it's possessed by a valid Controller. These are revoked automatically when the Pawn is eliminated, unpossessed, or otherwise removed from play. |
You can navigate to the ULyraHeroComponent from the c:\ReleaseWorkspace\Samples\Games\Lyra\Source\LyraGame\Hero\LyraHeroComponent.h directory and the ULyraPawnExtensionComponent from the c:\Lyra\Source\LyraGame\Pawn\LyraPawnExtensionComponent.h file directory. |
High-level game phase logic is managed server-side by the Lyra Game State (ALyraGameState) class, located in your C:\Lyra\Source\LyraGame\LyraGameState.h file. Game States exist on both the client and server, and use an Ability System Component with Game Phases that are implemented as abilities. These Game Phases are activated and deactivated to affect how gameplay events are handled. As an example, ShooterCore implements three phases: |
While Game States exist on both the Client and Server, Game Mode is server-only |
Game Phase abilities extend from the ULyraGamePhaseAbility class, with each ability encapsulating an individual state. The Game State logic assumes ability activation is phase start, and ability end is phase end. This provides you with the capability to listen for the start or end of specific phases, using the Gameplay Tag GamePhaseTag. |
You can switch phases from Blueprint using the Lyra Game Phase Subsystem (ULyraGamePhaseSubsytem), which ends the previous phase ability (if it's running) and activates a new one. |
Abilities granted through the Gameplay Ability Set (UGameplayAbilitySet) will automatically check for activation if a matching Input Tag is received fromLyra's Input system. This streamlines ability activation without having to rely on opaque numeric Input ID numbers or manually handling Input Action events. Examples include jumping (GA_Hero_Jump) and weapon firing (GA_Weapon_Fire), described below. |
GAS Abilities and Effects provide the functionality to block or cancel specific Abilities based on which Gameplay Tags have been granted to their owner, typically by other Abilities or Gameplay Effects. |
This information is held by each specific Ability and Effect, which may be inconvenient when you need to make overarching changes to these relationships. For example, as your game grows and its rules become more complex, it can lead to errors and inconsistencies when updating your game rules. |
Lyra provides an improvement to this workflow by introducing the Lyra Ability Tag Relationship Mapping (ULyraAbilityTagRelationshipMapping) data assets. These hold a list of blocking, canceling, and required tag relationships. They can be created through the Content Browser > Add > Miscellaneous > Data Asset. |
You can specify an Ability Tag Relationship Mapping asset as part of an ULyraPawnData asset, and it will be assigned to the corresponding Lyra Ability System Component when the Pawn is possessed. When the Ability System Component holds a reference to a valid tag relationship mapping, it will apply these as an additional layer of activation and cancellation conditions for ability activation. |
The Lyra Global Ability System (ULyraGlobalAbilitySystem) provides a quick means of keeping track of and interacting with all Lyra Ability System Components in a level. |
A Lyra Ability System Component will automatically register with the subsystem during initialization. Currently, the subsystem provides Blueprint-callable functions to grant or remove Abilities and Gameplay effects from all registered Ability System Components. |
For example, Lyra's Elimination mode applies a Gameplay Effect (GE_PregameLobby) globally during the warm-up phase of a match. It grants a damage immunity tag to all players and triggers a Gameplay Cue that enables a UI element indicating that the match hasn't started yet. |
The Lyra Ability Set (ULyraAbilitySet) is a Data Asset type that can be created from the Content Browser. It holds a list of Gameplay Abilities, Gameplay Effects, and Attribute Sets which will be granted to a Lyra Character when the Ability Set is applied. |
Parties that grant Lyra Ability Sets, such as Game Features or Equipment, are responsible for tracking which Actors they are granted to. A helper struct, FLyraAbilitySet_GrantedHandles, is used for bookkeeping and removal. |
Ability Sets can be granted in a variety of ways: |
These abilities are granted to the Player State, not the Pawn it possesses. They may be granted before a Pawn is possessed and persist even if the possessed Pawn changes. They won't be Activated until the Pawn itself is possessed, even if their Activation Policy is set to On Spawn. Plan accordingly. |
These abilities are granted to the Player State, not the Pawn it possesses. They may be granted before a Pawn is possessed and persist even if the possessed Pawn changes. They won't be Activated until the Pawn itself is possessed, even if their Activation Policy is set to On Spawn. Plan accordingly. |
The Lyra Gameplay Ability (ULyraGameplayAbility) is extended from the UGameplayAbility class to provide extra utility and interface with the Lyra framework. |
The Activation Group determines if an ability can be freely activated, or if the ability blocks or interrupts other exclusive abilities. You can achieve additional complex blocking behaviors using the following Tag Relationship assets: |
Most game actions, such as shooting, switching weapons, and melee attacks are set to Independent and Blocking. Concurrency and Cancellation are mediated by Tag Relationships. Leaderboards and other in-game menus are set to Exclusive Blocking to ensure that only one menu is visible at a time. |
Allows ability activation to be automatically handled by the Lyra framework. |
We recommend caution using this activation if the Retrigger Instanced Ability is set, otherwise you could spam activation and get undesired effects. |
Some Lyra Abilities use the K2_CanActivateAbility function to implement activation checks in Blueprints instead of C++. The function returns true or false to allow activation and provides you with context gameplay tags to determine what may have prevented an activation. This is exposed to all Gameplay Abilities, not just Lyra's. |
Normal Gameplay Abilities only allow for a single Cost and Cooldown Gameplay Effect. The Additional Costs list provides you additional costs you can specify without setting them to Gameplay Effects, which enables more complex activation conditions. |
Additional costs are integrated into the standard cost flow and can be checked and committed manually with the corresponding Check Cost and Commit Cost nodes, or Commit Ability (if you also want to commit the cooldown). |
Actual costs are implemented as ULyraAbilityCost objects. You can create custom costs by extending this class in C++ and overriding the CheckCost and ApplyCost virtual functions. |
Lyra implements several additional costs using ULyraAbilityCost_PlayerTagStack, which consumes a number of stacks from the specified Gameplay Tag on the Player State. These assume they are being called from an Ability deriving from ULyraGameplayAbility_FromEquipment. |
Lyra Abilities provide additional Blueprint Events that enable the ability to handle being added to or removed from a character without the need to rely on activation. These are useful for initial setup and cleanup. |
Lyra Abilities can override the Camera Mode through the Set Camera Mode and Clear Camera Mode Blueprint nodes. One example is the use of a death camera mode while a pawn is dying, triggered by the GA_Hero_Death ability. |
Lyra's abilities commonly include a type Gameplay Tag in their 'Ability Tags' property to classify them hierarchically. This type tag is widely used to manage blocking, canceling, and required tag settings on other abilities, or through the Tag Relationship system. |
As examples, the character-centric action abilities include type tags such as 'Ability.Type.Action.Dash' and 'Ability.Type.Action.Jump'. But there are also passive abilities that outlive the characters with tags such as 'Ability.Type.Passive.AutoRespawn'. Character death will cancel all other character action abilities, without affecting some others. |
Some Lyra Abilities have C++ implementations, to either enforce specific activation conditions, perform complex math logic(that would be cumbersome to implement in a Blueprint), or interact with sensitive low-level gameplay systems. See the table below for some example Abilities. |
These are some examples of how the Blueprint subclasses make use of the extended ability functionality in Lyra. |
The Lyra Gameplay Effect Context extends from the default Gameplay Effect Context (FGameplayEffectContext) struct provided by the GAS to define additional data members and functions to be sent to Gameplay Cue Notifies. Because FGameplayEffectContext is a struct type, it needs a replacement type that can be correctly recognized by Unreal and the Gameplay Ability System. The Lyra Gameplay Effect Context overrides multiple functions: |
A struct template (TStructOpsTypeTraits<>) is defined for the Lyra Gameplay Effect Context. This helper struct will bind both the duplication and serialization functionality and make them available to the replication system. |
The Lyra Ability System Globals (ULyraAbilitySystemGlobals) class extends the Ability System Globals (UAbilitySystemGlobals) class and overrides the AllocGameplayEffectContext() function to construct and return a Lyra Gameplay Effect Context struct. |
This ensures the Gameplay Ability System allocates the extended structure whenever a new Gameplay Effect Context object is created. |
Currently, the Gameplay Effect Context struct provides the unique Cartridge ID associated with Shooter Core's ranged weapon hits and provides extra utility to access the Physical Material and Ability Source Object. |
Because it is a type of struct, the Lyra Gameplay Effect Context struct can't directly include a Blueprint-exposed function to access its data. |
A method to work around this limitation is to implement accessors as static functions in a Blueprint Function Library, pass the Context Handle as an input parameter, then cast it to the derived struct type internally. |
The helper function FLyraGameplayEffectContext::ExtractEffectContext takes care of casting context pointers to the specialized types. Currently, this is used in the FLyraGameplayAbilityTargetData_SingleTargetHit structure. |
Similar methods can be used to cast the Effect Context Handle passed to the Gameplay Cue through FGameplayCueParameters, allowing access to the extra functionality. |
The Lyra Attribute Set (ULyraAttributeSet) is extended from the default Attribute Set class. This Lyra-specific base class provides a convenient ATTRIBUTE_ACCESSORS macro to automate the Gameplay Attribute property and value for Get, Set, and Initialize functionality. |
FLyraAttributeEvent is used to streamline attribute changed events at the Attribute Set level. |
Lyra provides two specialized Attribute Set classes: |
The Lyra Health Set (ULyraHealthSet) Include the following attributes that manage the character's current and maximum health: |
This attribute set is also responsible for clamping the current Health value to MaxHealth, and for keeping track of when Health has run out. It implements a FLyraAttributeEvent delegate, which is fired when health runs out. |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.