What is needed to define a skill or technique or attack that a creature in a video game can do? Basically, a skill is a sequence of animations and movement to apply to the character at some cost, together with the (visual, sound, etc.) effects to produce, as well as info about the damage and statuses to inflict, and the hitbox over which it applies.
As an educational example, let's break down a simple Area of Effect technique that causes an earthquake. Given the effect, we will call this technique Earthquake
. Let us say that the overall flow of the technique is as follows:
Breaking the flow down into a bit finer detail, which we must consider in developing the game, we could do:
SP
)That leaves out some of the specific values (damage, cost, times, ranges, how much movement is restricted, etc.), but we can use that as an illustration of the format I have come up with to describe techniques in my game. Here is Earthquake
as defined for the game (the move is defined in a YAML file)
Earthquake:
- Set: # For convenience, allow values to be given names to be used in other expressions, like the Cost.
SPD: 2s
COST: 50
- Using: # And to make specifying animation speed uniformly easier, also allow providing an alias for animations.
Anim: AoE@$SPD # This makes the animation "Anim" an alias for the Area of Effect (AoE) animation executed at speed SPD.
Act: Repeat[Stomp,20]@6s # This is a special animation "Repeat" which has as parameters the animation to be repeated, and the number of times to repeat it.
- Anim.Setup@0.25s: # Over the brief setup portion of the AoE effect, we don't do anything. Note we are forcing the Setup portion to take only 0.25 seconds.
- Anim.Launch@4s: # Over the long launch portion of the AoE, we "charge" the earthquake and extend its range.
Cost : $COST/T # We apply the cost over the duration of the segment (hence the /T).
FX: # The FX we apply, grouped by the location they are applied to
Ground:
- MarkerRing: # We add a MarkerRing FX to the ground
Scale: $RANGE # Scaling it to mark the range/radius of the attack
Until: [AttackButtonReleased] # Defines early termination conditions. Continues when any entry in the list is true, so here we charge until the button is released or the full 10 units is reached. ***
Set: # We must Set the RANGE value to be able to use it for the FX, as well as in future calculations.
RANGE: 10*n # n = normalized time in the segment, 0 to 1.
Interruptible: [Dodge,HeavyImpact] # What events can interrupt the move (user doges, or receiving a heavy impact) ***
Motion: # Changes to the character's allowed motion. ***
Horizontal: 0.25 # 1/4 normal horizontal motion
Jump: false # Disable jumping. It is a ground-based attack.
Fall: Fast # force fast-fall
- Blend[Anim.Recover,Act.Setup]@0.125s: # Here we blend between the end of the AoE animation and the start of the Stomping animation
Animation: # Additonal parameters for the animation. ***
Blending: Linear # We want linear blending.
FX:
Ground:
- Fade?FX=MarkerRing?Scale=$RANGE # Fade FX created based on the specified MarkerRing FX. Here using a URL-query-like format rather than expanding it as a map in YAML.
Interruptible: [False] # Not interruptible
Motion: Last # Shortcut to specify the same parameters as was used in the last segment.
- Act.Launch: # The repeated stomping between the initial setup and final recover stretch.
Damage: 100/T # Do the damage again distributed throughout the time of the attack.
Cost: 0 # No cost at this point (could be omitted).
Interruptible: [] # Not interruptible
Motion: Last # Same restrictions
Hitbox : # The hitbox for the attack
- Shape : Cylinder # A (centered) cylinder. Use Beam for a cylinder with center at one face.
Radius : RANGE # With the charged-to range
Height : 3 # And a 3m fixed height
At : Ground # Centered on the ground
Remove : false # Do not remove the attack after it hits another 'mon.
FX: # More FX
Ground: # At the ground we want
- PulseRing: # A pulsing ring marking the edge of the attack
Scale: RANGE
Speed: 5
- GroundRocks: # And lots of rocks flying around. Also put the sound in this effect since they go together.
Scale: RANGE
Camera: # For the camera we want screen shaking.
- Shake: # Maybe the CameraShake should be attached to a drawable, and if the drawable is visible the camera shakes. ***
- Act.Recover: # The final recover animation, going back to normal walk/run animations.
Interruptible: [Dodge, HeavyImpact]
Motion: Last # Same restrictions
FX:
Ground:
- MarkerRing
As you can see, the description I provided above maps fairly well to the file I provided here. Though to be fair, not all of the features are implemented in code yet (many of the unimplemented ones are marked with ***
in the comments in the above YAML). Those in particularly are likely to change some in the future, though the whole format is subject to change. But for now, at least, I think this nicely illustrates a fair number of the features of the format. Though there are a few things that didn't come up in the earthquake example.
Projectile attacks require spawning objects (Nodes in the game engine I am using) for the projectiles. This can be done by adding a spawn block to a segment, such as:
Spawn: # Being able to spawn nodes is needed so we can attach both a hitbox and an FX to them.
- Name: Projectile # The created node is refered to by the location Spawn:Projectile
At : Anim:SpawnPoint?rotate=p10x # The location it should be created at. Note the query attached to the location that allows specifying an additional transform to the location requested.
Every: 0.05 # How often we should spawn, in seconds.
Endures: True # Whether the spawned object endures beyond the end of this segment.
Moving these spawned nodes is handled by using a Motion FX (Velocity, Acceleration parameters).
Bonus effects like stat changes or status conditions are supported. In the Earthquake example, there were no bonuses to consider. But if we consider some fire technique with a 10% chance to burn the segment would have a Bonus block like:
Bonus:
Target: # Who receives the bonus. One of [Target, Self, Ally, Enemy, Others, All].
- Burn: 20% # List of the condition applied and the chance that it takes effect. Default chance is 100%, not 0% (omit it if it is 0%).