Custom animations with Kinect, from start to finish

This tutorial will tell you how to create custom animations for HL2 (and EP1, not EP2) Machinima (specifically Garrys Mod) with the help of the Kinect.
This has been one of the longest tutorials I’ve ever made, and apart from a few stupid mistakes on my end I’m quite proud of it ūüėõ
There are a lot of requirements and it will take lots of time before you are having your animation up and going for the first time. For this tutorial I used bits of other tutorials: Modifying and Recompiling Source Models from Noesis and Custom Props and Animation with Softimage, from Design 3. The tutorial was supposed to let you record animations and edit them, but due to a stupid mistake of me the data was lost and re-doing was going to take a couple of months. So in this tutorial I assume the BHV recording you make will be perfect ūüėČ

Index:

  1. Requirements
  2. Model Extraction
  3. Model Decompiling
  4. Model Importing in XSI
  5. Model Correction
  6. Weight mapping, Rigging & Tagging
  7. Creating BHV data < Kinect part = fun
  8. Animating with the BHV data <This is not in the tutorial, since this part is so diverse and freakin’ difficult ūüėČ
  9. Exporting from XSI
  10. Using the custom animations

Requirements:

  • Kinect, hooked up to your PC, the XBOX version, not the PC version.
  • Brekel Kinect (Use auto installer to install all Kinect drivers etc. otherwise Kinect won’t work) LINK
  • FAAST LINK
  • GCFScape LINK
  • HL2 games and SDK
  • MDL Decompiler¬† (place in steamapps\\sourcesdk\bin\ep1\bin) LINK (its the .exe in the root of this zip, there are also some helpful files in them)
  • STUDIOMDL compiler (part of SDK)
  • VTEX compiler (part of SDK)
  • VTFEdit LINK
  • XSI mod tool LINK (and make sure you install the Valve addon)
  • XVI32 Hex editor LINK
  • Model WeightMap LINK

Model Extraction:

Open GCFScape and with that open steamapps\source models.gcf, look for your model you want to animate and drag and drop the 7 files with the modelname into an empty folder. Then open steamapps\source materials.gcf and put the following files with the ones you extracted: Dark_eyeball_l.vmt to pupil_r.vtf Then put some other files with them: citizen_sheet.vmt / vtf and one of the 2 facemap pairs. I used Ted’s. These might be difficult to find, use the search function.

Model Decompiling:

Make sure Steam is running, open the MDL decompiler and point it to the mdl file of the model you put in that empty folder. Then choose another output folder (preferably a subfolder in the folder you extracted the original models in) and click Extract, you should get a message that the model has loaded correctly. Click Ok, then wait for it to decompile. Then you get another message that the work is done! Close the decompiler and open VTFEdit, go to Tools> Convert Folder, choose the folder with the .vmt files you extracted with GCFScape, for output choose a new folder. Make sure to tga is selected and that in the box behind it stands this: *.vtf Just leave all the other settings as they are and click convert. Now in that output folder you should see 12 .tga files. (Optional: In order to see without a TGA editor what’s inside the TGA (texture) files, do exactly the same conversion but instead of tga select bmp as output).

The folder structure I have uptill now:

GCFFiles > Male_02 (extracted files with GCFScape)
GCFFiles > Output_decompiled (decompiled model files)
GCFFiles > Textures_Decompiled (decompiled with VTFEdit)

Model Importing in XSI

Open XSI (this might take a couple of minutes…)

Go to the ValveSource menu > Import SMD,¬† in the import file bar choose the _reference.smd file and as output folder select Textures_Decompiled. Now you should see a wireframe appear in the various screens. In the right corner right of the word “Wireframe” is a button, click it and the panel (called Camera) will maximize. Now click on the Wireframe option and choose Textured Decal. If your model looks like the first image, go to the Error part, if it looks like the second go to the next chapter (Model Correction) When you press S you can zoom in and out and move the camera with the mouse. Experiment with it.

Error
If your model looks like the first picture here’s how you fix it: Go to View > Rendering/Texturing > Material Manager . Open one of the textures on the left of the screen by double clicking on them. Somewhere in the middle, below the General tab is the path to the tga file. It should be in red, click on the three dots next of it and select the correct file again. Do this with all the files and the model should look like the second picture.

