View Full Version : changing unit colors

06-01-2001, 13:14
i've been doing a little study re .bif files and some other things and i believe you can alter the colors of units.

from what i can tell so far there are 2, possibly 3 files that are involved in each unit type. there is an .lbm file, a .bif file and a .txt file. the .lbm file is a base graphic file for all units of that type. since there are different armies using different colors they didnt make 8 different cav files, they just made one base cav file with all the different looks that a cav unit might have, its different facings and so on. then, when you pick your color and your enemies pick their colors the base unit is loaded in and colored for each person's army color. this is done with either the .bif or the .txt. i believe it's the .bif and i believe the .txt file is for telling the .lbm file which mini-graphic to display for which situation.

ok, this is just speculation and i've not played with it at all, but apparently a .bif file is a 'raw' file. it has no 'header' like a normal graphic file; it's just raw data. a header is that part of a graphic file that has information about the file itself and isnt part of the picture, it's the parameters like size and shape and so on, sort of a 'this is what this file is all about'.

if you pull up the .lbm in a paint program you'll see that it is a composite pic of lots of smaller images. there is a .lbm file for each unit type and each of these files for the units has many different looks of that unit: it's facing forward, backwards, sideways and so on. but they are all colored with the same colors and not the different banner colors. so, somehow the program has to be told to change certain colors so that it fits your army's color scheme.

now, a bif file actually has 2 parts, the raw data file and a text file. they are not in the same file and the text file is actually the header for the raw data file. therefore, it's my belief that that's how they are entering the color changes to units, with the .bif and possibly the .txt file.

these files are found in totalwar\textures\men\(diff units).

if anyone feels so inclined to modify these please be warned: i am NOT claiming this is the way this works for certain. i could well be wrong, but it appears that it might be something like what i've stated above.

also, you can modify the .lbm graphic file and thus change the look of the base unit, but there are possible drawbacks to this and i'd recommend being very careful if you do. before doing any of this make a backup of any file you may plan to alter, cause it could all blow up. also, and i'm really not sure about this one, but there appear to be in the .lbm files certain areas of the mini-images that are 'blanked out'....possibly, and speculation says that this could be a sort of 'reserved' area of the image. also, if you do alter the .lbm file, remember, this is a base image(s) and other colors are added to specific locations within that image and if you change how the image looks the color is probably going to still be added to those specific locations and end up looking like crap....possibly.

the .txt file may also be the location data of where the base image gets colored. i'm not sure.

so, do this at your own risk. i'm not claiming i have this right here and if you do this, you do it on your own. you come crying to me that i wrecked your machine or your game or your files and i'll just kinda shake my head and roll my eyes at you ;)


06-01-2001, 17:03
Good lad. Now plz make a smaller post so l can read it please. I m just tooo bored to read all that thing :P

Don't use only honour, use theforce, too.
Enter the Darkside...

06-05-2001, 14:16
the text file might also be for telling the .bif colors where to paint. still not sure of this.


06-06-2001, 03:47
Thanks for the info, Kraellin! I've been doing some mucking myself, so here are some of my theories and tests.

From what I can tell, the raw prat of the BIF is the graphic information for the animations. Some of the Text information may also tell it which sequences represent which actions in the game - ie. Frames 20-26 = Walk Left. 27 - 31 = Run Left..... The LBM has the original graphic themselves. Whether or not the BIF references the LBM, or if it already has the information stored internally is unknown. Also, the text could be used (as you noticed) for color control, since some colors are changable - like the soldiers' flag, for instance. The tall banners are separate graphics, but the little square flags are part of the sprite. The text could indicate which colors get swapped.

The LBM is made up of every frame of action for each sprite (soldier), in in five facings: up, up/right diagonal, right, down/right diagonal, and down. Any left-facing actions are just the right-facing actions, mirrored. I have redrawn a number of soldiers (Total War:Fantasy set), but have not been able to get them showing up in-game. I've had in-game units turn into static and silhouettes, but nothing consistent.

The images are on a background, and I assume part of the text's job is to tell the sytem which color is transparent. It would be great if CA could release a BIFfer, which recreates the BIF using an LBM that you modified. The biggest thing to remember is that the new unit sprites must fit into the same sized rectangles as the original, so that you don't get people clipped off at the edges, or overlapping sprites.

Make any sense? Now, how can we put it to practical use?

-- B)

[This message has been edited by BanzaiZAP (edited 06-05-2001).]

06-07-2001, 09:04
BanzaiZAP, Kraellin.

How exactly are you guys going about opening the .lbm files. I remember trying a while ago, just got a weird response from the programme then the blue screen of death.

06-07-2001, 20:15
well, i use paint shop pro 4.12 (psp). psp can read a number of file types and convert files back and forth between 2 types. it's a decent shareware program.


06-08-2001, 01:51
I have the mixed blessing of being a computer graphics "professional" so I have nifty tools like PhotoShop 6 and DeBabelizer and those kinds of toys. That's why I was so surprised that none of my programs could crack the BIF!

-- B)

06-08-2001, 05:02
yeah, i tried some of the standard file readers too. then i decided to do a search on the web and found some interesting sites that explain what a .bif file is. you can also find some .bif readers, but since you also need that second file it gets kinda goofy.

there also seems to be some confusion about which file is actually the .bif and which is the header file. one place will call the header file the .bif and the raw file a .raw while another place will call it the other way around or even name them slightly differently. this is part of the difficulty in reading the stw .bif's also. some of the .bif's seem to have header files and some dont. and since the header is basically what tells you what the raw data means, we're kinda fumbling around in the dark.

on top of that, we dont even know if ca used anything even resembling what we've been talking about. so, it boils down to a hunt and peck kind of thing.

if i were going to track this further, i'd go into the file with the units and start altering the .bif of one unit type and see what i could change when the program ran. it really shldnt be that tough, with a little logic, to figure out some of the basics. if that didnt work, then i'd try altering the accompanying .txt files and see if that produced any change. it's really gonna be a trial and error sort of thing, i'm thinking.