| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Controlling Creature Animation

Page history last edited by Kert 7 years, 3 months ago Saved with comment

The Adding Artwork tutorial teaches how to add the graphics for a creature into the game. These consist of a bunch of frames. However, to package the frames into animations, and control how they are displayed, you'll need to configure a monster frame info (FRM.BIN) file.

 

FRM.BIN files contain a bunch of fields. The H2FRMPack and H2FRMUnpack utilities included in the Ironfist tools ( IronfistTools.zip ) folder make it easy to convert between FRM.BIN files and human-readable .ini files -- you simply drag-and-drop the file to convert onto the executable. They also come with several examples for you to use as starting points. The rest of this tutorial will describe the various fields in the .ini files.

 

The Basic Format

 

All lines of interest in the .ini files look like the following:

 

main-move-animation=2,3,4,5,6,7,8

 

First, there is a field name.  Following that is an "=". Finally, we have a comma-separated list of values, each either an integer or a decimal. Each field expects either integers or decimals, and demands a maximum number of items (usually 1).  Any values you do not provide are set to 0. The integers also have a maximum size depending on whether it will be stored in 1, 2, or 4 bytes, but this should never be an issue.

 

There are 91 valid field names, of which 68 are used for specifying the 34 different types of creature animations. Each animation has two associated fields. The first is the length, the number of frames in the animation. The second is a list of at most 16 integers specifying the frames of that animation, referring to the indices of the icons in the creature's corresponding sprite archive.

 

Only a fraction of the fields are necessary, and a handful do nothing. We now describe the function of all the fields, grouped into several categories.

 

Movement Speed Fields

 

step-time
flight-speed

 

step-time specifies the time, in miliseconds, that walking creatures should play its movement animation before moving to the next hex at normal combat speed. flight-time is the speed a flying creature will move at normal combat speed, in pixels per second. Note that, if you cast slow on a flyer, it will walk.

 

Fidget Fields

num-fidgets
fidget-probabilities
max-fidget-delay
fidget-1-animation-length
fidget-2-animation-length
fidget-3-animation-length
fidget-4-animation-length
fidget-5-animation-length
fidget-1-animation
fidget-2-animation
fidget-3-animation
fidget-4-animation
fidget-5-animation

From time to time, creatures on the battlefield will fidget. Dragons will breathe out a puff of smoke, the centaur will swish its tail, the archer will look to the side. Without these, the battlefield will look like a still image; with them, it looks alive.

 

Creatures can have up to 5 fidget behavior; set the number with num-fidgets. At normal combat speed, a creature will fidget at most max-fidget-delay miliseconds after completing its last fidget. fidget-probabilities takes a list of up to five decimals specifying the probability of a creature choosing each fidget. The various fidget-animation-length and fidget-animation fields specify the fidget animations themselves.

 

For some fun, try setting the max-fidget-delay to 0 to make a creature look like it has ADHD.

 

Shooter Fields

 

num-missile-directions
projectile-dir-angle
shooting-time
shoot-up-projectile-offset
shoot-forward-projectile-offset
shoot-down-projectile-offset
ranged-attack-up-animation-length
ranged-attack-up-return-animation-length
ranged-attack-forward-animation-length
ranged-attack-forward-return-animation-length
ranged-attack-down-animation-length
ranged-attack-down-return-animation-length
ranged-attack-up-animation
ranged-attack-up-return-animation
ranged-attack-forward-animation
ranged-attack-forward-return-animation
ranged-attack-down-animation
ranged-attack-down-return-animation

 

A shooter's projectile will usually have several images depending on which angle it's fired at. You can set this quantity (up to 12) in num-missile-directions, and then give a list of that many angles (in degrees) in projectile-dir-angle. When a projectile is fired, the game will calculate its angle, find the closest angle in that list, and then use the corresponding missile image. Note that you should only give angles in between -90 and 90 degrees; the game will mirror the graphics when firing in the other direction.

 

Not to be confused with the projectile direction is the shooter's direction. Every attack, both melee and ranged, has animations for attacking upwards, forwards, and downwards. The various ranged-attack-animation fields control this. First, the game will play the relevant ranged-attack animation over a period of shooting-time miliseconds (adjusted for combat speed). Then the projectile will fire, and the corresponding ranged-attack-return animation will play. The projectile-offset fields take a pair of integers, specifying the x/y offset relative to the creature where the projectile will first appear.

 