Model Correction
The model¬† looks OK but has lots of small errors and artifacts left over from decompiling (it isn’t perfect science) so we have to remove them. Open the explorer (either by pressing 8 or by clicking on Scene on the right part of the screen) Now select Mesh > Polygon Mesh > Clusters > EnvelopWeightCls and press delete. This is a duplicate weight map that might cause problems later. Now rename the Mesh folder to something else, a name preferably. Then click on the button Cut (under constrain on the right). Now click on ValveBiped (with middle mouse button if the next thing doesn’t work) and press delete. Now go back to Shaded mode. Go to the explorer, to Clusters and select mouth, now press H to hide that part to prevent us from screwing up the mouth. Now under Select on the right choose Edge and in the dropdown below choose Border Edge and press Ctrl + A. Now Click on the word Select > Tools > Raycast.¬† Now zoom in on the neck and while holding Ctrl click on all the neck edges (but not the collar!) so in the end the selection ends up like this:

Now while still having these selected go to Poly. Mesh and select Weld Boundary Edges/Points and in there select All Edges. Close this screen, deselect (Select > Object, ESC key or click outside boundary) your model and go back to shaded, now select the model again and all the edges (apart from the neck) are gone. Switch back to wireframe. Now go to Select and the Raycast tool, Edge selection and Border Edge filter like before. Now this is a tricky part, select a few of the edges you want to have welded together (not all of them!) You’d have to guess what looks the most natural (the three on the bottom for example). Now go again to the Weld Boundary Points/Edges option and the system should have welded the model so a smooth line has formed! ūüėÄ If some of them don’t snap automatically increase the Distance slider in the menu. To quickly get the menu use the middle mouse button on Poly. Mesh (this opens the option last used with that dropdown menu) Switch back to Textured Decal a copule of times to see if the weld’s look ok and that you’re not screwing up. Now the model has no double edges and can be animated without having the chance of seeing holes in the model.

Weight Mapping, Rigging & Tagging

On the top left where it says “Model” click on the dropdown and choose Animate. Open the Scene menu again (press 8) and go to the mouth Cluster again, and press H to unhide. Now select the model, go to ValveSource > Character Rigs > Biped Guide. Now open the Scene menu and middle click on ValveGuide. Go to Wireframe mode and you’ll see some sort of skeletal structure! Now go to ValveSource >Character Rigs > Rig from Guide. The process takes a while and small windows will flash open and stuff will happen to your model. If you get an “Unexpected error” delete the ValveBiped in the Scene window (8…) and go to Character Rigs > Male Rig and it should produce the same result only faster. The rig from guide option is more precise since some models require you to move the Biped Guide elements around. But with humans (HL2 humans to be precise) this option is the fastest. Now open the Scene window > ValveBiped and select everything from Bip01 to UpperBodyParent. On the left go to Store > Transformations – Current Values, and click ok in the window that opens. If you screw up with animations you can revert to this default pose the model is having atm.
Now on to Weight Mapping. This process is to prevent bodyparts to start moving in weird ways if you move, say an arm. In the middle window, on the top left you see a small eye with an arrow beneath it, click on it and select Weight Maps. Then go from Wireframe (or whatever you have) to Hidden Line Removal and you should see a strange disco kinda thing appear over the model:

If you click on one of the arm bulbs (near the hands) and start moving them around (remember to go into default position with Ctrl + z) you’ll see what I mean with bodyparts behaving weird, humans don’t move this way (I hope ūüėČ )
Now select the model, go to ValveSource > Import WeightMap and select the .xsiwm file you downloaded from the requirement list above (to make it easy to find place it with the model files). Wait a while and the model should get a slightly different disco suit:

Now we are done with all the modelling stuff! It is ready to be animated!
Extra: You can of course fiddle around with the textures with a tga editor and create your own model based on the Citizen! To get it back in the game a QC file is needed. Which will be explained in the Export chapter later on.

