Skip to content

GAS Integration

The Combat System is built on top of the Gameplay Ability System. This page will provide you some details on how this integration was build and which objects from G.A.S. you can expect to find in the Ninja Combat plugin.

Core Objects

Ability System Globals

This class is responsible for storing global data for the Ability System, including providing new instances for two structs that are used by this plugin FGameplayAbilityActorInfo and FGameplayEffectContext. You can find out more about this in this page.

The extension class providing the custom instances is named UNinjaCombatAbilitySystemGlobals and it can be set to the project in the DefaultGame.ini, like so:

[/Script/GameplayAbilities.AbilitySystemGlobals]
AbilitySystemGlobalsClassName="/Script/NinjaCombat.NinjaCombatAbilitySystemGlobals"

If you already have your own extension of the Ability System Globals, then please make sure to take a look into the UNinjaCombatAbilitySystemGlobals class, specifically the AllocAbilityActorInfo and AllocGameplayEffectContext functions. If you already have your own structs and want to continue using them, then please check the Proxies for information on how to proceed.

Initializing global data

Projects using GAS must invoke the InitGlobalData function, from UAbilitySystemGlobals at some point during the initialization. The Ninja Combat plugin does that for you, during the initialization of UNinjaCombatSubsystem, so you don't need to do that anywhere else.

Gameplay Cue Manager

This class is responsible for managing Gameplay Cues and routing them to appropriate handlers implementing the IGameplayCueInterface. The UNinjaCombatManagerComponent is a new handler introduced by the Combat System and therefore, it must be added to the routing.

The extension class providing the custom instances is named UNinjaCombatGameplayCueManager and it can be set to the project in the DefaultGame.ini, like so:

[/Script/GameplayAbilities.AbilitySystemGlobals]
GlobalGameplayCueManagerClass="/Script/NinjaCombat.NinjaCombatGameplayCueManager"

If you already have your own extension of the Gameplay Cue Manager, then please make sure to take a look into the UNinjaCombatGameplayCueManager class, specifically the RouteGameplayCue function and bring the necessary functionality into your own implementation.

Base Structs

The system provides its own versions of two very important enums defined by the Gameplay Ability System. They are the FGameplayAbilityActorInfo, which stores Actor information for Abilities and the FGameplayEffectContext, which carries contextual information for Gameplay Effects.

The Combat System provides its own version of both of them, FNinjaCombatGameplayAbilityActorInfo and FNinjaCombatGameplayEffectContext. They are overriden in the system via the UNinjaCombatAbilitySystemGlobals, which was detailed in a previous section.

However, the system never deals with them directly. Instead, if always use proxy objects, implementing specific interfaces to get and set information from these structs. This means that you can use your own version of these structs and keep the system working as expected, as long as you provide the appropriate implementations of the expected proxies.

Proxies

The proxies are used to interact with the core structs. This layer allows a separation of the structs and the system, allowing developers to either use the structs provided by the framework, or use new ones.

Each proxy is an implementation of an interface. The system always uses the interface to set or get information. You can set your own proxies in the Ninja Combat's Settings page.

Struct Interface Proxy
FNinjaCombatGameplayAbilityActorInfo ICombatActorInfoProxyInterface UNinjaCombatAbilityActorInfoProxy
FNinjaCombatGameplayEffectContext ICombatEffectContextProxyInterface UNinjaCombatEffectContextProxy