Download Media Create Donate Forums

2012/10/27

Powers, Hazards, Effects

We have evolved an interesting system for handling martial and magical powers in Flare. I want to talk about what's going on under the hood -- it's a major focus of the new code features for v0.18.

Powers cover a wide variety of events -- everything from melee attacks to magic missiles to drinking potions. Anything that can be slotted to the Action Bar is a power. But powers are just the definitions of what you can do; once you actually perform a power something new is created -- there are two instance types for powers called Hazards and Effects.

Hazards are usually attack powers manifest on the battlefield. They have a danger area (often a point and radius) that is collision-detected against potential targets. Hazards are classified by their movement type: fixed position, missiles, ground repeaters, etc. The "Shock" spell is a missile hazard that is dangerous until it collides with an enemy or a wall. The "Swing" melee attack is a fixed hazard that is dangerous for a single frame, in a small area where the hero is facing. Currently we sometimes use Hazards to display animations on the battlefield that aren't actually "hazardous".

Effects are powers that are attached to (and affecting) an entity on the battlefield. This power usage is a new to the Flare engine for v0.18. Self-cast buffs like Shield or Warcry are effects that attach to the hero. Attacks that cause debuffs to the target are now also handled via Effects -- the Freeze spell applies a Slow after-effect. Multiple versions of an effect type can be active at once, each with a distinct animation. Example (though we don't have these animations built in yet) -- you can be Immobilized by a Bear Trap that's visually attached to the hero, and also Immobilized by an Entangling Roots spell that's also visible on the ground. The power icon associated with each Effect is shown in the active buffs/debuffs HUD menu.

In summary: Powers are definitions of what can be done. Effects are power-instances attached to an Entity; they can be self-cast, or can be an after-effect of an attack Hazard. Hazards are power-instances that live on and collide with battlefield entities.

Because all these are different states of a basic Power, it's now much easier to expand powers to add new types or variations.