Tagging the rig:
We have to do a couple of things in order to let the model move. First we have to tag the rig, to tell XSI which bone is what bodypart. Then we load in a BHV in the next chapter and we have to tag that one as well in order for XSI to create a link between the BVH file skeleton and the tagged rig (tagged hand on the rig  gets linked to the movements from the hand node from the BHV skeleton). It sounds more difficult than it is. First open the explorer (8) and hide the model. Now with the middle mouse button click on ValveBiped, now, on the left click on MOTOR > Tag Rig. In the screen that opens you have to tag these bones by clicking on the name and then on the corresponding bone or control-node of the rig. Try to (or retype it to) get it as these pictures:

Save this to a file (Save option) for future reference, saves a lot of time ūüėČ Now the tagging of the rig is completed and we are ready to create the BHV file!

Kinect:
First of all we’re gona have some fun, the Kinect is made to be played with ūüėČ When you go to the brekel site download and install the auto driver installer and then Brekel 0.49 (I don’t recommend 0.5 since the motor/LED driver is having a bit of a problem there) Then you should be able to run programs like NiViewer which is included with the driver installer. Open brekel, we’re not going to work with it but open the Help menu and read trough the topics there, if the motor/LED does not work (slider on the right of the screen) then use the HELP page from Brekel which tells you how to enable those two. Also those help files explain a bit how the program works. Now that the Kinect is up and running close Brekel and download FAAST and extract it somewhere. FAAST lets you link keyboard and mouse commands to movements. Their project page (here) has a list (scroll down to Input Emulator Usage) of all the commands you can use. For example here is the cfg file which I use for minecraft: HERE With FAAST you can play games on ur PC with Kinect ūüėÄ
Now back to business. Open Brekel Kinect. Now in the BHV Capture pane select Poser & TrueBones, if you want Write Positions that shouldn’t give any problems and in general they’re a little more precise. Now select a delay and step in the view of the Kinect, and a skeleton will appear on your body! Now press Start Capture BHV and wait for the delay to end by standing in a T pose with your arms. Now act your scene, make sure you don’t move too fast or get bodyparts behind other bodyparts. Then (do it yourself or let someone else(preferred!)) stop the capture.

Basic BHV into XSI!
Now open up XSI again (and our scene of course) and go to MOTOR > Mocap to Rig. In step 1 choose BHV, in 2 find the BHV file you just made with Brekel Kinect, in Step 3 choose Create and another skeleton will appear + another tagging screen. Tag them according to this:

Now save this to a file as well. Now in step 4 enter ValveBiped and finally hit Apply! Now press Shift + H and our model should appear again. On¬† the bottom are 2 bars with 2 number inputs next to them. I still don’t know what they are used for but¬† in the top one enter 500 and then press Enter key.¬† Now press Home and then in the bottom of the screen press the button with a ‘>’ on it and BAAAM our model should do exactly as you did in front of the Kinect! ūüėÄ If it still doesn’t play entirely increase (or decrease) the number you just entered. If you had to stop the capture in Brekel yourself a good way to stop the model form freaking out is to slide the red bar on the bottom, and set an ending point by looking at the frame number it displays. Now enter that number where you just typed 500.

Animating:

This part is too difficult to add to this tutorial, fact is I’m still struggling with it myself! For the sake of this tutorial (otherwise it will never be published :P) we assume that what you recorded in Brekel Kinect is perfect. Of curse that is impossible but still…

Exporting from XSI:

This is very easy, make a new folder (in my case in the GCFFiles) and copy its path. In XSI, in the top menu bar go to ValveSource > Export SMD, in file paste the path and then”\<Modelname>.smd” . Make sure that file type is SMD and leave all the 3 boxes checked. Now click OK. Model exported! ūüėÄ Now, there are Level of Detail models, to render approximations of the model when looked at from a great distance. Concidering we are using this for film making we won’t need them.
Now go to the EP2 source folder form sourcesdk_content\hl2mp\modelsrc\humans_sdk or something similar. And copy:

  • Bodyrules_xsi.qci
  • commonbones.qci
  • hitbox.qci
  • lowesthumanohelpers.qci
  • lowesthumanskeleton.qci
  • ragdoll.qci
  • male.vrd
  • ragdoll.smd
  • ragdoll_pose.smd
  • removehands.qci
  • skeletonanimation.smd
  • standardflex_xsi.qci
  • standardhierarcy.qci
  • standardikchains.qci

