It seems that there are some people who are interested in modding, but aren't sure where to begin. So, I thought it might be useful to post a tutorial with step by step instructions for some basic modding techniques. It will cover extracting packages, model swapping, and basic texture editing. These techniques are useful to change the appearance of characters in single player mode, and will hopefully provide a useful basis for learning more advanced techniques.
Tools you'll need:
1. Space Marine Tools by Santos. This is needed to extract oppc archives.
2. A program to edit .dds images. Photoshop is an excellent tool if available, but there are free alternatives. For this guide, I'll be using Paint.net. The GIMP is another free image editing suite with some nice features.
3. A text editor. Notepad will suffice for what we're doing in this tutorial, but something a bit more code-oriented may be useful if you intend to get deeper into modding. I recommend Notepad++.
Part I - Exracting the data
To begin, we'll need to get the existing Space Marine data in a format that we can edit.
1) Locate the packages folder. It should be found in Steam\steamapps\common\warhammer 40,000 space marine\data\packages\, wherever you installed steam.
2) Unzip Santos' Space Marine tools, and find smoppc.exe. Look in the \smopcc\bin\ folder.
3) Place smoppc.exe in the packages folder and run it. This will extract all the packages from the archives, giving you a bunch of new folders. If hard drive space is an issue, you may prefer to look at the file names, and only extract the packages that you're interested in, but it's more convenient to extract them all at once.
Part II - Model swapping
Now that the data is extracted, we can change the parts that appear in-game. We will start by changing Titus' breast plate into the one used by Sidonus.
1) In your \warhammer 40,000 space marine\ folder, create a new folder called "preview". All edited files will go in the preview folder.
2) Go into the \warhammer 40,000 space marine\data\config\ folder, and find packages.xml.bin. This file tells the game where to look for each package.
3) Open packages.xml.bin in a text editor or hex editor. You'll see a list of packages with the folders they need to go in. You'll also see some unintelligable characters, but you can just ignore them.
4) Search for the part you want to replace. We'll start with the breast plate for Titus. The packages for his armor parts are called "sm_armour_basic_upres", with a separate package for each part. We want the torso, so use the find function in your text editor to search for "sm_armour_basic_upres_torso".
5) When you find it, look for the next line of readable text. It will say "art/race_marine/characters/spacemarine/armour/sm_armour_basic_upres", so that's the directory we need to make.
6) Go into your preview folder, and inside that, create a folder called art, then a folder named race_marine inside that, then characters inside that, then spacemarine, then armour, and finally sm_armour_basic_upres.
7) Now, go to the packages that were extracted in Part I, and find the package you want to use for Titus' torso. We'll be using Sidonus' torso, so find a folder called "sm_armour_sidonus_torso".
8) Move or copy the "sm_armour_sidonus_torso" folder into /preview/art/race_marine/characters/spacemarine/armour/sm_armour_basic_upres/
9) Go into the "sm_armour_basic_upres" folder. We now need to rename the new package to match the name of the package we want to replace. So, change the name of the "sm_armour_sidonus_torso" folder to "sm_armour_basic_upres_torso".
10) Go into the newly renamed "sm_armour_basic_upres_torso" and find the .dcm file. The game will look for the appropriate .dcm file, and use that to determine the rest of the files that will be loaded for that part. So, the .dcm file is the key to swapping parts.
11) The .dcm file will always or nearly always have the same name as the folder. So, rename sm_armour_sidonus_torso.dcm to sm_armour_basic_upres_torso.dcm. That's all you need to do; none of the other files need to be renamed or changed.
Part III - Seeing the changes
If you just launch the game normally, Titus will still look the same as before. To make the changes appear in-game, we need to enable mods. Note that launching the game with mods enabled will temporarily lock multiplayer, but you can access mp again by launching the game normally, so it's nothing to be concerned about.
1) First, create a new shortcut to spacemarine.exe. You may want to rename this shortcut to indicate that it'll be used for launching the game with mods.
2) Right-click on the shortcut and select properties. In the dialog box that pops up, make sure the "shortcut" tab is selected.
3) You'll see a box labelled "target". The box shows the path to spacemarine.exe. After that path, write -usepreview (make sure that there is a space between the path and -usepreview).
4) Now, when the game is launched through this shortcut, mods will be enabled (and multiplayer will be disabled). Launching through steam* or through any other shortcut will load the game normally, with mods disabled, and multiplayer enabled.
5) Launch the game through the new shortcut and look at Titus. He should now have the same breastplate as Sidonus.
Part IV - Texture editing
Textures are image files in .dds format. Paint.net can edit .dds files natively, but other programs may require a plugin.
1) Go into the folder for the package you want to edit. You should see four or five files with .dds extensions. Those are the textures.
2) The one ending in _dif (meaning diffuse) controls the color of the object, and the _spc (specular) texture controls the color of reflections. The others can be ignored for now.**
3) Open the existing _dif and _spc textures and in paint.net (or other image editor) and compare them. They will usually look similar, with more contast in the _spc version. You may want to save copies of these files to refer to later.
4) Now, edit the _dif file however you see fit. You can draw on the surface, paste in a chapter badge, and recolor different parts.*** Try to think about how the texture will look when wrapped around the surface of the model.
5) Save the texture, and your changes should show up in game (as long as mods are enabled). If you go to "save as", you'll get several options for the resultant .dds file. For now, just use DXT3 or DXT5, and don't worry about the rest.
6) Now, you can edit the _spc texture to go with your changes to the _dif texture.
7) Feel free to experiment with the _spc texture, but for now just remember how the _spc compared to the _dif in the original. You may want to simply resize the _dif to half its current size and replace the _spc with that, and then go to adjustments->levels and play with the sliders until you're satisfied with the results. You should be able to get a passable specular map this way.
8) After making your changes, save the _dif and _spc textures, and run the game with -usepreview to see how they look.
Part V - Using multiplayer armor parts
Using multiplayer parts is a little more complicated than using single player parts. Now that we know how to do a basic model swap, we can try swapping in a multiplayer armor part into singleplayer. Note that you can only replace similar parts, and even then not all parts will work. Trying to swap in a Chaos or Ork part will almost certainly crash the game. Trying to swap a helmet for a head or a power sword for a chainsword in this way will crash the game. If the mod you have in mind doesn't require any multiplayer parts, you can skip this part.
For this part of the tutorial, we're going to change Leandros' leg armor to the corvus-style MP leg armor parts.
1) Determine what folder you need to create using packages.xml.bin, just as you did for part II. The parts we'll be replacing are sm_armour_leandros_legl and sm_armour_leandros_legr.
2) Locate the packages containing the corvus leg parts. The parts are called sm_armour_mp_mk6_legl and sm_armour_mp_mk6_legr.
3) You'll notice several folders related to each part. Only two of these will be needed for each part.
4) Copy the sm_armour_mp_mk6_legl folder to sm_armour_leandros and rename it, then rename the dcm file, as in part II. Do likewise for the right leg.
5) Notice that the folder for the multiplayer part is missing some textures. The textures are stored in the _tt1 version of the folder. So, look through the extracted packages, and find a folder called sm_armour_mp_mk6_legl_tt1, and copy the .dds files from there to the newly renamed folder (where the .dcm file is located).
6) To make the multiplayer part work properly, we need to replace the .bmat file. So, delete the .bmat file from the folder, and copy the .bmat from the original package that is being replaced. In this case, get the .bmat files from the sm_armour_leandros_legl and sm_armour_leandros_legr packages that we originally extracted in Part I.
7) The .bmat file points to the textures that will be used, so the textures need to be renamed to go with the new .bmat file. So, rename sm_armour_mp_mk6_legl_dif.dds to sm_armour_leandros_legl_dif.dds, and so on for the other textures. Do the same for the right leg.
8) Run the game and check to make sure the new parts are working properly. Remember that some parts will simply crash the game if you try to use them this way.
Conclusion
With these techniques, you should now be able to replace interchangable parts for Space Marine characters, and do some simple texture editing to reach a desired effect. I hope this will give you a good basis for a variety of mods.
-----------------
*If you want the game to use mods every time it's launched, then you can right click the game in steam, and choose properties. Click "set launch options", and put -usepreview in the box.
**For future reference, the _nrm (normal map) controls the direction of light reflecting off a surface, and is used to modify the appearant shape of an object. Editing a normal map is complex, but you can find general normal map tutorials on the internet if you want to try. The _lp file affects the reflectivity of a surface, where each color channel determines a different property. Blue is reflectivity, and green is emissivity. So, more blue in the _lp means a more reflective surface.
***If you're doing a simple recolor, I find the easiest way is to start by going to the layers box in the corner of the screen, and duplicating the existing layer. In the top layer, cut out the parts you don't want to recolor. Change the bottom layer to black and white. Now, create a new, blank layer in between those two. Fill this with the color you want. Now, go into layers->layer properties, and change the blending mode to "overlay". This should give you a quick recolor of the underlying parts. Go to image->flatten to combine all the layers, and now you can save the texture.


But, I have a slight problem.. And it's really beyond my basic knowledge.
[/URL