Miscellaneous Positioning

stack-number-display-facing-right-xoff
stack-number-display-facing-left-xoff
blind-offset

blind-offset takes an x/y pair specifying where to play the animation for the Blind spell relative to the creature -- namely, it gives the location of the creature's eyes when standing.  The two stack-number-display-xoff fields control where to place the counter giving the number of creatures in a stack.

 

Melee Attack Animations

 

melee-attack-up-animation-length
melee-attack-up-return-animation-length
melee-attack-up-2hex-animation-length
melee-attack-up-2hex-return-animation-length
melee-attack-forward-animation-length
melee-attack-forward-return-animation-length
melee-attack-forward-2hex-animation-length
melee-attack-forward-2hex-return-animation-length
melee-attack-down-animation-length
melee-attack-down-return-animation-length
melee-attack-down-2hex-animation-length
melee-attack-down-2hex-return-animation-length
melee-attack-up-animation
melee-attack-up-return-animation
melee-attack-up-2hex-animation
melee-attack-up-2hex-return-animation
melee-attack-forward-animation
melee-attack-forward-return-animation
melee-attack-forward-2hex-animation
melee-attack-forward-2hex-return-animation
melee-attack-down-animation
melee-attack-down-return-animation
melee-attack-down-2hex-animation
melee-attack-down-2hex-return-animation

When a creature attacks, it will play the melee-attack animation corresponding to the direction of its attack, followed by the corresponding melee-attack-return animation. Creatures with a two-hex attack (namely, the dragons, phoenix, and cyclops) need a second version of each animation to show them attacking both creatures.

 

Standing Animation

 

standing-animation-length
standing-animation

 

Virtually always a single, still frame, the standing animation plays when a creature is standing and doing nothing.

 

Damage-Taken Animations

 

 

dying-animation-length
wince-animation-length
wince-return-animation-length
dying-animation
wince-animation
wince-return-animation

 

When a creature takes damage, if it dies, it plays the dying animation. Else, it plays the wince animation, followed by the wince-return.

 

Movement Animations

 

start-move-animation-length
sub-start-move-animation-length
main-move-animation-length
sub-end-move-animation-length
end-move-animation-length
full-move-animation-length
move-animation-length
start-move-animation
sub-start-move-animation
main-move-animation
sub-end-move-animation
end-move-animation
full-move-animation
move-animation

 

Creature movement in Heroes II is somewhat complicated. Although there are fields to specify a "move-animation," you will normally leave that blank. Instead, you specify various pieces of the movement animation. For walkers, the game will piece them together for every hex. Flyers use the same fields slightly differently.

 

The full-move-animation field animates walkers moving one hex.

 

For walkers, moving more than one hex, for each hex, the following happens. First, either the start-move or sub-start-move animations play -- start-move if this is the first hex of the movement, otherwise sub-start-move. Then, the main-move animation plays. Finally, either the end-move or sub-end-move animations play -- end move for the last hex, otherwise sub-end-move.

 

Note that any of these pieces except for main-move and full-move can be, and very frequently are, empty. In fact, almost no creatures have a sub-start or sub-end animation.

 

Things for flyers are simpler. First, the start-move animation plays, showing the creature taking off. Then, the main-move animation plays repeatedly, with the game smoothly moving the creature to its destination. Finally, the end-move animation plays, showing the creature landing (often the take-off animation in reverse).

 

Info Fields

move-anim-info is used in the window that shows detailed creature information. The values are used to keep the creature at the same position  The values are corresponding offsets for the main-move-animation frames.

 

Ignored Fields

first-byte
start-move-anim-info
sub-start-anim-info
sub-end-move-anim-info
end-move-anim-info
full-move-anim-info
walk-anim-info
fidget-info 

 

The first-byte is 1 in all examples, while the other fields appear to contain interesting information. Perhaps these served a useful purpose at one point, but as far as we can tell by decompiling the game and modifying these values, these fields all do nothing.

 

Comments (0)

You don't have permission to comment on this page.