Basically everything form humans_sdk and the Male folder in there(not the subfolder in there!). The more the better so I dont have the chance that I forgot one. Dump all these files with the SMD file you created. The example QC file you can find here: http://pastebin.com/4itpPLqt Just save the text as a QC file with the SMD. This default file was created by Noesis Interactive. Now close XSI, start Steam, open the folder you have the TGA files in. And with the help from the QC file delete all (including bmp) unwanted files. Now using https://developer.valvesoftware.com/wiki/Vtex as help compile these 8 TGA files. The folder hierarchy you have this far might change so read it trough. After you followed that site you should get something like Input file:….. Output directory:…. No config file for…. Hit a key to continue from each compilation. Now you should go to the output directory, and in another window go to the GCFFiles¬† folder. Copy the 8 needed VMT files in the CGFFiles, to the folder with all the VTF files. Now open, one by one, each vmt file and change in $basetexture the following: “models/Humans/Male/pupil_r” becomes “kevin/pupil_r”. Do the same method for the other 7 files. Note that $iris should undergo the same procedure. It might work without this change but you won’t get any custom textures, I haven’t tested it.
Now we’ll go compile the model. Open Source SDK, Engine Orange Box, game HL2 EP2 or one of those. Open a command prompt, and drag and drop either the shortcut or the exe itself from the StudioMDL compiler found in the same folder as the VTEX program. then, in CMD, make a space and then drag and drop the QC file into it. Hit enter. The model should compile! In the end you should see “Completed Kevin.qc” or something like that. Close CMD. The model should be placed into the models folder of the game you compiled with (see the VTEX link) Now you should be able to load it into Faceposer! Problem is that it has alien eyes… Open the QC file again, and under eye data, replace 0.63 with 1.34. Now open the pupil TGA files and, somehow (the tutorial I got suggests GIMP), make them instead of 64*64, 128*128. The canvas size, not the texture. Then recompile them with VTEX. Now in faceposer the alien should be gone ūüėČ The include command from the QC file lets you use other animations from other models. Inheritance so to speak. This can give quite funny results. Kleiner having alyx’ moves ūüėÄ

Using the animation in Choreography:

Now you should be able to use the model and animate it via choreography and via my other tutorials getting it into Gmod! ūüėÄ

Multiple actors

The valve wiki is a little weird on this, here’s how I create an animation with multiple actors in Garry’s Mod:

Step 1:
Load all the models you want, they will show up in tabs on the bottom right of the screen.

Step 2:
Create a new choreography, and make all the actors you want, when adding channels, pay attention to the screen, make sure the “add to actor:” has the right actor name!

Step 3:
Right click on one of the model tabs and choose: “Associate actor to <modelname>” and in the menu that follows pick the actor you want to associate.

Step 4:
Now to get all the actors in the 3D view. Right click on a model tab, and choose “Show <modelname> in 3D view” you have to replace them a little so everyone is nicely visible and not on top of each-other.
You can replace them by holding shift and the left mouse button, right-click and moving your mouse down moves the model backwards.

Step 5:
Animate all of them¬† ūüėČ

Step 6:
When saving you might get a message that the file is read only, and if you want to make it writable, choose yes.

Step 7:
Now to get the animation to gmod: cut the .vcd file out of \steamapps\<username>\half-life 2\hl2\scenes
And place it in: \steamapps\<username>\garrysmod\garrysmod\scenes

Step 8:
Now fire up Garry’s Mod, set up your scene, spawn the actors, look at them and type in the console “ent_setname” followed by the actorname you filled in in faceposer.
Repeat this for all actors.

Step 9:
Now to start the whole bunch type “ent_fire <actorname> setexpressionoverride scenes/<yourscene>.vcd”
Don’t do it for all actors, just pick one and the other’s will play their part automatically.
To make them stop animating type in a non existing scenefile in the code above.

Step 10:
Win

So that’s how I do it, not sure if there are multiple ways, but this works ūüėÄ

