Ability

From Dragon Age Toolset Wiki
Revision as of 16:22, 27 June 2009 by BryanDerksen (Talk | contribs) (ported over from extranet)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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. For example, the Spell Affinity System requires that the particular Affinity of a caster affects the cost of spells of that type (ie, casters with a high Spirit affinity can cast Spirit spells more cheaply).

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)
  • Modal: This is a variant of Upkeep and is used exclusively by Talents. It is almost identical to Upkeep except that each "attack" made while the modal ability is active deducts Stamina (instead of withholding a chunk of resource like a standard Upkeep ability).
  • Damage: Damage is determined by adding the spell's base damage to an attribute bonus (Magic or Intelligence). There are several damage types, all of which have corresponding resistances.
  • Duration: These negative spells inflict a persistent negative effect on a target. Each duration spell has a Power Rating. If the Power Rating of the spell is greater than the target's resistance, the target suffers the Primary Effect. If it is less than or equal, the target suffers the Secondary Effect.
  • Misc: A few abilities may do a combination of the above.

Target Type

Each ability may also be delivered to different sorts of target groups:

  1. Self: The ability triggers some effect on the caster only.
  2. Target: Caster applies the ability to another target.
  3. Area of Effect: Ability affects all targets. A visual indicator shows the caster what the area of effect will be.
  4. Self, Area of Effect: as Area of effect except the radius of effect emanates from the caster.

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.