FP_RIG Part IV – Profit

With a rigged mesh, and a skeleton – it’s time to get it into the engine. But how? Well, first we’ll have to export the character into a chr file, then we’ll need to copy the “default” (read: agent_fp_global) chrparam file. It is what points our rig to the animations and without it – things won’t ever look quite right. Then we’ll need to adjust the default player script and change which arms it’s pointing to.

He wants your BRAAAINS!

So let’s see how I did that. Well the very first thing I noticed was I needed to create a place somewhere in the CDK which I can keep files. I’m not sure if you’d noticed, but any folders in the folder are treated as a separate folder inside the engine. Basically, it’s a quick way to organize files before you package them. I created a folder inside the Game folder to hold all of my files . And then inside it, I created a folder for characters , could even go to the nth degree like me, and create a separate folder for each character . My directory ended up being located at and would only need a few files in it: fp_arm.chr, fp_arm.chrparams, and fp_arm.mtl.

The *.chr and *.mtl files are generated by the export. That process is fairly simple, you create a group for the character (in this case, the group was named cryexportnode_fp_arm) and put inside it everything related to the physical mesh of the character. What CryTek often refers to as the live-deforming mesh, fairly descriptive and I like it. You will want to make sure that the skeleton stays out of the group.

The complete outliner in Maya.

CryTek does a pretty good job writing up on how to export an animated skeleton in their Documentation, so I won’t go too far into the process. It’d just be regurgitation, as anything I learned about exporting characters into the engine was learned from there.

When you have your *.CHR and *.MTL file, you need to find a copy of agent_fp_global.chrparams and duplicate it, rename it to match your *.CHR and *.MTL files. Once again, in my case this was simply FP-ARMS.CHRPARAMS. Then move the three files to a folder you can locate inside the game engine.
Now you need to edit the player.lua file. Be careful with this, especially if you’re not familiar with LUA or scripting in general. You will want to open Scripts.PAK with an archiver. I prefer WinRAR for this task, as it allows me to save the file inside the package seamlessly. And navigate to . Inside are a few files, including PLAYER.LUA. Open it.

Approximately forty lines down, you will find a line which reads (and you may just want to search for it.)
fpItemHandsModel = “Objects/Weapons/Agent_fp/Agent_fp_Global.chr”,

You will want to change the area which reads “Objects/Weapons…” to where-ever you have placed your new arms. In my case, this line reads “MyGame/Objects/Characters/FP-Arms/fp_arms.chr” although chances are yours will probably be located somewhere else. Make sure you include the quotation marks, and ensure the comma at the end of the line; the script compiler looks for these things to know how to interpret the file… they’re important. Equally important is the direction of the slash, use / like a web browser, and not \ like a file explorer.

Anyway, when you’re done you will want to save it and put it back in the archive. As I mentioned, WinRAR allows you to open the file, work on it, save it, and close the package without too much trouble. Seamlessly even. You save the file in Notepad, and are asked if you want to update it in WinRAR. Simple.
You should then be able to launch the engine, and check to see if, you named everything right er, the arms appear. The moment you launch Game Mode – if you’ve misnamed a joint or something, then the Console Window will let you know. Plus, if things didn’t work right then the arms won’t appear… Gun will just be floating on the screen. Unless it’s not, that’s a different problem entirely though. We’ll get to that.
However, if the joints are named right and the arms are referenced properly, you will get the arms – all bright red from the default material file. But hopefully animated and acting quite proper. You’ll want to go into the Material Editor and change the values for the arm material, probably link it to DEFAULT_NOUVS.DDS, GREY.DDS or something similar while you build a texture for it. (Personally, I use GREY.DDS)

Next Time: Troubleshooting

0 0 votes
Article Rating
2 Comments
Inline Feedbacks
View all comments
Sascha
Sascha
10 years ago

Does it matter if we use the exact same bone hierarchy for the fp arms? I use my own system from another engine and was wondering if I have to start again or just use mine.

Michael
Michael
10 years ago
Reply to  Sascha

Well Sascha, that really depends on what you plan to do with the arms. The short answer is no; I say this because the chances are very good that you plan to create custom weapons, and animate everything yourself (as I fully intend to.)

I would still recommend you try things this way. The stated goal I had for this project was to create a set of arms which would fully integrate with the CDK. (Same bone locations. Use all default animations. And behave properly with the default weaponry.) Using the above method, I succeeded in this goal.

That said, you can create any rig you want, import it, and probably get it to a Franken-arms stage. It would then need a custom set of animations (something not covered by this tutorial, but certainly not impossible.) I would recommend you do both. Start with the system as I documented it, and then adapt it to work with your own rig.