Ability

From Dragon Age Toolset Wiki
Revision as of 21:48, 26 October 2009 by Georg Zoeller (Talk | contribs)

Jump to: navigation, search

Note: This page is in process of being rewritten.

Overview

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

Detailed Description

Basic Ability Types

There are 3 basic ability types in the game, defined by the field 'use_type' in abi_base.xls.


Passive Abilities

Passive abilities (use_type = 3) grant persistent or conditionally persistent bonuses or penalties to the creature that has the ability.

A passive ability may grant up to 3 modifications to creature properties (properties.xls). Those modifications are defined in the passive_abilities worksheet of abi_base.xls and linked to the ability through the passive_id column in abi_base.xls.

Additionally, the bonuses of an ability can be made conditional on the character's current 'wield mode' (2-handed, dual, weapon & shield, or universal) through the conditional integer field on the passive_abilities worksheet.

Finally, a number of passive abilities do not define any property modifications in passive_abilites but instead have checks coded against their Ids (e.g. HasAbility(oCreature, ABILITY_TALENT_LETHALITY)) directly in the combat resolution scripts. The mere presence of the ability on a creature causes a different code path to be taken in the scripts in those cases.

Note that passive_ability benefits are not limited to abilities with use_type 3. Some active abilities also grant additional property modifying benefits to the owner.


Sustained Abilities

Sustained abilities (use_type = 2) are turned on and off per character and, while turned on, grant effects or property modifications to the user. Most 'buffs' are implemented this way.

Only members of the player's party are using sustained ability as the code overhead required to track them is too expensive to be used on monsters that only exist to die in an encounter with the player's party. (These creatures use duration based effects to emulate similar abilities instead).

Most sustained abilities follow the same pattern:

  • They do not have any activation cost, encouraging tactical use of buffs.
  • They increase the users Fatigue property, therefore increasing the activation cost of all other abilities.
  • They reduce the users maximum available mana or stamina by a constant value.
  • They use cooldown to prevent the user from being too opportunistic with their use.
  • Some abilities shut down when the user reaches 0 mana/stamina. Very powerful abilities (such as Momentum) have an associated stamina/mana drain effect to limit their use to a short or medium period of time. Creative item / buff use can be used to increase the length such an ability can be sustained.


Some sustained abilities (such as Flaming Weapons) are active 'party-wide' - the caster not only sustains the ability on himself but on all his party members as well. This is controlled by the 'bPartyWide' flag in abi_base.xls. Due to implementation limitations, party members who die or otherwise enter/exit the current party will not be affected by these abilities until they are recast. (we put low cooldown times on these abilities for that very reason).

Gameplay Design Note
  • Unlike in games like Baldur's Gate, the system in DA: Origins is designed to encourage tactical use of buffs over strategical. We wanted to put an emphasis on the player making smart choices during an encounter vs. the player guessing which buffs might be useful ahead of time or having to employ save-die-reload to find out.
  • It is generally wise to run only one or two buffs all around and activate additional buffs only when needed.


Activated Abilities

Activated abilities (use_type = 4) are abilities that instantly execute their effect (see Targeting Behavior below). Most melee talents or targeted spells fall in this category. There are several sub-types of activated abilies, such as

  • Targeted, single target spells and talents (such as Winter's Grasp or Flurry)
  • Ground targeted abilities (such as Blizzard or various Glyphs)
  • Self targeted activated abilities.


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.


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.