Note: Before starting, I would like to thank the guys at killtube.org for the VMF parser. It saved lots of time for me
[You are not allowed to view external links. Register or Login to see them]
Another note: Unfortunately, I still haven't found a way to convert the terrain patches, so they'll be flat brushes when they are converted. Any help will be appreciated about that
- A game built on Source Engine
- The tools listed below
- Maya with Call of Duty export plugins and the knowledge of how to use them
- A functional brain
Before you start, you'll need to download the following tools.
BSPSource: [You are not allowed to view external links. Register or Login to see them] (to decompile bsp files)
Crafty: [You are not allowed to view external links. Register or Login to see them] (to decompile models)
VTFEdit: [You are not allowed to view external links. Register or Login to see them] (to convert the textures)
GCFSpace: [You are not allowed to view external links. Register or Login to see them] (to extract the models and textures)
NVidia DDS Converter: [You are not allowed to view external links. Register or Login to see them] (to convert dds files)
Johndoe's Tools: [You are not allowed to view external links. Register or Login to see them]
- Extracting the materials and models with GCFSpace
In Source Engine, files like textures and models are stored in VPK files pretty much like Call of Duty's IWD files. There are usually two directories in which the VPK files are stored on most of the games (l4d2 is not one of them for example). One of them is always hl2 and the other one is usually the game's name's abbreviation (hl2mp in my case).
You'll need to open VPK files like gamename_pak_dir.vpk, gamename_misc_dir.vpk, gamename_textures_dir.vpk, and extract the folders "materials" and "models" in the same folder.
After you're done extracting the models and materials, you can copy or move the extracted folders in the game's directory (in my case steamdir/steamapps/common/Half-Life 2 Deathmatch/hl2mp/).
- Decompiling the bsp file with BSPSource
Run BSPSrc, click "Add", find the bsp file of the map you want to port and click "Decompile". I'm decompiling dm_steamlab from Half-Life 2 Deathmatch as an example.
- Converting the decompiled VMF file to a MAP file readable by Radiant
Run Johndoe's Tools, go to Source2Cod -> Map Converter, chose the VMF file you want to convert and hit "Convert".
After the app converts a VMF file, it creates three files. The file mapname.map is obviously the converted map file, mapname_textures.json and mapname_models.json have information about models and textures which can be used by Johndoe's Tools to copy the assets later.
- Copying the textures and models
Go to Settings, set your game's directory. Go to Source2Cod -> Texture/Model copier, select mapname_textures/mapname_models.json and hit "Copy".
- Decompiling the models with crafty
Go to the directory "copiedassets/mapname" and copy the directory "models" in gamedir/models/ with a different name (gamedir/models/copiedmodels/ for example).
Run Crafty, go to Setup -> Options -> Exporting and set texture extension to VTF and save it.
Go to Setup -> Options -> Directories and set your Steam directory and username.
Go to Setup -> Profiles and select the game.
Go to View -> Model Browser
If you set your Steam directory and game profile correct, then you'll see the copied models in root/models/[copiedmodels]. Find your copied models folder and expand it, right click every MDL file one by one and click "Export" or just navigate among the models with arrow keys and press Ctrl + E to export the highlighted model.
Make sure you export the models with their respective names in the same folder.
- Exporting the models with Maya
Create a file called resize.mel on your desktop, paste the following code in it and save it.
scale -r 2.54 2.54 2.54; makeIdentity -apply true -t 1 -r 1 -s 1 -n 0; polyColorPerVertex -r 1 -g 1 -b 1 -a 1 -cdo;
Run maya, open a model, select the whole model, drag and drop the MEL file on it. When exported, models from Source Engine are 2.54 times smaller than they are supposed to be so what we're doing here right here is a quick fix for it. You can safely export the models with their respective names.
- Fixing material names of the models
When you export a model with Crafty, it exports the textures like modelname_material_x. Even if there are models that shares some textures, there will be multiple copies of the same file over and over again which makes the map's size bigger and makes you closer to engine limits. To prevent this, copy the xmodel_export files in "tobefixed/xmodel_export/" and the exported VTF files in "tobefixed/vtf/". Go to Source2Cod -> Material Fixer, hit "Start Fixing". It will copy the fixed xmodel_export and VTF files in "fixedmodels/xmodel_export/" and "fixedmodels/vtf/". When it's done, move the fixed xmodel_export files into "Johndoe's Tools/xmodel_export/".
Sorry but you are not allowed to view spoiler contents.
- Converting the textures with VTFEdit and NVidia DDS Converter
Go to "copiedassets/mapname/textures" and move the vtf files in a new folder, go to "fixedmodel/vtf" and move the vtf files in the same folder. Run VTFEdit, go to Tools -> Convert Folder, set the the folder you just created as the input folder, create another folder and set it as the output folder. Set output type as TGA, convert the textures. Set the output type as PNG and convert them in a different output folder.
Copy nvdxt.exe in the folder where you exported the tga files, create a .bat file and copy following code and paste it into it.
nvdxt.exe -file *.tga -dxt5 -alpha
Copy the recently created DDS files in the folder "dds" in Johndoe's tools. Copy the PNG files in "dds/thumbnails".
- Go to GDT Generator -> For Textures/For Models
You can safely save the gdt file for xmodels. However, you'll need to set the properties of every single texture by looking at their preview images. This part is self-explanatory, so I don't think you'll need screenshots for it.
- Converting the assets for Call of Duty
Copy the GDT files from the folder "gdt" and paste them in "codroot/source_data/", the DDS files in "codroot/raw/images/custom/", xmodel_export files in "codroot/model_export/custom/". If you want to do a quick conversion, you can copy the .bat files in "Johndoe's Tools/gdt/" and paste them into "codroot/bin/". It always works on my computer when I run the .bat files as administrator, but for some reason, it doesn't work on computers of the people who tested it. So you'll need to run cmd.exe as administrator (Press start, type cmd, run as administrator), type the following and press enter.
For Call of Duty World at war Steam version:
cd "/Program Files (x86)/Steam/SteamApps/Common/Call of Duty - World at War/bin/"
For disc version:
cd "/Program Files (x86)/Activision/Call of duty - World at War/bin/"
For Call of Duty Modern Warfare:
cd "/Program Files (x86)/Steam/SteamApps/Common/Call of Duty 4 - Modern Warfare/bin/"
For disc version:
cd "/Program Files (x86)/Activision/Call of Duty 4 - Modern Warfare/bin/"
If you have it installed in another directory, you'll need to change it to your game's folder. After that, just type the name of the bat file (you should convert the textures before the models) and it should convert all of the materials one by one. If it doesn't work and gives errors, try converting them manually on asset manager and see the error yourself.
After you've done all of these, you can open the map (exported/mapname.map) on Radiant to see if it worked and start working on it after fixing the texture alignments. Here's a screenshot of the map after the conversion. Note that the textures of the brushes need to be realigned since the way the texture alignment info is stored in both VMF and MAP format are different and I couldn't find a way to convert that yet. Also, the pink boxes are actually infodecals converted to script_structs as I couldn't find a way to make a port them directly. For now you can delete all of them. Hopefully I will find a way to work some day.
Another screenshot of a room from the same map with fixed textures.
Screenshots of other ported maps.
cs_assault from Counter-Strike: Source (modified for the zombie mode)
contact from Insurgency (modified for the zombie mode)
I hope I made everything clear. If you have any troubles with anything with this, feel free to ask.