Modding the HUD -- a diary/discussion

The clear interface is more like what I'd like to achieve. Is it possible right now to have it look a little more opaque and not entirely invisible, though? So I can see the shading in the interface?
 
dannyevilcat said:
The clear interface is more like what I'd like to achieve. Is it possible right now to have it look a little more opaque and not entirely invisible, though? So I can see the shading in the interface?

change the RGB values to a desired shade color (0,0,0 for white, 255,255,255 for black) and the 4th value to a very low number but not quite 0.

anything other than black will show the interface shading well, white will show it best but may make the interface look kind of milky.

The 4th value being 0 makes it entirely invisible... setting it to something like maybe 26 will make it only 10% opaque... enough to have some color, but barely visible.

The value setup is R,G,B,A -- RGB make up a color (Red + Blue + Green), A is the Alpha channel, or how transparent it is. 0 is completely invisible, 255 is completely solid. Anything in between may be used. (divide by 255 for a rough estimate of the % opacity)

All of this is line 204 in (Civ4Main)/Resource/Themes/Civ4/Civ4Theme_Common.thm
 
scaleform said:
Civ IV UI Mod Tip:
You can attach custom GFC styles to UI elements in the Civ IV python script using the SetStyle(control_name, style_name) function. This will allow you to customize specific controls, a feature you will definitely enjoy!

Been really busy lately but decided to attack this again. Doing some research, it doesn't look as easy as it sounded. That remains to be seen.

The function referenced by scaleform is imported from the game itself. this means I can't peek at the code to see how it works... meaning I have to use existing examples to see how to work it on my own:

screen.setStyle( "InterfaceCenterRightBackgroundWidget", "Panel_City_Right_Style" )

is used to set the Style for the panel on the city screen's center right. As you can see it is referencing the panel by a name (InterfaceCenterRightBackgroundWidget) and associating a pre-defined Style with it (Panel_City_Right_Style) -- this style is defined in the .thm Theme files i've played around with since the beginning of this diary.

the problem is, it appears the only way to override these is to use a new .setStyle to override the existing one in the python code, or edit the existing .setStyle. Why is is this a problem? Well, the second argument in every example, is a pre-defined Style from the theme files. The objective of using python to override these, was to avoid havign to edit the Theme files to begin with.

All hope is NOT lost, however! It is still possible to retain the original theme, and modify it based on a MOD, using the above fucntion! (It'll take a lot of work though!)

Here's the basic principle:

Create a whole new .theme file. Mimic the themes in the existing one, with new NAMES for the styles (ie, instead of Panel_City_Right_Style, copy that definition and change the name to Panel_City_Right_Style_MyMOD)

After you've created all of the CUSTOM themes, change the file
C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Resource\Themes\Civ4\Civ4Theme.thm

and ADD an include, that includes the file with your custom themes.

Now, in your Mod, edit the associated python scripts and change each required instance of screen.setStyle to use the new Style definition. This SHOULD change them when loading your mod, to the new one.

Caveats:
- Your end-user will still need to manually copy the additional .thm file to their /resources directory, and edit their Civ4Theme.thm to include it.
- The associated .setScreen calls are all OVER the place. the majority are in CvMainInterface.py, but there are some in CvOptionsScreen.py and CvTechSplashScreen.py as well -- in total, an estimated 70 or so lines to change.


However, the directions for doing that are fairly simple, have NO effect on the original game HUD if done properly, and will load your new theme ONLY when your mod is loaded! (since it is set by your mod's custom version of the python scripts)

You COULD theoretically make the HUD change by era! This is UNTESTED, but it could be possible to insert a new series of screen.setStyle in whatever portion of the code determines when a new era has happened. This sort of middle-of-game change (as well as testing the Mod-set Theme) is my next focus.
 
MSTK said:
Ah hah. Stone-age themed interface during ancient era, and then high-end control panels during modern era. Imagine the implications!

Precisely what i was thinking... a better visual indication of what Era you are in, and sort of a neat side-effect of advancing =) The itnerface itself advances with you!

Now, whether it is *possible* remains to be seen...
 
IT IS POSSIBLE!!!!

With a lot of hypothesis an da little testing, I have determined that it IS Possible to dynamically change the HUD while the game is running, triggered by whatever event you want!!!

I tested this by creating a new Theme file that overrode an existing setting. i then added a line of code to the function that is called when a player's turn ends (which i thought was when End Turn button is clicked) that called a change to setStyle that told it to use the new, overriden style.

It WORKED

Not quite how i expected... however I can trace down the error that happened (it went clear instead of blue) to an issue with my method of overriding the Theme, not with the code that set it...

This is VERY exciting, folks... this means that you will be able to DYNAMICALLY change the very look of the HUD, heck even the *layout* of the HUD, whenever you feel like it during the course of your mod! There could be no better way to help your user get into the feeling of your mod than changing the Interface to match the theme.

I will be fully researching this path of development for the near future -- most of that research will be returning to deciphering the structure of the Theme files so I know how to properly override certain portions.
 
I have succeeded in fixing the bug I had created -- it was MUCH simpler than i anticipated. I still must learn the detailed structure of these theme files, however at least for now I can say I have a working example of a dynamic event-driven mod-specific HUD change =)

