Title: The Complete Animations Guide for RTW Posted by: PatricianS Modding area: Units (animations, skeletons) Required programs: Note: not every program listed below is required for every step in this guide. I will list the programs for each step as well as this full list.
Notepad (or other text editor) - For example Notepad++
Vercingetorix's xidx packer/unpacker (included in the below download)
Summary: A Guide to help you through all steps of creating new animations including editing skeletons. Last Update: 21-12-2009
Introduction
Hello all! When I started working on unit animations, I found there is very little information about this topic. There were some tutorials, but I found them very difficult to read and often lacked screen-shots to give an impression on what your actually doing. Now with the discovery of how unit skeletons can be changed, I decided it was time to write a Complete Animations Guide. It's goal is to have one single place where you can find all you need to know about animations/skeletons explained in "normal" English and with lots of screen-shots.
I must confess that I don't know everything to the smallest detail either, so if you find that I did something wrong, then please say so, so it can be fixed.
This Guide is a Work In Progress (WIP), so I will try to keep it up-to-date when new comments are posted or maybe when new things are discovered. So I would like to invite everyone with some knowledge on the topic to help me complete this Guide and make animations just as common for mods to edit as unit models or skins.
I did write this Guide, but please don't forget all other people who did the really hard stuff of cracking animations/skeletons and wrote advanced tools which I use as basis in this Guide. Without them, this Guide wouldn't exist.
In this section of the Guide, all basic informations will be explained. You will need this informations in order to understand the full picture of the workings of animations in RTW, how they are linked to skeletons (and what animations/skeletons are) and how you can use them in-game.
Animations
Files: ...
Programs: ...
Skeletons
Files: ...
Programs: ...
Use in RTW
Files: Data\descr_model_battle.txt (DMB)
Programs: text editor
Last edited by Pat89; August 30, 2010 at 11:42 AM.
In this part of the Guide, you will get explained how you can create new animations, with or without having to overwrite existing ones.
Copying a skeleton (Part I)
Editing an animation
For this tutorial, I assume you understand the basic workings of 3ds Max and you should know how to start the .CAS importer/exporter and how to import a unit model with it. What I will explain in this tutorial is how to import/export animations.
Files: Data\models_unit\unit_barb_archer_400.CAS & Data\animations\data\animations\fs_foot_archer_belt_bag\fs_foot_archer\LID_61 Archer stand ready to aim FASTER.CAS
Programs: Autodesk 3ds Max & .CAS importer/exporter
Copying a skeleton (Part II)
The last few steps before the new animation/skeleton can be tested ingame
Now with all steps completed, it is almost time for you to test your new animation ingame. You still have to add your new skeleton to DMB. Do this like I explained in Post #2 and use the skeleton name you chose in Step 4 of the unpacking tutorial. In my example this was "fs_foot_archer_belt_bag".
Just assign this skeleton to any archer you like, like this:
In future I hope to be able to re-write the tutorial to a more basic level with examples and maybe even a tool.
Originally posted by Wlesmana
For a good part of the year or so, I have been working closely with Knight Errant, a programmer who wrote tools for M2TW modding, on cracking the ever elusive skeleton file of RTW.
First of all, let's review a bit about RTW's skeleton and animation system.
In data/animations folder, you get these files:
pack.dat
skeleton.dat
pack.idx
skeleton.idx
In these files, if you extract from them, you get the skeleton files such as fs_dagger, fs_archer, etc, and the animations (inside the data/animations folder in this folder) such as LIS 01 Stand Idle.cas. A brief explanation of what these are:
- Skeletons contains the location of bones, how many there are and entries on which animation to trigger during specific events such as attacking, dying, running, etc.
- Animation files, while also in the CAS format, is different than the CAS file for models. In this, the file only contains ROTATIONS of the bones. There is no data on the location of the bone or the animation of movement (except Scene Root).
To edit animations and skeletons, we must first extract them using Vercingetorix's XIDX tool. You will get all the skeletons (fs_swordsman, fs_archer, etc) and the animations (in the data folder). anim_list.txt is the list of animation CAS files to re-pack and list.txt is the list of skeletons to re-pack. Any changes made must be re-packed, otherwise they won't register since the game only reads the .dat and .idx files.
We can create a "new" skeleton by copying an existing skeleton (i.e. copy fs_swordsman into fs_backward_spear) then using Vercingetorix's XIDX tool, we can hack into it and replace certain lines. For instance, when hacking fs_swordsman, we can replace the line:
data/animations/LIS 18_03 Stabbing downwards
with
data/animations/LIJ 07 Javlin throw_FASTER.cas
This would replace the animation of stabbing with the animation of throwing the javelin. HOWEVER, the sound triggers will not change because we cannot alter that with Verc's XIDX. Replacing entries is about the limit of XIDX.
With that in mind, here are the basic problems with RTW animation and skeleton system:
1. You cannot add new bones, as in you cannot make a new skeleton type. Sure, you can export new bones on your model, or even export new animations with that new skeleton. But the game cannot recognize it because the skeleton file, the fs_whatever, will not accept the new bones. Case in point, fs_slinger_new, which has one extra bone. You cannot use the slinger's model on any other skeleton without first exporting it WITHOUT the extra bone, nor can you use the fs_slinger_new skeleton on any other model without first exporting the model WITH the extra bone. If you want to see this problem, try changing the skeleton type in DMB for slingers then see how they look in-game.
2. You cannot re-arrange bones. You're stuck with whatever skeletons already existed because in order to create "new" skeletons, you must copy from an existing fs_whatever. The animations also does not contain any positions of the bones, only their rotations (except for Scene Root). So far, with Vercingetorix's tool, you can only hack into the skeleton file and change animation entries.
3. You cannot add or remove sound triggers. Originally this is done via EVT files. But the skeleton does not care for this EVT files which contains the sound file's name and the time it is to be triggered. This is dilemmatic for my mod, where the wargs sound like horses because they use the same skeleton thus having the same sound triggers. You either use the horse sounds or none at all. The problem lies, again, in fs_whatever skeleton file.
4. You cannot mount riders on any other skeleton that does not already be designated as mounts. These are elephants, horses and camels (cavalry). You cannot put riders on dogs, pigs and humans even if you identify them as cavalry. For instance, my wargs use the skeleton of a horse but with new animations. My trolls are using human skeleton but listed as elephant, therefore the "crew" on this elephant is "missing", as in the game engine will not render them. This is because non-cavalry skeletons do not have a "mount bone", as I call it, a bone designated to be the mounting point. If you want to see this, just use the wardog entry in DMB and use it as a mount. The rider will be missing until the mount is killed, then the rider will pop into existence and start the death animation.
5. Incompletions of some skeletons. For instance, fs_archer cannot engage in melee (thus an archer DMB entry has 2 skeletons: fs_archer, fs_dagger) while fs_slinger_new could (the entry is fs_slinger_new, fs_slinger_new). But fs_slinger_new has no "battle reaction" animations. It's missing dodging, feigning and blocking. They just don't trigger and the soldier just stands there. You can't do anything since you can't add triggers, or even remove them.
Now, all of the problems stated above has been resolved, with a new tool written by Knight Errant. The tool is still in experimental stage and it requires a great deal of knowledge of the animations system and manual work to use it though. So I will try to share whatever knowledge and information I managed to extort from it.
NOTE: Keep in mind that this thread will focus on the skeleton editing and NOT on animations, packing or other parts of modding. Please do not clutter the thread with general questions about animating in MAX, modeling and those other stuff. There are already tutorial threads on those aspects of modding.
This the tool: RTWskeletonconverter
It requires you to have Python installed.
Put it in data/animation where you have all of the skeletons for easier use. This tool can do 2 things:
1. It will read, for instance, fs_dagger and create fs_dagger.txt. In other words, it converts the skeleton file into a text file which you can read and alter.
2. It can convert the text file back into skeleton file. For instance, you modified fs_dagger.txt and renamed it fs_twoknives.txt. The toll will convert it into fs_twoknives_modified. The "_modified" addition is done to keep it from overiding an existing skeleton by mistake.
Ok, now let's crack open fs_dagger and get fs_dagger.txt. If you open it up, you will see this:
Somewhat daunting, I know. And there's no manual for it too, unlike many text files you can modify in RTW. There are only numbers, which we must try to interpret and explore what they do.
This is what I have found out about what they mean or might mean:
A. This is the size of the model. Verc's XIDX can resize a model by multiplying this number and E with the new size. You can use that for easiest resizing, or you can edit this number and the coordinates to get a resize.
B. This is the number of bones in the model, excluding Scene Root, which technically isn't a bone.
C. Now this, is still elusize. I have no idea what these numbers do. If they're for some reason does SOMETHING, most of them are unused in fs_slinger_new, which uses 0 instead of a number. So I have no idea what they do. Making them all 0 (which I did try) doesn't appear to change anything on the soldier's behavior, except during the firing of a missile. It's still too hard to notice anything right now.
D. This is pretty useful. 5 0 0 0 means it's the "right hand" so far only used as an attach point for pikes. Naturally it's on the right hand bone. If you change it to head bone, then pikes for pikemen units will be attached to the soldier's head. Making it all 0 will make pikes attached to Scene Root, aka. the pelvis (yes, it's juvile joy of watching your soldiers "raise" and "lower" his pike). 4 0 0 0 is used on the left hand bone. As of now, I have no idea what this is used for. 1 0 0 0 is the bone designated for the mounting of horse or camel. Basically it means 1 rider per mount and it follows the triggers of a horse type. 2 0 0 0 is used for elephant skeleton, so this is a mounting bone for a skeleton used as elephant. If you used this attribute on another bone, the engine will attach the crew/rider of the mount on that bone. So adding 1 0 0 0 on a bone will enable that skeleton to attach a horse rider on it. I have no idea if 3 0 0 0 is used at all since I couldn't find a skeleton that uses it.
E. Now this is the main attraction. This is the list of the bone's coordinates in respect to its parent. Changing the values of these will alter the appearance of a skeleton. You can extend arms, or the neck or create an entirely new skeleton.
F. This is the hierarchy of the bones, which bone is which bone's children, etc. I will explain how to make the list easily later in this post.
G. Unknown. Doesn't seem to do anything, really. fs_slinger_new and fs_archer even list them as all 0s.
H. The number of animation entries.
I. The entry for the animation to use. The list of animation triggers appear to be a set list. You cannot move stand_idle to the bottom and expects the engine to activate that for standing idle. It will always read the first entry as stand_idle. There appears to be a pre-determined set of trigger to be read when the engine reads a skeleton file.
J. Most of these is unknown. There's little difference between this entry's numbers and the others. There are some exceptions, most notable is the IMPACT FRAME number, where it indicated the frame an impact is supposed to occur when an attack animation is played so the opponent may react accordingly. This one is interesting because during my testing, if you put the impact frame to be 0, then the attack will not commence. If you put impact frame on all attacks to be 0, you will get a unit/soldier that CANNOT attack! Further research required.
K. This is the number of entries of sound triggers. If there is no sound to be activated, this number is set at 0.
L. I'm semi-certain the number here corresponds to the type of sound data banks. Further research required.
M. I'm semi-certain the first number is the frame the sound should start to trigger and the third number is the last frame the sound could trigger. Having the same numbers mean the sound is always triggered at that exact frame, having a range means they could be triggered at any time within the range. Note that this is still my speculation.
N. The name of the sound file/bank to derive the sound files from. This is what you change if you want this particular skeleton to produce a different sound than the one you copied it from.
O. This is still unknown. It appears to be relevant but I still don't know what they're for.
Then, we see this part:
The "0 0 0" is from fs_dagger, which you cannot use for a missile unit. That "0 0 0" is actually 3 animation triggers that are deactivated, they are missile_aim, missile_hold and missile_fire, which can be seen at the figure below it from fs_archer. I have tested and copied the 3 entries from fs_archer and paste it on fs_dagger to make a new skeleton and it works. I can just use "fs_archerdagger, fs_archerdagger" for entry in DMB instead of "fs_archer, fs_dagger". I am unsure why CA would deactivate some animation triggers. Perhaps there's a limit on the number of triggers? Or perhaps they do it simply to make skeleton files less cluttered, as in less triggers better performance.
If we compare all of these entries then we find that each skeleton is read in a series of triggers. If the entry is simply "0" then the game would say "There's no entry for it, can't play, let's crash instead!" like if you used "fs_dagger, fs_dagger" for a unit with a missile attack since missile animations are missing from fs_dagger.
Ok, so let's get to the meat of the possibilities. What are really possible with this tool? Here's an example:
This is a screenshot of my testing of a completely different skeleton but a very simple one: a snake, which is just a straight line.
This is the model I quickly made up for this testing.
I made 1 animation to test and the result can be seen here:
But what can a new kind of skeleton do for existing models/units? Well, we can now do what M2TW modders already did with adding new bones, like this:
Note that there is a drawback to this method, meaning the bow cannot be "hidden" by the engine when switching weapons. This is because it is animated, thus will not be read as "primary weapon" stand-alone object. We are also bound by the hardcode: there's a maximum of 24 bones per skeleton. I tried adding more and the game just CTD without error message.
Even though it only appears I added very few new animations on the archer, in fact ALL of the animations are new. Basically, I had to export every single animation to be used by the new skeleton (with 24 bones instead of the regular 19 bones) because the way the engine reads animations.
The RTW engine (which I think was rectified in M2TW) reads every bone in the skeleton by a set list. For the regular skeleton RTW use, this is the list:
The list's coordinates can be seen in part E above. If you convert fs_archer and fs_slinger_new you will see the difference. The slinger has an extra bone after bone_Rhand called bone_Weapon. Note that the names of bones are irrelevant. The engine ignores the names and only reads from the list. Meaning if you used a regular skeleton's animation (19 bones) on a slinger (20 bones), the rotation value of bone_Rthigh will be applied to the slinger's bone_Weapon and so on, until the slinger's last bone, bone_Rfoot, receives no rotation. Importing a slinger's animation on a skeleton with less than 20 bones will cause an error on the MAX script. You can easily test this in MAX: open the slinger's model, then import a regular animation, it will show up weird. Now try it again but delete bone_Weapon before importing the same animation. The slinger model should animate normally.
So making a new skeleton for RTW has its drawback: you have to make every single animation it's going to use. Sure, it's not really that hard since in my case, I just imported existing animations, add in the new bones then export them. Only 3 animations are using the new bones: readying the bow, holding the bow and firing the arrow. It's a time-consuming labor mostly.
So, in summary, to create a new skeleton, this is what you must do:
1. Make the model with the new skeleton.
2. Export it as a CAS model, then press F11.
3. Copy the data shown by the scipt, this is important.
4. Make all the new animations you want to use on your new skeleton, export them with all the bones.
5. Extract all the skeletons and animations.
6. Pick the closest skeleton you want to use, copy it and rename.
7. Convert the new skeleton into text file, open it.
8. At the bone coordinate part and hierarchy, use the data from part 3. However, be sure to convert the coordinates rom (x, y, z) in MAX to (-x, z, -y) for the skeleton.
9. Change all the animations into the new animations. Change any sound trigger if you want.
10. Convert the edited skeleton text file into skeleton file. Delete the old one, rename the new one.
11. Add the new skeleton name in list.txt.
12. Add all the new animations in anim_list.txt
13. Repack skeletons and animations.
14. Use the new skeleton in DMB.
Now let's get crackin' and figure out what else can we uncover from this!
Many thanks to Knight Errant for writing this wonderful tool and putting up with my endless nagging for revisions and info.
PS. Also from Knigh Errant, a fix for Vencingetorix's CAS Export/Import tool here: CAS_IE_b79_modbyKE_ver3.ms
This updated tool does nothing for the average modder who only deals with models. The fixes are for animations. It fixes the animation glitch where soldiers will not reach their actual destination if the walking animation is edited. They will now reach their intended spots. Also fixed is the glitch where the soldier have to do a 90 degrees turn and the engine cannot turn them partially. They can now do so without glitching. One more glitch still exists though, which is the not-reaching-destination glitch for mounted units.
Last edited by Pat89; August 30, 2010 at 12:24 PM.
I do not profess to know about such detailed moddling,but I can see the usefulness to the gaming community,so appreciate the work from all involved. Rep for you in this project & Happy Christmas.
Chiming in to add some basic rules to RTW animation editing:
- RTW engine only reads rotations of the bones. This is important to remember. It will ignore any positioning of the bones as the CAS exporter will just not register it. So work your animations by rotating the bones using the rotation tool, not the position move tool.
- Only the Scene Root's position is registered by the CAS exporter. Units in battle also move by the Scene Root's position and speed.
- An animation to be used for RTW MUST end at an odd numbered frame. Do not export an animation ending in an even numbered frame.
Chiming in to add some basic rules to RTW animation editing:
- RTW engine only reads rotations of the bones. This is important to remember. It will ignore any positioning of the bones as the CAS exporter will just not register it. So work your animations by rotating the bones using the rotation tool, not the position move tool.
- Only the Scene Root's position is registered by the CAS exporter. Units in battle also move by the Scene Root's position and speed.
- An animation to be used for RTW MUST end at an odd numbered frame. Do not export an animation ending in an even numbered frame.
Thanks for the input! I added it to post #2
Re the odd ending of an animation... I didn't know that! Also, I never had any problems with my animations. So either I'm lucky, or maybe it doesn't matter?
Also, what number should be odd? the 39 of (in this case) "frame 1/39" which shows on the slider:
Hi! Thanks for the tutorial, it's very useful. I've got 1 question to ask, related with the first and the last frames. If I want to modify them, is there a way to copy the position of the bones to another animation file? So that they fit correctly.
There are none so enslaved as those who falsely believe they are free
Actually, I was wondering myself that too... But I don't really know how to do that...
Other than of course create one animation file with all sub-poses each in its own frame and save that somewhere safe. Then base all your animations on that file. But obviously that isn't a very efficient way and it's not compatible with existing animations...
So the short answer to your question is: sorry, I don't know