Ability

From Dragon Age Toolset Wiki
Revision as of 21:13, 26 October 2009 by Georg Zoeller (Talk | contribs) (Rewrote ability targeting behavior section)

Jump to: navigation, search

Note: The information in this page is only a high level summary and inaccurate in some cases.

Overview

The Ability System is used to handle Spells, Talents, Skills, and Item Abilities in Dragon Age.

Detailed Description

Cost Type

Cost can be assigned on a per ability basis. For example, most spells drain mana (some drain health), skills drain nothing, talents drain stamina.

The cost of any particular use of an ability can be modified by scripting.

The main modifying factor for cost is fatigue, a stat present on every creature that is increased by armor (more armor = higher fatigue) and active upkeep abilities (the more simultaneous abilities are upkept, the higher the fatigue).

Type

Each ability may be one of the following types:

  • Passive: Simply having the ability grants certain persistent bonuses to the player. There is no need to 'use' the ability in any particular way, it's just there.
  • Upkeep: Gives a peristent benefit while the ability is "on". A caster can only have one of each ability active at a time (i.e., one Armor, one Bless, et cetera). These abilities can be turned off at any time. The cost is that the resource (stamina, health, or mana) for the ability is withheld from the player while the ability is maintained. So for example, a caster who is maintaining a spell with an upkeep of 30 mana has his maximum mana capacity reduced by 30 for as long as the spell is being maintained. When an upkeep spell is dismissed 25% of "deducted cost" is returned immediately, the rest needs to be replenished through standard restoration methods. Upkeep spells are only castable on partymembers, self, or full group. Monsters don't use the upkeep system (i.e., they don't pay upkeep for spells)
  • Damage: Damage is generally determined by a spells base damage, the caster's spellpower, the enemies rank and some other factors . There are several damage types, all of which have corresponding resistances.
  • Misc: A few abilities may do a combination of the above.

Targeting Behavior

An abilities targeting behavior is controlled by several settings in abi_base.xls

AutoTarget is a boolean field that defines how the UI resolves targeting.

0 The UI will always bring up a targeting cursor.
1 The UI will only produce a targeting cursor if no suitable target is currently selected. e.g if the player currently has a hostile creature targeted and if the spells TargetType includes 0x4 (hostile), the ability will trigger immediately, not producing a targeting cursor. Most single target spells and talents use this setting.

Regardless of AutoTarget setting, the UI will never produce a targeting cursor if an ability is type 0x1 (self) -


TargetType is a bit mask derived from the following table and controls the behavior of the UI's targeting cursor.

Bitmask Effect
0x1 Self
0x2 Friendly Creature
0x4 Hostile Creature
0x8 Placeable Object
0x10 Area of Effect Object (deprecated)
0x20 Ground (see details)
0x40 Dead Body (deprecated)
0x80 Party Member


AutoDraw is an integer boolean field that defines how a character's weapons are handled when the ability is triggered.

0 The ability will not affect the player's weapon sheath status.
1 The engine will force the player to draw/unsheathe his weapon before executing the ability. This is used for most bow and melee weapon abilities.
2 The engine will force the player to stow away any non staff melee weapons before executing the ability. This is used to ensure that no inappropriate animations play with weapons drawn (e.g. the player conjuring with a sword clipping through his body) and to discourage switching between melee and spellcasting on the fly.

Activating an Ability (casting)

When an ability is activated there will be different initial animations depending on its type. For example, spells will have casting animations. These animations will determine how long it takes for the ability to "fire". Talents and skills will have unique animations for many abilities and some stock animations that are shared between different abilities. Alternately, an ability does not need any activation animation; it can be instant. The actual speeds are dictated by the animation and hence a production concern.

The Spell Affinity System requires a scripting method to adjust which animation is being cast to affect the casting speed of the spell.

Ability Phases

