Some answers to common questions you may have when getting started with CoD editing.  I can't make any guarantees about the accuracy of these answers, but as far as I know they are correct.

Shaders and surfaces

- Does CoD support actual smoothing groups or are they simulated (separating faces)?

CoD supports the smoothing groups from 3DS Max.

- How do we write sfx shaders, for say having an environment map on a weapon, displayed through the weapon's skin's alpha channel?

We have two methods of putting a shader on an object. First is shadertype (or dds or jpeg).  This allows you to easily use one of the standard shaders defined in the shadertypes folder.  The more involved (and powerful) way is to make a shader in the scripts folder, just like you would in Q3.  Give it the same name as the texture you assigned to the object in Max, or use Asset Manager's skin override function to point at the shader name.  One issue here - converter requires that there be a texture in the model's export directory with that name.  Sometimes you'll just have to make a dummy texture (something really small or a copy of another texture) to make it happy, even though you're really referencing a shader.

To create a new shader, create a .shader file in "main/scripts".  You may have to create the "scripts" directory.  The syntax for shaders is exactly the same as that for shadertypes, except that the $texturename keyword is replaced with an actual texture name, and you can have several shaders in a single .shader file.  The name of the shader is specified at the start, and the game's file system will think of the shader as a file in the directory you specify.  Here's an example shader from CoD:

// Spinning prop for planes
skins/stuka_prop
{
   surfaceparm metal
   cull none
   {
     map clamp skins/stuka_prop
     tcMod rotate 5000
     blendFunc blend
   }
}

There are a couple of things to note. 

The file paths are all in the "skins" directory, not in "model_export/vehicle_models/german/air", which is where they were originally created.  This is because converter moves all model textures into the "skins" directory, and that's where the game looks for them.  If you want your shader to reference a world texture, you'll want to put the correct directory for that, but if it's a model texture, it'll be in the "skins" directory by the time the game looks for it.

The shader name is identical to the texture that was applied to the model in 3DS Max, and it references that texture.  This isn't necessary but in most cases it's easier, since converter wants a texture to exist, and CoD will automatically find the shader with the same name as the texture.  Call of Duty can read several types of files as textures, and looks for them in the following order: shader, dds, jpeg, tga.  Thus, the stuka model references the stuka_prop texture, and converter will move stuka_prop.dds into the skins directory.  When the game loads the stuka model, it'll first look for a shader called skins/stuka_prop, and since it exists. 

- with the shadertype@texturename, how do the shaders differ? Say a body@ compared to a HUD@

They control draw order, effects for bullet impacts and footsteps, transparency, anything you could do with a shader.  Look in tools/game/main/shadertypes/model for some basic examples.  If you unpack the game (or just search in the pak file for .stype files), there are a lot more examples.

Viewmodels

- Are view weapon animations for both the hand and the weapon (like the slider being pulled back when fired) all part of the same xanim file? Or are the hand's animations in a separate file from the weapon's animations?

Yes they are part of the same xanim file.  They are played on two separate models in-game, but they are one animation file.  As a result of this, converting a viewmodel is a little trickier, and involves an extra model that is only used by asset manager and converter.  Viewmodel export is detailed in the viewmodel how-to we released on January 15th.

- Is each animation sequence (like reloading, firing, etc) separate xanim files?

Yes.  They all come from the same Max file (usually) but they're separate xanim files.

- Does each weapon have their own, separate FOV from the player's view? Can it be changed in asset manager?

No, the viewmodel's FOV is the same as the player's FOV.  It also changes with the player's FOV when you aim down the sight.

- Can I change the hands used in the viewmodel?

It's easier just to change the weapon if you want to be able to use your new viewmodel with existing CoD viewmodels.  We designed the system so that the texture on the player's hands changes depending on what player model he has, not on what weapon he's carrying.  Thus, if you use a new hand model for your weapon, but you use it with regular CoD player models, your hands will have CoD hand textures put on it.

Here's how it works.  Call of Duty gets the hand model from the viewmodel, but the texture is specified elsewhere.  In multiplayer the texture is specified in source_data/character_mp.gdt, in the "viewmodel" field.  In single-player, the texture is specified in the level script.  In both cases, the texture is specified by pointing the game at a model with the correct texture.  Thus, all of the hands on the viewmodels in Call of Duty use the same texture coordinates, so that they can swap textures to match different player models (this mainly changes the look of the sleeve to match the player model's uniform).

Converter and Asset Manager

- How come Asset Manager only works with gdt's under the Tools directory? You're limited to making all your mods under that tools directory, instead of doing them under the an actual mod directory under Call of Duty.  I'm also not quite sure how converter works. It seems it just works with only the stuff in the Tools subdirectories and compiles all the sample material that comes with the tools, when I don't want to touch that.

Asset Manager regards its parent directory as the root and looks for files to convert under the root.  It should be relocated as follows in order to successfully make mods for Call of Duty. We probably should have included these instructions with the tools. 


1) Create a subdirectory of "Call of Duty" called "game".
2) Move the files/folders in "Call of Duty" into "game".
3) Move the files/folders in "CoDTools\Tools" into "Call of Duty".  The "game" folder in "Tools" should not have any of the same files as are in the "game" folder already in "Call of Duty" so it should be safe to move it into the same folder.

Your "Call of Duty" directory should now contain folders:
- aitype
- bin
- deffiles
- docs
- game (contains pak files for the game, plus the example files that came with the tools)
- model_export
- source_data
- xanim_export
which is the same as the development setup we used at Infinity Ward.  Don't forget to check that your shortcuts point to the game's new location and working directory.

You should now be able to happily use converter to convert all your game assets.

- I restructured my directories, game still seems to work (don't know how it'll effect the uninstaller though) and I can now place my gdt's anywhere under CoD ;). However I still don't have control of converter. I just ran it and it starts doing all this stuff (converting, I assume) that I have no idea what it is. Then I had a look in game/Main and now there are all these sub-directories. Is there a way to keep converter from doing all this, or possibly tell it to just convert stuff in a specified directory?

It will create subdirectories, that's how it is meant to work.  It should not create much in them though.  It should convert all the Asset Manager entries you have in the folders it looks in, so will create files for all the examples we included with the tools.  So I'd expect perhaps 10 (or less) files in each directory it creates (assetsrccache in Call of Duty, and aitype, info, mptype, skins, vehicles, xanim, xmodel, xmodelalias, xmodelparts and xmodelsurfs in main).  It may not create all of those directories, since we didn't include examples for everything.  If it creates hundreds or thousands of files in any of those directories, then there's something wrong happening.

Testing your stuff in the game

- How can I run a mod for SP?

Create your mod directory in the same directory as "game".  Name it something descriptive.  In this example I'll name mine "mod". 
Inside the "mod" directory, create a text file called "description.txt".  In the case of a single-player mod, it doesn't matter what is in this file.  In a multiplayer mod, the contents of this file is what is shown by the mod menu in-game. 
Put all your mod files in your "mod" directory.
In your game shortcut, add the option "+set fs_game <your folder name>".  So, for example, my shortcut Target now reads:

"C:\Program Files\Call of Duty\game\CoDSP.exe" +set fs_game mod

- Say I make a new weapon for SP, how can I actually add it to the game? Can I summon it in front of me so I can just pick it up?

Try the console command "give all".

Call Of Duty Xtreme Articles catalogue

callofdutyx.com v 4_2