Ability asset

Summary

The most fundamental part of abilities is the Ability asset. It represent an action a character can perform in-game and comes packed with a collection of flexible and independent features that can be used to customize and control the way abilities work and feel in your game.

Creating a new ability

Abilities are scriptable objects and to create one, you'll need to right click on the Project Panel and navigate to Create → Game Creator → Abilities → Ability.

new asset menu.png

An Ability asset will appear, with a list of sections that can be expanded or collapsed so it is easy for the user to modify and organize their abilities.

inspector_1.png

The ID value is a unique text that represents an ability. When creating a new asset, it will be completely unique. However, duplicating an existing ability will also duplicate the ID and a red message will appear above stating that there are two items with the same ID.

To solve that, expand the field and click on the Regenerate button to create a new unique ID. You can also type in a name if you follow a naming convention that ensures that all item IDs are unique.

The Icon field is used to represent the ability in UI, if not set, a white square will be used instead.

The Range field represents the distance within which the ability can reach.

 
 
Main features

An Ability is defined by a scriptable object inside your project folder. It is organized into multiple collapse-able sections, each of which controls a very specific feature of this system.

Targeting : An input system that allows to change how the targets are acquired by the system. Automatically find the closest target, centers around the caster or at the mouse click are some of the different options.

Activation : Controls how the ability activates its effect on the target and how input is processed. Some options are a single activation driven by an animation, or a channeling effect that stays active as long as it is on.

Requirements : Define conditions which needs to be met in order to for an ability to be cast-able. Some requirements can also prevent an ability from activate and/or apply a cost to it, e.g. cooldown or mana cost.

Filters : Define conditions that are used to filter the valid targets for your ability, e.g. filtering the caster to prevent friendly fire.

Effects : Controls what the ability actually do, once it has activated and found valid targets, e.g. damaging a target, spawning projectiles or explosion impacts and more.

inspector_2_edited.jpg
 
Execution sequence
  1. When the ability is triggered, the Requirement system determines if the ability can be executed.

  2. The Targeting system triggers the input and, determine the location the ability will activate from.

  3. The requirement system determines if the ability can be activated and activation costs are paid.

  4. The Activation system decides how the ability will play out. Typically an animation is played using the Reactive Gesture system. Then, the animation sends a signal back to complete the activation.

  5. The Targeting system works together with the Filter system to determines the valid target(s).

  6. Finally, the Effect system applies the effects on the valid targets.

Visual representation : Execution order

Player Input

Animation callback

1

Usage
Requirements

2

Input  Location

3

Activation
Requirements

4

Activation
Animation

5

Targeting
Filter

6

Effects
Resolution

 
Targeting System

The targeting system is responsible for handling player input and acquiring targets.

A target can be any game object or location.

Depending on the system used, targeting happens in two phases. Once before activation to find the target location, and once after the activation to confirm the targets (c.f. #2 & #5 in the above graph).

Some settings have automatic input, e.g. Cast on Self will automatically use the caster as a target, while others will require the player input, e.g. Cast on Location requires the player to click on the ground.

Targeting-2.png

AI Input

A target can be submitted directly to the ability using an instruction to allow AI to use abilities as well. Refer to the Instructions section for more information.

Cast on closest target

This targeting system will look for each potential target in the specify radius around the user location and select the closest one. This method acquires the target at input time (#2), meaning that once the animation starts, the target will always get hit. This can be avoided by using requirements.

  • Radius : Maximum distance from the target location

  • Target Layer : Physics layer used to detect targets. Targets that are not part of the specify layers will be ignored.

Targeting-1.png

Physics detection

Any game object can represent a valid target for the ability, the only requirement is the presence of a collider on it.

In case of problem, please double check that a collider exist on the target and that the ability is properly set to detect that layer

Context menu

You can access a context menu by right clicking on most elements.

Elements can be replaced or disabled and documentation can be accessed through it.

Cast on Self

This targeting system will automatically use the caster as target for the ability at input time (#2). It will optionally target multiple targets at activation time (#5).

  • Multi Target : Enable multi target.

  • Radius : Maximum distance from the target

  • Target Layer : Physics layer used to detect targets. Targets that are not part of the specify layers will be ignored.

  • Targeting Marker : Optional indicator which spawns at the target location while the input is being processed. Using the UI input, the indicator will be visible as long as the corresponding button is pressed.

Targeting-self.png

Cast on Location

This targeting system will automatically use the caster as target for the ability. It will optionally target multiple targets and display a marker on the ground while the input is kept pressed.

  • Radius : Area of effect - Distance from the center within which targets are selected.

  • Targeting Marker : Optional indicator which spawns at the target location while the input is being processed. Using the UI input, the indicator will be visible as long as the corresponding button is pressed.

  • Ground Layer : Physics layer used to draw the indicator on the floor.

  • Target Layer : Physics layer used to detect targets. Targets that are not part of the specify layers will be ignored.

Targeting-location.png
 
Activation System

The activation system is the center piece and dictates how the ability works.

At the moment only one activation type exist, but more will be added.

Single

The single activation starts an animation and wait for it to finish, ending the ability. Effects will be applied after receiving an activation notification from the animation. 

  • Animation : Reactive Gesture containing the animation to play.

  • Face Target : When enabled, will turn the character to face the target. Rotation speed is defined by the Motion Unit.

  • Walk in Range : When enabled, this will cause the character to first walk within range of the ability

Activation.png

Runtime error

When Face Target is enabled during the execution of an ability, if the character is selected in the inspector, there will be an error. This is due to how Unity & Game Creator handle serialization and this will only happen in the editor. To avoid this, we recommend that you use our custom Rotation Unit Look at Target - Pivot.

rotation unit.png

This unit is an hybrid between Pivot and Look at Target, it acts as a Pivot when no targets are available, and acts as Look at Target when no targets are available.

The need for this custom Rotation Unit is only to avoid the runtime error in the editor.

 
Requirement System

The targeting system lets you select the initial targets of the ability.

Targeting-1.png
 
Filter System

The targeting system lets you select the initial targets of the ability.

Targeting-1.png
 
Effect System

The targeting system lets you select the initial targets of the ability.

Targeting-1.png