A creature using an ability goes through 3 phases:

  • Conjure: The creature plays an activation ("conjure" or "power up") animation, usually accompanied by visual and audio effects specific to that ability.
    • Conjures are where a spell can be interrupted, for example by taking damage.
    • The spell can be interrupted by the player as well at this stage, for example if the player changes his mind about what he wants his character to do.
    • Conjures won't require a feedback interface like WoW -- with multiple casters casting spells at the same time this would not make sense. (i.e., you could not have multiple casting bars appearing)
    • Each spell will have a Speed entry. Adjusting this will change how long the conjure animation is looped.
      • A 2DA will contain a list of standard casting spells with floating points numbers matched to the speed categories (this is an ease of use feature).
      • Wands and Staffs will have custom conjures. All other weapons will be sheathed before the conjure begins.
  • Cast: The creature releases the ability, which either fires a projectile or plays a special animation. This would be set up on a spell by spell basis.
    • The Cast animations will be fast and will not "lock" the caster like in Neverwinter. We'll probably match our cast animations with our conjures (i.e., Offensive Spell Conjure + Offensive Spell Cast) for best visual results.
    • The cost for the spell is spent at the cast phase.
    • The spell cannot be interrupted at the cast phase (there's no point since the animation speed for a Cast should be less than a second).
  • Impact: The ability strikes its target (either when the projectile reaches its target or immediately after the cast if there is no projectile).

All abilities must have the potential for "cooldown", a period of time after use where the ability is unavailable. Cooldown duration can vary from ability to ability.

Interrupting an Ability

Abilities can be interrupted before they "fire" (i.e., during the conjure/activation phase). There are two types of interruptions:

  1. Combat System Interruption: There are three types of interruptions in combat. Special Ability (Level 1), Effects (Level 2) and Synchronized (Level 3). If two things occur at the same time, the higher level interrupt takes priority. So you can knockdown (Effect) someone entering a Barbarian Rage (Special Ability). Any of the interrupt abilities take precedence over basic attacks.
  2. Interrupting Spells: Interruption checks work similarly to resistance checks. Basically, the more damage done to a wizard the harder it is to cast the spell.

Impact

When an ability reaches its impact point it runs a custom script on the caster that will apply the payload and deduct any ability costs.

Gaining Abilities

Abilities can be added through the rule system (i.e., level up), through equipped item properties, and through scripting (i.e., a temporary ability is added to fulfill some plot purpose).

Visual Effects

Each ability can have a [projectile] as well as multiple Visual Effects associated with it.

Software Architecture (How it works)

Overview

Abilities of all types are assigned using specialized In-Place Editors accessable from the Object Inspector Editor used to edit creatures.

Detailed Design

  • All ability data is in the 2DA ABI_BASE.XLS. Each ability type (spell, talent, item, skill) has its own workbook page.
    • There is a targettype.xls that each ability will have that will specify what target (if any) that ability has.
    • There is an abilitytype.xls that each ability will have that groups them into use type groups. This will be used to control (through data) what abilities are modal according to what other ones. For instance there will be a 'combat mode' type and if you use an ability that is of this type then it will turn off all other abilities of this type as only one can be active at any time. For example stealth is another ability type, and perhaps you want all combat modes to be turned off while in stealth. Each ability type will be represented by a bit-flag ID. This does two things: it makes it very easy through data to link ability types (such as stealth shutting off multiple other types when activated), but it also limits the number of types to 32.
    • There is a usetype.xls that will tell what type the ability is. So far there are only 4 planned types, toggle (or "style" as it's called in the talent page), passive, activated, and use (most spells are of this type). NOTE: we might even want to split the use up into instant, cast, interruptible or channel, ... etc.

How to Use

There is a great deal more power in the ability system. Design has more control over the rule system through the ability system scripting. This section will detail how to work with the system.

Player_Core

Designers have scripting hooks to particular events that occur for the player.

  • OnIHit: This event fires whenever the player hits an opponent. On this event design deducts a Stamina Cost Per Hit, if the player is in a combat mode (such as Berkser).

Rules_Core

This include file handles many standard rules operations that are normally done in code (i.e., the draining of resources, such as Stamina and Mana).

This is a list of rules features that design is responsible for:

  • Resource deduction (on Conjure event of an ability script)
  • Resource Rules (kicking a person out of a particular combat mode -- such as Berserk -- if their stamina runs out). Also design handles giving back Mana when an upkeep spell is dismissed.
  • Ability impact on Cast event in an ability script.
  • Any item property effects that affect the rules of resource gain or ability use (i.e., Increase Mana Received when Upkeep spell is dismissed, or Increase Talent Difficulty)

Creature_Core

All creatures have this script on them. It uses Rules_Core.