Deliverator
Graphical Hackificator
Conversions so far...
This is going to be a fairly hefty tutorial on converting units from Kohan II for use in Civ IV. It will cover a lot of ground and the same skills learned here may be used to edit existing vanilla animations and create custom ones of your own. Even if you don't have 3DS Max, then you may learn something from this and I'll try and show how to acheive the same sort of things in Blender. The reason for using Max is basically because Gamebryo version 10.1.0.0 animations do not import into Blender at all even with the most up-to-date Nifscripts. Also, Blender seems to have more of tendency to screw animations up on import.
Required software:
+ 3DS Max
+ Nifscripts for 3DS Max
+ NifSkope
+ KonverterFM
+ Blender
+ Nifscripts for Blender
Note: At time of writing I have am using the following software versions: Python 2.6, PyFFI 2.1.3, Blender 2.49, Blender NIF Scripts 2.5.2. It is advisable to update PyFFI, Blender and Blender NIF Scripts fairly regularly as new features are added and bugs fixed.
Background reading:
The Coyote's Animation Tutorial - there is helpful info in the associated thread too
The Coyote's NifSkope Tutorial
Civilization IV Animation Basics
First take a look at the JPGs in the attached Motion_Flow_Diagrams.zip. These are included in the Civ 4 PAK files, and give an overview of the separate animations for each unit type.
Looking at cut down diagram below, the number in brackets in the bottom left of each box is the number of frames allowed for that animation - some are a fixed value and some give a range so you can choose within that how long you want the animation to be. The number in the top right of each box is the eventcode for that action. Each box corresponds to a KF animation file for a given unit, the KFM file lists which eventcodes trigger which KF file. The KFM file may be edited using KonverterFM.
The minimum number of animations you actually need for a reasonably functioning unit is 8. Here's a handy reference chart for them:
Other Optional Animations:
The only other ones I bother with for Melee units are the nice-to-have Fidget animations and combat variations - Fortify/Fortify_Idle/Strike/Hurt/Die/Die_Fade variations B and C which are eventcodes 2020-2025 and 3020-3025.
The Kohan II animations map reasonably well to the CivIV ones with some gaps:
In some cases, the Kohan II Cast animations can be used as Strike animations.
The main reason we have some work to do is that the Kohan II animations are in an old Gamebryo format (version 10.1.0.0) and, more importantly, the ones that map up nicely are not the correct duration for Civ IV so we have to make them the right length.
Chapter 1 - Converting our first animation
The entire set of Kohan II units can be downloaded here. We're going to use the Juggernaut unit in the Gauri folder as our example.
1A: Converting the NIF
1. File > Import > Select Netimmerse/Gamebryo > Select the file Juggernaut.nif. Options as below:
(If the Juggernaut is not standing with the stance you seen in the next screenshot with one foot forwards, try restarting Max and repeat the above.)
2. File > Export > Select Netimmerse/Gamebryo (if not already) > select output directory > juggernaut.nif. (You can uncheck Start NifSkope if you prefer)
3. Open the exported NIF in NifSkope for a bit of tidy-up work. Delete SpineSg and SelectionBox TriShapes. Next, on the Bip01 node set all Translations (X,Y,Z) and Rotations (Y,P,R) to zero - don't worry that this puts the model in a strange position - the animations will fix that. Save the NIF with a new name like juggernaut_nifskope_cleaned.nif. (It is a good idea to never overwrite when you do a NifSkope edit as it is easy to screw stuff up)
1B: Make a Run animation by shortening the Walk animation to 20 frames
4. File > Import > Select Netimmerse/Gamebryo > Select the file JuggernautWalk.kf (all three checkboxes checked)
5. Left-click drag over the model to make the animation show up on the key track at the bottom, then open Graph Editors > Track View - Dope Sheet.
6. In the Dope Sheet > right click in the left hand pane > Select only Modifiers and Materials in the Auto Expand submenu. If you don't see a track called Notes in the Dope Sheet then close it and re-open.
7. Outside of the Dope Sheet in the key track below the viewports left click drag to select all the key frames. Everything there and in the Dope Sheet should turn white to indicate that it is selected. Then in the Dope Sheet Ctrl+Left-Click-Drag over on the end note to add that to your selection.
8. Unselect the magnet Snap Frames icon and select the Scale Keys icon. Making sure the vertical blue time line is on the leftmost frame, drag any key on the far right so that it lines up with frame 20 at the bottom.
Note that in the Dope Sheet a full block key indicates that an animation key is snapped perfectly to a frame - a thinner block indicates that an animation key is occuring between frames.
9. In the main screen key track left click drag over only the final frame (again you may need to Ctrl+Left-Click drag over the end note. In the Dope Sheet switch the magnet Snap Frames icon back on and tweak the final frame so that it snaps to frame 20.
10. File > Export > Netimmerse/Gamebryo > Type juggernaut as the file name > Same options as before except for Animation select Multi KF w/o NIF.
11. Now we can check whether our first converted animation has come out OK. Open juggernaut_nifskope_cleaned.nif in NifSkope go to Spells > Animation > Attach .KF and locate the animation you exported from Max - it will be called something like juggernaut_Bip01_JuggernautWalk.kf.
12. If you've done everything correctly the animation should be 0.667 long (At 30 fps a frame is 1 / 30 = 0.0333333 seconds long, so a 20 frame animation should be 20 x 0.03333 = 0.667), the Juggernaut should be walking smoothly and flat to the XY plane.
One animation down... but there's plenty more.
This is going to be a fairly hefty tutorial on converting units from Kohan II for use in Civ IV. It will cover a lot of ground and the same skills learned here may be used to edit existing vanilla animations and create custom ones of your own. Even if you don't have 3DS Max, then you may learn something from this and I'll try and show how to acheive the same sort of things in Blender. The reason for using Max is basically because Gamebryo version 10.1.0.0 animations do not import into Blender at all even with the most up-to-date Nifscripts. Also, Blender seems to have more of tendency to screw animations up on import.
Required software:
+ 3DS Max
+ Nifscripts for 3DS Max
+ NifSkope
+ KonverterFM
+ Blender
+ Nifscripts for Blender
Note: At time of writing I have am using the following software versions: Python 2.6, PyFFI 2.1.3, Blender 2.49, Blender NIF Scripts 2.5.2. It is advisable to update PyFFI, Blender and Blender NIF Scripts fairly regularly as new features are added and bugs fixed.
Background reading:
The Coyote's Animation Tutorial - there is helpful info in the associated thread too
The Coyote's NifSkope Tutorial
Civilization IV Animation Basics
First take a look at the JPGs in the attached Motion_Flow_Diagrams.zip. These are included in the Civ 4 PAK files, and give an overview of the separate animations for each unit type.
Looking at cut down diagram below, the number in brackets in the bottom left of each box is the number of frames allowed for that animation - some are a fixed value and some give a range so you can choose within that how long you want the animation to be. The number in the top right of each box is the eventcode for that action. Each box corresponds to a KF animation file for a given unit, the KFM file lists which eventcodes trigger which KF file. The KFM file may be edited using KonverterFM.
Spoiler :
The minimum number of animations you actually need for a reasonably functioning unit is 8. Here's a handy reference chart for them:
Code:
Animation Frames Eventcode Loop? Sound?
Idle 60-120 1000 YES NO
Run 16-20 1010 YES YES
FortifyA 15 1020 NO YES
FortifyA_Idle 60-90 1021 YES NO
StrikeA 21 1022 NO YES
HurtA 21 1023 NO YES
DieA 25-35 1024 NO YES
DieA_Fade 30 1025 NO NO
Spoiler :
Code:
FidgetA 60-120 1001 NO YES
FidgetB 60-120 2001 NO YES
FidgetC 60-120 3001 NO YES
FortifyB 15 2020 NO YES
FortifyB_Idle 60-90 2021 YES NO
StrikeB 21 2022 NO YES
HurtB 21 2023 NO YES
DieB 25-35 2024 NO YES
DieB_Fade 30 2025 NO NO
FortifyC 15 3020 NO YES
FortifyC_Idle 60-90 3021 YES NO
StrikeC 21 3022 NO YES
HurtC 21 3023 NO YES
DieC 25-35 3024 NO YES
DieC_Fade 30 3025 NO NO
The only other ones I bother with for Melee units are the nice-to-have Fidget animations and combat variations - Fortify/Fortify_Idle/Strike/Hurt/Die/Die_Fade variations B and C which are eventcodes 2020-2025 and 3020-3025.
The Kohan II animations map reasonably well to the CivIV ones with some gaps:
Code:
Kohan II Civ IV
Idle -> Idle
Jog/Walk -> Run
x Fortify (make from Idle and IdleMelee combined)
IdleMelee -> Fortify_Idle
Melee -> Strike
x HurtA (make by hand)
Die -> Die
x Die_Fade (make from final position of Die)
Fidget -> Fidget
In some cases, the Kohan II Cast animations can be used as Strike animations.
The main reason we have some work to do is that the Kohan II animations are in an old Gamebryo format (version 10.1.0.0) and, more importantly, the ones that map up nicely are not the correct duration for Civ IV so we have to make them the right length.
Chapter 1 - Converting our first animation
The entire set of Kohan II units can be downloaded here. We're going to use the Juggernaut unit in the Gauri folder as our example.
1A: Converting the NIF
1. File > Import > Select Netimmerse/Gamebryo > Select the file Juggernaut.nif. Options as below:
Spoiler :
(If the Juggernaut is not standing with the stance you seen in the next screenshot with one foot forwards, try restarting Max and repeat the above.)
2. File > Export > Select Netimmerse/Gamebryo (if not already) > select output directory > juggernaut.nif. (You can uncheck Start NifSkope if you prefer)
Spoiler :
3. Open the exported NIF in NifSkope for a bit of tidy-up work. Delete SpineSg and SelectionBox TriShapes. Next, on the Bip01 node set all Translations (X,Y,Z) and Rotations (Y,P,R) to zero - don't worry that this puts the model in a strange position - the animations will fix that. Save the NIF with a new name like juggernaut_nifskope_cleaned.nif. (It is a good idea to never overwrite when you do a NifSkope edit as it is easy to screw stuff up)
Spoiler :
1B: Make a Run animation by shortening the Walk animation to 20 frames
4. File > Import > Select Netimmerse/Gamebryo > Select the file JuggernautWalk.kf (all three checkboxes checked)
5. Left-click drag over the model to make the animation show up on the key track at the bottom, then open Graph Editors > Track View - Dope Sheet.
6. In the Dope Sheet > right click in the left hand pane > Select only Modifiers and Materials in the Auto Expand submenu. If you don't see a track called Notes in the Dope Sheet then close it and re-open.
Spoiler :
7. Outside of the Dope Sheet in the key track below the viewports left click drag to select all the key frames. Everything there and in the Dope Sheet should turn white to indicate that it is selected. Then in the Dope Sheet Ctrl+Left-Click-Drag over on the end note to add that to your selection.
Spoiler :
8. Unselect the magnet Snap Frames icon and select the Scale Keys icon. Making sure the vertical blue time line is on the leftmost frame, drag any key on the far right so that it lines up with frame 20 at the bottom.
Note that in the Dope Sheet a full block key indicates that an animation key is snapped perfectly to a frame - a thinner block indicates that an animation key is occuring between frames.
Spoiler :
9. In the main screen key track left click drag over only the final frame (again you may need to Ctrl+Left-Click drag over the end note. In the Dope Sheet switch the magnet Snap Frames icon back on and tweak the final frame so that it snaps to frame 20.
Spoiler :
10. File > Export > Netimmerse/Gamebryo > Type juggernaut as the file name > Same options as before except for Animation select Multi KF w/o NIF.
11. Now we can check whether our first converted animation has come out OK. Open juggernaut_nifskope_cleaned.nif in NifSkope go to Spells > Animation > Attach .KF and locate the animation you exported from Max - it will be called something like juggernaut_Bip01_JuggernautWalk.kf.
12. If you've done everything correctly the animation should be 0.667 long (At 30 fps a frame is 1 / 30 = 0.0333333 seconds long, so a 20 frame animation should be 20 x 0.03333 = 0.667), the Juggernaut should be walking smoothly and flat to the XY plane.
Spoiler :
One animation down... but there's plenty more.

Attachments
-
ktut1.jpg35.2 KB · Views: 1,332
-
ktut2.jpg144.8 KB · Views: 1,347
-
ktut3.jpg63.8 KB · Views: 1,325
-
ktut5.jpg67.8 KB · Views: 1,325
-
ktut6.jpg231.2 KB · Views: 1,354
-
ktut9.jpg30.4 KB · Views: 1,326
-
ktut8.jpg236.8 KB · Views: 1,349
-
ktut7.jpg240 KB · Views: 1,337
-
Motion_Flow_Diagrams.zip532.4 KB · Views: 167
-
motionflow_mini.jpg36.8 KB · Views: 1,352
Last edited: