modding home
basic scenario creation
uniform modding overview
the order of things
variables reference
commands reference
map layout
Uniform Modding Overview

How to Mod Uniform files in CWBR
By Jim (6th Vermont) Weaver
download this article

Overview: Modding uniforms in this game is similar in principle to uniform mods in the Sid Meir engine series of games (Gettysburg, Antietam, Waterloo, Austerlitz). There are two parts to the process, editing the graphics files themselves and modifying the text files that specify which unit uses which graphic file for their uniform.

Memory Usage - Uniform graphics are held in memory – the standard CWBR set of seven uniform files for infantry takes up about 38 MB of memory. In my system with 1,000 MB of RAM, the game can take 400-500 MB depending on graphics settings and scenario loaded. System overhead is around 200 MB, leaving me with 300 MB of free RAM. This means that if I add 8 new uniforms (8x38=304), I will start to get into disk swapping, which begins to slow things down.

However, there is no requirement to use graphics in the CWBR format. Uniform files can be less detailed and have fewer frames of animation, with much less memory usage. For example the equivalent set of files from Austerlitz uses only about 6 MB of RAM. So one early decision is where to set your tradeoff between number of uniforms and level of detail on each uniform. How critical this is to you depends entirely on how much RAM you have on your system. If you have 4 GB of RAM, go wild.

Graphics files - Each uniform requires a set of seven matched graphics files for the required game actions: stand, shoot, melee, march, charge, double quick, and death. All unit graphics in CWBR are in *.tga format. The standard CWBR infantry graphics show 16 angles in each row of each figure with between 10 and 40 rows per file. In theory, each of the 2240 frames that go into one uniform set could be pixel edited. However this may be somewhat time consuming. Adam suggests a program called 3DStudio Max. There are probably alternative programs that will do the same job, but others will have to comment on that. Graphics files from other games can be imported provided that the angles go across and the frames go down. The correct values for these files need to be entered in the appropriate csv file but they should work. The full set of seven files must be imported or created.

CSV files - After you have made the set of 7 graphics files you need to get the new uniform in the game. This can be done on a per scenario basis by editing the set of four .csv files that specify which graphics files go with which action and which unit uses which uniform type(s). This is done fairly easily by using a spreadsheet program like Excel to keep everything lined up properly. The four files are: sprites.csv, unitsprites.csv, units.csv, and unitcommon.csv. Lets look at these in more detail.

Sprites.csv is the file that deals with the details of using the *.tga file as the source of the animation in the game. Each graphic file is assigned a name used by other files in the game. Other parameters dealing with the nuts and bolts of animation are in this file as well. The details of the column entries are shown in the Appendix.

unitcommon.csv is the file where the specific uniform graphics files are assigned to a unit class. Up to six uniforms can be assigned to a unit class, these will appear at random on the sprites in that unit. There is no limit on how many uniform classes may be declared. The name in each uniform column must match a name in the ‘type’ column of unitsprite.csv. See the Appendix for details.

units.csv is the primary OOB file. The column of interest for uniform modding is column G, ‘Class’. The entry here must match the ‘Class’ entry in unitcommon.csv and determines which uniform(s) are worn by which specific unit in the game.

Unitsprite.csv is the file where the seven names that were associated with the seven *.tga files in sprites.csv are linked to a uniform ‘type’, used in the file unitcommon.csv. The name in each column must match the name in the ‘Name’ column of sprites.csv. See Appendix for details.

Example of a simple uniform mod.

To demonstrate the process we will walk through the process of doing a simple uniform mod. For this example, we will insert a set of uniform files for the US Marine Corps battalion that was part of Porter’s Brigade. Please Note: I have not actually created a set of USMC uniform graphics files, so please do not ask me for them. Hopefully someone in the mod community will actually create this set of files.

The first step is to do the actual graphics editing. There are two strategies, pixel editing which is cheap but very tedious or 3D editing which requires one or more comparatively expensive program(s), but is much faster.

For the pixel editing example, we will make a simple change of color for uniform pants. The standard Union infantry uniform is a reasonable approximation of the USMC uniform of the day except that the Marines had white uniform pants. If you were doing this by pixel editing, these are the steps. First, in the graphics directory copy the file U_Stand.tga and name the copy USMC_Stand.tga. Repeat the process with these files: U_March.tga, U_Shoot.tga, U_Melee.tga, U_DblQuik.tga, U_Charge.tga, and U_Death.tga. When you are done, you will have seven USMC_*.tga files to edit.

Using pixel editing requires a program that can read and save *.tga files. There are a number that can do the job, that can be purchased either commercially or downloaded as shareware or freeware. Regardless of the program, open the USMC_Stand.tga file in the editor. In the first image, edit the pixels to change the color of the standard uniform pants from the existing blue to white. Repeat 2239 more times to convert the rest of the images in this and the other six USMC_*.tga files.

A somewhat less tedious method is to load the files into a 3D rendering program, do the editing there and then write out the edited files with the appropriate parameters. One program that will do this is a program called 3D Studio Max. The details of using these 3D programs is beyond my expertise, consult the ‘Modders Corner’ on the MMG discussion boards for pointers to books or websites describing this process in more detail. After the 3D models are created, the 2D graphics files need to be created or rendered from the 3D models. This must be done for all 7 file types.

After you have finished up creating or editing all seven of the graphics files, you need to do some editing of *.CSV files to get the game to recognize them. I will assume that you will be opening the *.CSV files in a spreadsheet program and will refer to row & column designations accordingly.

First open up the file sprites.csv, and move down to row 117. Insert seven (7) blank rows below. Next type in the name for each of the seven types and the matching name for the *.tga file. Next, enter the appropriate numbers for each of the animation columns. If you are using the same number of frames and rows as the base game, you can simply copy the data from the existing equivalent file. See the Appendix for details of the animation values. For the USMC example, the end results should look like this. Using this order will make things easier for other files.

USMC_March USMC_March.tga 64 64 16 15 3 -1 0 0
USMC_Stand USMC_Stand.tga 64 64 16 10 250 -1 0 0
USMC_Shoot USMC_Shoot.tga 64 64 16 40 10 35 0 0
USMC_DblQuik USMC_DblQuik.tga 64 64 16 15 4 -1 0 0
USMC_Charge USMC_Charge.tga 64 64 16 15 3.2 -1 0 0
USMC_Melee USMC_Melee.tga 64 64 16 30 10 20 0 0
USMC_Death USMC_Death.tga 64 64 16 15 4.5 -1 0 0

The values in column B must be the exact filenames of the graphics files. Save the file in *.csv format.

Next open up the file unitsprite.csv, enter a type name in column A, for this example, use USMC. Next enter the names from column A of sprites.csv into columns B-H. A useful trick is to copy the names in column A and then Paste Special/Transpose with the active cell in column B. The end result should look like this:

USMC USMC_March USMC_Stand USMC_Shoot USMC_DblQuik USMC_Charge USMC_Melee USMC_Death

The values in columns B-H must match the values in colum A of sprites.csv. Save this file in *.csv format and continue with the next file.

The third file to edit is unitcommon.csv in this file, scroll down and insert a row below row 15. Copy all of the information from the row above and paste it into the blank row. Next change the entry in column A, ‘Class’ to Infantry_USMC. Change the value in column F, ‘Uniform 1’ to read USMC and delete the value in column G. Leave all of the other columns alone unless you have created new sound files to match the uniform. When you are done, columns A through H should look like this:

Infantry_USMC 0 1.7 5 USMC

The name in column F must exactly match the text from column A of unitsprite.csv. If you have additional uniforms for this unit, they can be entered in columns G-K. Matching entries must be in the unisprite.csv. A maximum of six (6) uniforms is allowed per regiment and will be placed on the individual sprites at random. Save this file in *.csv format and continue with the final file.

The last file to edit is units.csv, here move down to row 50 and over to column G ‘Class’ and enter Infantry_USMC which is the exact text from column A of unitcommon.csv. Save in *.csv format.

If you have done things correctly, the new uniform will show up in on the USMC battalion in Porters brigade.