Also I’m working on one of the trailers a.t.m. but thanks to a corrupted file I had to start all over again. It took me a few hours but yesterday I got back where I started, and further. ūüėČ

Machinima conclusion

Making a machinima is much harder than it seems. I spent a total of 200 hours (= little more than 8 days if you work 24/7 without pause) working on it.  And that doesn’t include research in the summer vacation and tests! I’m very pleased with the result (despite the audio being messed up by the encoder) and I’m sure I’ll make more. The biggest problem was the deadline, making something as nice and as good as possible in a short amount of time is just not possible. If there wasn’t a deadline it would have become much better. Take Ross Scot (Civil Protection) for example, he spent more than a year working on something that is only 10 minutes! The quality difference is absolutely there.

Of course, since I’m a beginner, there’s always room for improvement, such as better video quality, the video shows a great deal of lag in certain shots (because the map is so big the GPU can’t handle it) Also the characters can be made more ‘alive’ (more humane movements instead of upper body movements only) but I couldn’t do that in this time frame.

This is the last post made about The Q-Bet, all newer posts will have other subjects which are not part of the PWS (if you don’t know what that means don’t bother ūüėČ )

And last but not least a little tutorial about writing a story (this will be the first tutorial on the tutorial page):

There are ideas enough which can be used, the question you need to ask yourself is, is this feasible? Many ideas can’t be done due to lack of resources. Once you think your idea is realizable the next step comes into view, the character design. In my place this ment looking for models which suit the character in your idea. Once that is done the actual writing begins. Every story has an introduction, middle part and ending. Most machinima’s have this as well. Characters and basic environment need to be introduced in the introduction (of course) then the main part goes into the middle part and the ending must be closed (so the viewer isn’t sitting and thinking WTF… why did they stop in the middle of something? etc.) I tried to avoid it in part 2 but still the ending goes very quick. Try to avoid having the ending shorter than 7 scenes. Ok, once your writing is done you need to find voice actors which suit your character. I know mine has got voices which don’t really fit but under the circumstances I’m quite happy I found them so quickly. After your done writing its lip synchronizing, animating, filming, editing and publishing. I hope that the tutorial’s I made, the software I wrote and the links I gave provide you with enough information to make your own machinima!

Here we go again! Part 2 released!

Ok part 2 is up and running on YouTube! Unfortunately the encoder messed up the audio again + YouTube’s own encoding software made it even worse. So as usual subtitles have been added apart from the hard subbed (baked into the movie) ones.

Also the encoder (mine and You Tube’s) cut off a small section of the upper and lower part of the video, there’s no way I can fix that. Some of the credit’s have disappeared due to this, I fixed that as good as possible by placing the missing parts in textbaloons.

The development of this machinima has practically come to an end but the site won’t be shut down! Other projects (including more machinima ūüėÄ ) will be posted here, as a new home for SciFi Heiloo, our (old) forum hasn’t been used or visited in months.

EDIT: In the following post I fixed a few of the bugs in the YouTube version.

Random bits tutorial:

The Q model used in the machinima wasnt originally an NPC, it was a ragdoll model. I copied its model files, looked up one of the NPC’s from *this* package installed.

It’s quite easy, in the package (once installed) in the folder\lua\autorun you open the lua file with notepad.

You copy the ragdoll’s model file to the \models\startrek folder in the package.

Then in the lua file, change one of the NPC’s code:

local NPC = { ¬†¬†¬† Name = “TNGF01”,
Class = “npc_citizen”,
Model = “models/startrek/fstDS9_01.mdl”, //change this to the ragdoll’s mdl file!
Health = “100”,
KeyValues = { citizentype = 4 }, /* this part applies to citizens, these are the keyvalues of the citizen to let
the AI know what type of character it is. (1 = citizen; 2 = DownTrodden; 3 = Rebel; 4 = Medic)*/
Category = Category    }

list.Set( “NPC”, “npc_TNG01”, NPC )

Now save the lua file. Open Gmod and spawn NPC TNGF01. Now it has the ragdoll’s model!

NOTE: This won’t always work! For optimal results you need to create your own model (which is not described in this machinima project, maybe in upcoming)