Note: there is still one very minor change users would have to make to their Resources folder, to make this work. however the change is incredibly minor, and if done PROPERLY does not affect any other mod, or the core game. All that's required is that you put all of your specific hud changes in your OWN .thm file, and the user add a path to \Resource\Themes\Civ4\Civ4Theme.thm that includes your mod's .thm file. After that the rest can be done in the python files for your mod!

Note: the actual process of making the hud changeable dynamically is both simple and complicated at the same time. Adding the chaneg to the python is simple -- properly formatting the .thm file is somewhat more difficult. That is, still, my current avenue of research.
 
Man this thread excites me! Well done Rayanth, keep up the goood work and fight the good fight for us Civ modders. :D
 
Rayanth said:
This is VERY exciting, folks... this means that you will be able to DYNAMICALLY change the very look of the HUD, heck even the *layout* of the HUD, whenever you feel like it during the course of your mod! There could be no better way to help your user get into the feeling of your mod than changing the Interface to match the theme.

Great news! :goodjob:

This means we could do all sorts of polishing ... like, changing the HUD when you enter peace, war, a golden age, or a new era. :)
 
I think the real important one is having mod specific HUDs though. That is certainly something I would use in my mod if it's workable.
 
Has anyone noticed that the patch screwed with all the interface changes? Did this happen to anyone else? I might have accidently done it.
 
Has everyone abandoned this idea? Is it now possible with the SDK?

I only ressurect the corpse because a Mod specific GUI would PHENOMENAL for immersing the player in the world.
 
I have managed to make siginificant changes to the interface not using styles, but instead replacing the panels with .DDS files.

Unfortunetly, while most of the stanard .DDS files are available, not all are. This means it's quite tricky to make a template, as it wouldn't function the same as the normal interface.



(Still a WIP)
 
Very very nice, TGA - that's exactly the sort of look we could use.

When you've got a spare moment, do you think you could explain how you did that a little further?

Thanks a lot.
 
The Great Apple said:
Tiny bit short of moments at the moment, but will write when I have a moment.

I know you dont have many moments, but maybe you could take a moment from working on Interstellar Colonization ( :p ) and write how you did that?
 
Trip said:
Great work Rayanth, this is the kind of thing that people will be very thankful for later.

Rayanth. I agree completely. I am very grateful for this info!
 
I thought I would revive this slightly old discussion by asking the obvious: has anyone ever succeeded in making the era-specific UI that was mentioned above a reality? This is something we were planning on doing for WoL, back when that project was active, but I'd like to continue with it.
 
Top Bottom