play stop
0:00
(1:21)
fullscreen
play stop
0:00
(1.21)
fullscreen

Frame Switching Technique for Soldier of Fortune 2

by ZOODUCK on 08 June 2012 at 19:53:23 GMT

To understand how the custom animation scenes for the in game video were made, you first need to understand how character movement *happens* in Soldier Of Fortune II.

Each *movement* or *idle* of a certain type has four properties:

In the Soldier Of Fortune MP Demo, the animation frame sequences are specified in the *average_sleeves_mp.frames* file, while the *average_sleeves_mp.cfg* file contains each character movement type and it's associated frame sequence. For example, when a character is running (forwards) holding weapon *MOD_M4_RIFLE*, the average_sleeves_mp.cfg (found in *skeletons* folder from the MP demo) shows:

targetFrameframeCountloopFrameframeSpeed
LEGS_RUN109512020
TORSO_IDLE_M485640020

This could normally be cross-referenced with the corresponding ".frames" file, except I could not find this in the MP Demo files. (The *.frames* file is referenced at the start of the *average_sleeves_mp.cfg* file: *// frames: s:\base\mp\skeletons\average_sleeves_mp.frames*).

However, I WAS able to find the *.frames* files for all characters in the Full Game version. They were located in the *skeletons* folder but had no corresponding *.cfg* files. Also, the targetFrame's were completely different to those specified in the *average_sleeves_mp.cfg*. Copying the *.frames* file into the MP Demo *skeletons* folder, renaming it to *average_sleeves_mp.frames* and trying to reference the frame sequences contained therein (with the *.cfg*) did not work.

Frame switching for the default characters in the MP Demo was therefore only possible by using any of the already assigned frame sequences in the *averages_sleeves_mp.cfg*.

So, if I wanted the character to look like they are crouch walking when the client uses the *run* command (by pressing *W* or *Up Arrow* on their keyboard) I would change the following entry (LEGS_RUN) in the *averages_sleeves_mp.cfg* from:

From...

targetFrameframeCountloopFrameframeSpeed
LEGS_WALK_CROUCH5120020
LEGS_RUN109512020

To...

targetFrameframeCountloopFrameframeSpeed
LEGS_WALK_CROUCH5120020
LEGS_RUN5120020

In the dance sequences from the anniversary video, you will notice the characters upper body, arms and head are constantly in a state of movement. I acheived this by switching the default animation for a character holding a knife to one of the more elaborate death animations. I then reduced the number of frames to an even number (to match the musical tempo) and set the *loopFrame* parameter to *0* (continual loop). The frame switch in the *average_sleeves_mp.cfg* file looked like this:

targetFrameframeCountloopFrameframeSpeed
BOTH_DEATH_SHOULDER_RIGHT_2215167-120
//TORSO_IDLE_KNIFE23630020
TORSO_IDLE_KNIFE215160020 //BOTH_DEATH_SHOULDER_RIGHT_2, reduced frames, loop = true

Female Characters

The MP Demo version of Soldier of Fortune 2 has NO female characters. To introduce female characters to the demo, I copied the *female_pants.frames* file from the Full Game, and renamed it using the *_mp* suffix convention. As there is no corresponding *.cfg* file in the Full Game *skeletons* folder (or anywhere else that I could find) I copied the *average_sleeves_mp.cfg* and renamed it to *female_pants_mp.cfg*, then replaced the targetFrames with appropriate animations from the *.frames* file. (This was not possible with the default characters, as the *average_sleeves_mp.cfg* references targetFrames from an inaccessable *.frames* file).

As the *targetFrames* in the *average_sleeves_mp.cfg* file bear no relation to the frame sequences in the *female_pants.frames* file, I had to manually set the animation sequences for all 86 of the programmed movements. However, the *female_pants.frames* file contained no animations for *LEGS_JUMP*, *LEGS_JUMP_BACK*, *TORSO_ATTACK_KNIFE*, *TORSO_RELOAD_M60* and about 16 other character actions which all had to be substituted with suitable (or comical) alternatives. For the jump movements, I decided to use *female01_tablesit01* and *shot_chest_lands_onback01* for example:

targetFrameframeCountloopFrameframeSpeed
LEGS_JUMP7884101020 //female01_tablesit01
LEGS_JUMP_BACK314845-120 //shot_chest_lands_on_back01

The references can be found in the *female_pants.frames* file, and look like this:

m:/_animation/xsi/female01/scripted/female01_tablesit01.xsi
{
	"startframe"	"7884"
	"duration"	"101"
	"fps"	"20"
	"averagevec"	"0.000 0.000 0.000"
}
m:/_animation/xsi/female01/damage/any/stand/normal/67plus/explosion/head/d9/000/000/shot_chest_lands_onback01.xsi
{
	"startframe"	"3143"
	"duration"	"50"
	"fps"	"20"
}

As you will notice, I have skipped the first 5 frames for the *shot_chest_lands_onback01* (as these are not consistent with a *jump back* movement) and reduced the frameCount parameter accordingly.

The 3D character/object viewing software *Modview* allows you to play back individual animations which it reads from the *.frames* file, making it easy to select the right animation sequences to use in the female character scenes from the anniversary video.

After selecting an appropriate animation, the frame sequence needs to be assigned to both *TORSO* and *LEGS* movements, as these are independant of each other in all but the death animations. The relevant TORSO and LEGS movements then need to be executed at the exact same moment, or the animation for the upper body and the legs will appear disjointed.

For the scene of the female character jumping backwards off the helipad, I used the *shot_gutbck_lndbck02* death sequence from the *.frames* file, and assigned it to the following character movements:

targetFrameframeCountloopFrameframeSpeed
LEGS_JUMP_BACK594535-120 //shot_gutbck_lndbck02
TORSO_IDLE_KNIFE594535-120 //shot_gutbck_lndbck02
TORSO_ATTACK_KNIFE31840020 //female01_normalstand_holdpistol01

The animation that I assigned to the *TORSO_ATTACK_KNIFE* movement is passive (no movement) so by using the knife on autofire, the character appears to do nothing. By releasing the mouse button (stop using the knife) at the exact same moment as jumping backwards, both *TORSO* and *LEGS* animations for *shot_gutbkc_lndback02* are executed at the same time, producing the desired effect of a single animated sequence for the whole character.