Console commands

As some of you know the source engine has a developer console in which we can do some nice stuff. But console commands for machinima? Some YouTube video’s try to cover a part of it. But I’m going to explain 80%(or more?!) of them.

First of all if you want to get the developer screen, in a game that runs with Source Engine, press `. If that doesn’t work, go to options, keyboard, advanced, and check ‘Enable developer console’.

This will be a list of console commands with some explanation.

  • ai_disable¬†¬† Disables the Artificial Intelligence of the NPC’s
  • ai_enable¬†¬†¬† The opposite of above
  • notarget¬†¬†¬†¬†¬† NPC’s won’t see you, use this again to disable it.
  • npc_select¬† Used to select NPC’s (you need to point at them).
  • npc_go_do_run 0/1¬† This command with value 0 or 1 specifies, when issued the go command, if the selected NPC’s will run(1) or walk(0)
  • npc_go¬†¬†¬† All selected NPC’s will try to move to where you are pointing
  • r_cleardecals¬†¬† removes all decals on the world (blood/bullet holes etc.)
  • r_drawviewmodel 0/1¬†¬†¬†¬† Specifies if your weapon is visible(1) or not (0)
  • physgun_drawbeams 0/1¬†¬† This is a command special for Garry’s Mod, set to 0 to make the physgun beams invisible.
  • ent_setname <NAME>¬†¬†¬†¬† Give a name to the item/NPC you are pointing at
  • ent_fire <NAME> <parameters> Let the thing do something, available options will show up in the auto completion screen.
  • ent_remove¬†¬†¬† This will remove the thing you are pointing at.
  • <NAME> can be !picker so you don’t have to specify a name for the thing you are pointing at.
  • find NAME ¬†¬† Gives a list of commands with the word NAME in it.

Of course there are a lot more console commands, used by the more experienced machinimators, for a quick look of what they are using I suggest you try this page.

10 days..

Ok 10 days left and the first part is only at 56%…. Gona make it to the deadline? First part yes, second part no. Gona make it after christmas vacation? 75% chance.

I’m currently busy with the 6th page (out of 9 in part 1 and of 16 in total). Filming of this page will commence tomorrow. I’m doing some homework right now (why don’t those teachers understand that I’m terribly busy ūüėČ ) but anyway.

Ok as for the tutorial part, here it comes:

After you read trough all the pages here and learned on how to do a proper animation, here’s how I did it and how I exported it into Gmod

First of all the SDK must use engine version 2006 and point at half-life 2 (and NOT HL2 DM!!!)

Put all the voices you want animated into \steam\steamapps\username\half-life 2\hl2\sound\YOURSUBMAP

Then, when you’ve added phonetics to all those sentences copy and paste them all in here:

\steam\steamapps\username\garrysmod\garrysmod\sound\YOURSUBMAP

When making a new animation always put them in \steam\steamapps\username\garrysmod\garrysmod\scenes

Then when making an animation choose (when using the wav file option) file name: sound/YOURSUBMAP/yourfilename.wav (don’t forget to add .wav!!!) This way the map structure is preserved and the animation doesn’t mess up.

Once you created the animation, save and close faceposer. And start up Garrys Mod.

Start up a single player level which loads very quickly (for example this one) then spawn an NPC, and open the console while pointing at him. Use the following code:

ent_setname ACTORNAME

Since you specified ACTORNAME at the beginning when you started a new animation in faceposer these 2 must of course be the same.

Then (you can stop looking at the NPC) enter the following code: ent_fire ACTORNAME setexpressionoverride scenes/YOURSCENENAME.vcd (dont forget to add .vcd!!!)

Now the NPC will play the animation you made in a continuous loop. Just record (with fraps for example) 1 or 2 of those loops and you can edit them with your video editing software.

To change the NPC’s animation into the standard use ent_fire ACTORNAME setexpressionoverride idle

This will give an error and that results in the NPC going into its default behaviour.

Animations(2)

Today I finished the animations (part 1) for Kleiner, Gman and Evil.

I have no idea when to expect the rest…. (*SIGH*)

Let me give you an example of how an animation file works:

// Comments will show up as this!
actor “Kleiner” //actor name
{
¬† channel “audio” //¬†audio channel
  {
¬†¬†¬† event speak “speech” //the event speech begins here
    {
      time 0.293333 2.708208 // begin and end time of the event
¬†¬†¬†¬†¬† param “st\kleiner\20 kill us.wav” //what file it has to play
¬†¬†¬†¬†¬† fixedlength¬†//the length is fixed, otherwise you’ll get messed up speech
¬†¬†¬†¬†¬† cctype “cc_master” //no idea¬†what this is ūüėĄ
¬†¬†¬†¬†¬† cctoken “” //Same here… lol
    }
  }
¬† channel “lookat” //look at¬†channel
  {
¬†¬†¬† event lookat¬†“lookat” //the event lookat¬†starts here
    {
      time 0.006667 3.266667 //begin and end time
¬†¬†¬†¬†¬† param “!player” //Parameter¬†!player means that¬†the¬†actor has to look at the player
    }
  }
¬† channel “animation” //the animation¬†channel
  {
¬†¬†¬† event gesture “glasses” //the event which¬†I¬†gave the name glasses
    {
      time 0.966667 3.266667 //begin and end time
¬†¬†¬†¬†¬† param “kgesture11” //the specific animation
      absolutetags playback_time //define certain points in the animation
      {
¬†¬†¬†¬†¬†¬†¬† “apex” 0.147059 //define the apex¬†time
¬†¬†¬†¬†¬†¬†¬† “accent” 0.338235 //define the accent time
¬†¬†¬†¬†¬†¬†¬† “loop” 0.411765 //define the loop time
¬†¬†¬†¬†¬†¬†¬† “end” 0.588235 //¬†define the ending time (actor goes to¬†begin position)
      }
      absolutetags shifted_time //if you have changed the tag position these will change
      {
¬†¬†¬†¬†¬†¬†¬† “apex” 0.147059
¬†¬†¬†¬†¬†¬†¬† “accent” 0.338235
¬†¬†¬†¬†¬†¬†¬† “loop” 0.411765
¬†¬†¬†¬†¬†¬†¬† “end” 0.588235
      }
    }
  }
¬† channel “face” //channel face
  {
¬†¬†¬† event flexanimation¬†“flex” //begin of¬†flexanimation with name flex
    {
      time 0.000000 3.266667 //total time
¬†¬†¬†¬†¬† param “” //parameters
      flexanimations samples_use_time //means that its going to define times
      {
¬†¬†¬†¬†¬†¬†¬† “head_rightleft” range 30.0 -30.0¬† //indicates what is moving and in¬†what range
        {
          1.6933 0.6600 //define the end time and begintime
        }
¬†¬†¬†¬†¬†¬†¬† “head_tilt” range 15.0 -15.0
        {
          1.6933 0.0000 //define the end and begintime
        }
¬†¬†¬†¬†¬†¬†¬† “head_forwardback” range 0.2 -0.2
        {
          1.6933 0.0000
        }
      }
    }
  }
}

scalesettings //these settings are used by faceposer(are ignored in-game)
{
¬† “CChoreoView” “100” //choreography¬†maker¬†scale
¬† “SceneRampTool” “100” //scene ramp tool¬†scale
¬† “RampTool” “100” //ramp tool¬†scale
¬† “ExpressionTool” “100” //expression tool¬†scale
¬† “GestureTool” “100” //gesture tool¬†scale
}
fps 60 //how many FPS to display in the 3D window
snap off //means that the snap option is off (no idea what use it has…)

Of course I’m not making text files all the time, I use Faceposer¬†to create the choreography and then, once I save it, faceposer¬†converts it to the code you see above. The game then loads it in once I give the NPC the command to play this animation. And based on the values the game engine extrapolates how the NPC should move.

To make an NPC do an animation you’ll need the console. First spawn an NPC, then while pointing at it type the following in the console ent_setname NAME¬† Now, still pointing at the NPC type ent_fire NAME setexpressionoverride scenes/NAMEOFYORSCENE.vcd Now the NPC plays the animation in a continuous loop, when filming you’d have to cut the right part out.