This thread is being created to track my progress in a quest to Mod Civ4's Heads Up Display -- the user Interface / HUD. Please feel free to post comments/suggestions/questions/encouragements, as this is an ongoing project and feedback will be greatly welcomed.
OK, SO i've been spending a lot of time on this, and here are my notes I've taken as I've gone along.
At first, just to see that the HUD *was* moddable, I replaced /resource/Civ4/HUD/HUD_bottom.tga with a version that was just solid red.
First lesson: HUD Changes require a Civ4 restart to take effect.
second lesson: this was VERy visible in the game, giving me the courage to continue.
I decided on a new color. Cyan was the pick, with a somewhat darker-than-normal shade so it wouldn't look ungodly bright.
I then had some Photoshop learning to do. After a while I determined the best way to change the color without ruining the shading was through PS's Hue/Saturation Modify option. I looke dup the HSB for both the original color and the cyan i was replacing it with, and calculated the difference. This difference was the number plugged in to the HSB sliders to make the shift. After testing on a visible file, I saved this adjustment so I could just load it on every file without adjusting sliders every time.
For the record: HSD = Hue/Saturation/Brightness(lightness).
Side-track:
There are several ways to get a color on a computer. the most popular is RGB - the Red Green Blue values. Another is CMYK, which is more common when printing the image is important, as CMYK is what printers use. CMYK is CYan/Magenta/Yellow/blacK -- the colors of ink that make up the printed color.
The final method is more complicated - Hue, Saturation, Brightness. If you plot the color wheel on a circle, and shade the results from the inside out (Center Point being pure white, outside arc being pure color) you get every shade of color. Brightness affects this by dimming the Pure color. Hue is measured in degrees, Saturation in % distance from center, Brightness in ... something. % brightness of original color maybe? Anyway, if you pick the radius of the color, then Saturation, and shift the brightness, you get a color (incidentally it can be converted to RGB easily, the advantage is that it's easy to determine the mathematical difference in colors with HSB).
For example, the brighter shade of tan used in Civ4's original HUD Scheme is RGB: 249/223/191. It is HSB: 33/23/98.
The Cyan I was replacing it with was RGB 0/118/163. HSB 197/100/64.
The difference in RGB isn't easily adjustable... it requires finding a formula to shift each shade level. HSB accounts for that... the DIFFERENCE in HSB is +164/+77/-34. Plug these numbers directly into the hue/Sat sliders and presto! you've shifted the color, shading entirely intact! Now you can save this change to a file, and load it for every file you need to adjust, making the process super quick and simple!
I proceeded to run this filter on every file in /HUD. the result was pretty clear, a very different HUD coloration but using the same files! In the main game screen it looked awesome... with a few minor things i didn't notice until later. However, once I entered a City screen my heart sank a little... the City Header was still tan, but the rest of the screen was the new blue... what gives?
Turns out that the HUD pulls files from all THREE /Resource/Civ4 folders. The city screen files were found in /Civ4, but affected other parts of the game (loading screens' Slider bars, for example) as well. It became clear at this point that you cannot just modify the in-game HUD, you gotta modify ALL of the HUD.
At this point my research turned towards the elusive /Resource/Theme folder. This folder contains .thm files which were entirely greek to me at first. It turns out that Firaxis chose to use a 3rd-party tool to build their HUD, and these .thm files are like Markup Language files to describe the HUD layout. Best yet, they included the image file names to load in each spot! I could find all of the relevant IN-game .thm files and modify them to use copies of the relevant files so that the changes could be made to only affect in-game. OR, I could look further and see if there was a way to make a sort of switch, so the user (or game itself) could /change/ the theme on startup. Both methods had clear advantages and disadvantages.
Sadly, upon the end of tonight's research, I have concluded that the path to the Theme is hardcoded into the game itself. I cannot find any mention of the Theme in any python or XML file, nor in the .ini... This has the following impacts:
Any HUD change will affect ALL games, since it is not a CustomAsset subfolder. Mod-specific custom HUDs will not be possible (for instance, for your space-based Mod you can't do a space-looking HUD, because it will force the user to change the HUD for all their other games to that as well... while a mod-specific custom HUD would be awesome for flavor reasons, it just can't be done)
So the path to now follow is:
- Very carefully examine the .thm files to understand their markup language ( to my knowledge this is not documented anywhere, the 3rd party utility they used is fairly new).
- Determine all of the .thm files used during actual gameplay
- Pick a single folder for in-game HUDs to draw their graphics from. (likely /Resource/Civ4/HUD)
- Find all references to files NOT in that directory from the in-game HUD .thm files found in step 2.
- Copy these files to the HUD directory, and change the .thm reference accordingly.
- Begin editing the HUD files, so that gameplay interface is graphically different.
- Test, Test, TEST
A few notes to sign off this post:
1) I apologize, I'm long-winded. Please bear with me and you'll eventually figure out where I'm going =)
2) For a user to download and implement a HUD mod, they will be forced to mod the HUD for all of their games, until Firaxis finds it in their hearts to let us add new Themes, or put it in CustomAssets, or something.
3) In order to download a HUD mod, the user will need: First, back up old HUD (25 megs), basically make a safe copy of the entire/Resource Directory. Second, Replace all of the .thm Theme files. Third, replace all of the /Resource/Civ4/HUD images (and any other images that were changed by the HUD mod creator)
4) Restart Civ4 for the changes to take place.
OK, SO i've been spending a lot of time on this, and here are my notes I've taken as I've gone along.
At first, just to see that the HUD *was* moddable, I replaced /resource/Civ4/HUD/HUD_bottom.tga with a version that was just solid red.
First lesson: HUD Changes require a Civ4 restart to take effect.
second lesson: this was VERy visible in the game, giving me the courage to continue.
I decided on a new color. Cyan was the pick, with a somewhat darker-than-normal shade so it wouldn't look ungodly bright.
I then had some Photoshop learning to do. After a while I determined the best way to change the color without ruining the shading was through PS's Hue/Saturation Modify option. I looke dup the HSB for both the original color and the cyan i was replacing it with, and calculated the difference. This difference was the number plugged in to the HSB sliders to make the shift. After testing on a visible file, I saved this adjustment so I could just load it on every file without adjusting sliders every time.
For the record: HSD = Hue/Saturation/Brightness(lightness).
Side-track:
There are several ways to get a color on a computer. the most popular is RGB - the Red Green Blue values. Another is CMYK, which is more common when printing the image is important, as CMYK is what printers use. CMYK is CYan/Magenta/Yellow/blacK -- the colors of ink that make up the printed color.
The final method is more complicated - Hue, Saturation, Brightness. If you plot the color wheel on a circle, and shade the results from the inside out (Center Point being pure white, outside arc being pure color) you get every shade of color. Brightness affects this by dimming the Pure color. Hue is measured in degrees, Saturation in % distance from center, Brightness in ... something. % brightness of original color maybe? Anyway, if you pick the radius of the color, then Saturation, and shift the brightness, you get a color (incidentally it can be converted to RGB easily, the advantage is that it's easy to determine the mathematical difference in colors with HSB).
For example, the brighter shade of tan used in Civ4's original HUD Scheme is RGB: 249/223/191. It is HSB: 33/23/98.
The Cyan I was replacing it with was RGB 0/118/163. HSB 197/100/64.
The difference in RGB isn't easily adjustable... it requires finding a formula to shift each shade level. HSB accounts for that... the DIFFERENCE in HSB is +164/+77/-34. Plug these numbers directly into the hue/Sat sliders and presto! you've shifted the color, shading entirely intact! Now you can save this change to a file, and load it for every file you need to adjust, making the process super quick and simple!
I proceeded to run this filter on every file in /HUD. the result was pretty clear, a very different HUD coloration but using the same files! In the main game screen it looked awesome... with a few minor things i didn't notice until later. However, once I entered a City screen my heart sank a little... the City Header was still tan, but the rest of the screen was the new blue... what gives?
Turns out that the HUD pulls files from all THREE /Resource/Civ4 folders. The city screen files were found in /Civ4, but affected other parts of the game (loading screens' Slider bars, for example) as well. It became clear at this point that you cannot just modify the in-game HUD, you gotta modify ALL of the HUD.
At this point my research turned towards the elusive /Resource/Theme folder. This folder contains .thm files which were entirely greek to me at first. It turns out that Firaxis chose to use a 3rd-party tool to build their HUD, and these .thm files are like Markup Language files to describe the HUD layout. Best yet, they included the image file names to load in each spot! I could find all of the relevant IN-game .thm files and modify them to use copies of the relevant files so that the changes could be made to only affect in-game. OR, I could look further and see if there was a way to make a sort of switch, so the user (or game itself) could /change/ the theme on startup. Both methods had clear advantages and disadvantages.
Sadly, upon the end of tonight's research, I have concluded that the path to the Theme is hardcoded into the game itself. I cannot find any mention of the Theme in any python or XML file, nor in the .ini... This has the following impacts:
Any HUD change will affect ALL games, since it is not a CustomAsset subfolder. Mod-specific custom HUDs will not be possible (for instance, for your space-based Mod you can't do a space-looking HUD, because it will force the user to change the HUD for all their other games to that as well... while a mod-specific custom HUD would be awesome for flavor reasons, it just can't be done)
So the path to now follow is:
- Very carefully examine the .thm files to understand their markup language ( to my knowledge this is not documented anywhere, the 3rd party utility they used is fairly new).
- Determine all of the .thm files used during actual gameplay
- Pick a single folder for in-game HUDs to draw their graphics from. (likely /Resource/Civ4/HUD)
- Find all references to files NOT in that directory from the in-game HUD .thm files found in step 2.
- Copy these files to the HUD directory, and change the .thm reference accordingly.
- Begin editing the HUD files, so that gameplay interface is graphically different.
- Test, Test, TEST
A few notes to sign off this post:
1) I apologize, I'm long-winded. Please bear with me and you'll eventually figure out where I'm going =)
2) For a user to download and implement a HUD mod, they will be forced to mod the HUD for all of their games, until Firaxis finds it in their hearts to let us add new Themes, or put it in CustomAssets, or something.
3) In order to download a HUD mod, the user will need: First, back up old HUD (25 megs), basically make a safe copy of the entire/Resource Directory. Second, Replace all of the .thm Theme files. Third, replace all of the /Resource/Civ4/HUD images (and any other images that were changed by the HUD mod creator)
4) Restart Civ4 for the changes to take place.