1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Modding the HUD -- a diary/discussion

Discussion in 'Civ4 - Creation & Customization' started by Rayanth, Nov 3, 2005.

  1. dutchking

    dutchking Deity

    Joined:
    Apr 30, 2007
    Messages:
    3,317
    I don't think anyones done it Gaius, I was a little surprised to see you posting here. ;) Well that question would be aimed at a coder, 3 files directories and contents would need to be changed era to era. You may have problems with it, because the HUD loads with the start of the game.
     
  2. Gaius Octavius

    Gaius Octavius Deity

    Joined:
    Jul 28, 2006
    Messages:
    4,016
    Yes, but the interface is redrawn every 250 ms so I suppose you could override it somehow... I'd have to think.
     
  3. dutchking

    dutchking Deity

    Joined:
    Apr 30, 2007
    Messages:
    3,317
    Good luck, you'll get some screwy spit in the process.

    If you need any answers to questions PM me.
     
  4. Grey Fox

    Grey Fox Master of Points

    Joined:
    Dec 19, 2001
    Messages:
    8,726
    Gender:
    Male
    Location:
    Sweden
    I've made a new interface for the Main Interface in the relevant .py file. I just made new panels with other .dds files. I do a check for what Civ the player is playing as and change the color and some images (like showing the leaders face) of the interface depending on the active Civ and Leader.

    I could easily do the same but for eras instead. Just do a check for what era it is and change the image accordingly. For example:

    Code:
    iEra = CyGame().getActivePlayer().getCurrentEra()
    
    screen.addPanel("InterfaceTopLeft", u"",u"", True, False,   4,yResolution +4, 256, 128,PanelStyles.PANEL_STYLE_EMPTY)
    screen.addDDSGFC( "InterfaceTopLeft", 'Art/Interface/Screens/MainScreen/[COLOR=Blue]Topleft_'+str(iEra)+'.dds'[/COLOR], 1, 1, 256, 128, WidgetTypes.WIDGET_GENERAL, -1, -1 )
    screen.hide( "InterfaceTopLeft" )
    
    And then have an image for every era with the name Topleft_#.dds where # is that era's index.

    You can even update the interface on every frame by calling on the screen in your onUpdate() event function in your eventManager.

    Code:
    def onUpdate(self, argsList):
         'Called every frame'
         self.parent.onUpdate(self, argsList)
         fDeltaTime = argsList[0]
         global TARGETING
         global CLICKED_ON_PLOT
         global UNLOADING
                
         if not gc.getGame().GetWorldBuilderMode():
              screen = CyGInterfaceScreen( "MainInterface", MAIN_INTERFACE )
              screen.hide( "InterfaceDamageOverlay" )
              screen.hide( "DamageOverlayTitle" )
    
              mousePos = CyInterface().getMousePos()
              overlayX = mousePos.x+20
              overlayY = mousePos.y+10
    
    I use this to update the stars you see in the screenshots below, and for the Damage Overlay seen, to follow the cursor.
     

    Attached Files:

  5. dutchking

    dutchking Deity

    Joined:
    Apr 30, 2007
    Messages:
    3,317
    BRA-VO!
    Great job!
     
  6. Gaius Octavius

    Gaius Octavius Deity

    Joined:
    Jul 28, 2006
    Messages:
    4,016
    I agree, bravo, Grey Fox! That's precisely along the lines I was thinking. :)

    One other question: I noticed in those screenshots that you have units with extra elements, such as "fuel" and "health." How did you manage that? (SDK work, I know...) I'm curious because I might be able to use that for the Quantitative Resources project, particularly the oil counter I am working on. Is there anyplace I can download the source code? :mischief:
     
  7. Grey Fox

    Grey Fox Master of Points

    Joined:
    Dec 19, 2001
    Messages:
    8,726
    Gender:
    Male
    Location:
    Sweden
    I will share the code once it's stable enough.

    But while I am here with internet access, I might make a modcomp with the fuel part.

    The health is basically the old strength attribute just renamed. The reason I use it as health (with a new icon) is cause I don't use it all for combat anymore (I got a completely new combat system in place).

    And the ammo system is a bit harder to make into a modcomp since it's part of my new combat system.

    So I'll see about doing a fuel modcomp.
     
  8. Gaius Octavius

    Gaius Octavius Deity

    Joined:
    Jul 28, 2006
    Messages:
    4,016
    Good, it would be interesting to see how our two different systems compare. :D From the screenshot, I take it that you've made it unit-specific, so that each army has its own supplies lines and fuel reserve. The way I plan to do it in QR, based on Duke176's oil counter, it's a civ-wide reserve, so that movement takes fuel from a national stockpile.

    I don't know how you've arranged it exactly, but I'm curious as to how you addressed the resupply and micromanagement issues. Is there just a set range based on borders and cities, where a unit is "in supply", and if it leaves that area, it's out of supply? Or is it deducted per turn? Anyways, looks to be very good stuff. :D
     
  9. Grey Fox

    Grey Fox Master of Points

    Joined:
    Dec 19, 2001
    Messages:
    8,726
    Gender:
    Male
    Location:
    Sweden
    Land units and sea units lose 1 fuel per turn, and 1 fuel per tile moved. Air units lose 2 fuel per turn, and 1 fuel per tile moved. Sea units are the same as land units except for submerged submarines that lose 5 fuel per turn. (They start surfaced and are not invisible like that)

    Infantry use the same function as other land units, Fuel is just renamed Rations in the Hud.

    Units can resupply in the appropriate city type, Land units in cities and bases, air units in airports and sea units in ports. APCs can also resupply all unit types (with the resupply mission which resupplies all units in the 4 directions N, S, E and W. And also, all units situated next to the APC at beginning of turn gets resupplied automatically)

    Air units and sea units with 0 Fuel at beginning of turn falls from the sky or sink. Land units just can't move.
     
  10. Mattastic

    Mattastic Warlord

    Joined:
    Jan 4, 2006
    Messages:
    101
    Location:
    Cheltenham, UK
    Wow! I'm pretty impressed! I thought I was the only one working on a complex HUD, but apparently I am mistaken. I must hurry and finish mine before someone does something more impressive. :p
     
  11. Mattastic

    Mattastic Warlord

    Joined:
    Jan 4, 2006
    Messages:
    101
    Location:
    Cheltenham, UK
    Well, I was going to wait until it was complete to show this, but I'm so close to being finished that I might as well post an example. This is what I've managed to achieve with a little knowledge of the thm files and python, a few games with good graphics to steal, photoshop and a lot of patience.

    http://i270.photobucket.com/albums/jj106/The_Mattastic/CityScreen.jpg

    I'm pretty fond of the progress bars. I think I've done a good job. :)
     
  12. Grey Fox

    Grey Fox Master of Points

    Joined:
    Dec 19, 2001
    Messages:
    8,726
    Gender:
    Male
    Location:
    Sweden
    Yeah that's looking pretty sweet actually. :)
     
  13. asioasioasio

    asioasioasio Fallout Scrubber

    Joined:
    Mar 4, 2006
    Messages:
    3,058
    Location:
    Poland, EU
    wow real impressive
     
  14. dutchking

    dutchking Deity

    Joined:
    Apr 30, 2007
    Messages:
    3,317
    GREAT JOB!!!
    (10 chars)
     
  15. Grey Fox

    Grey Fox Master of Points

    Joined:
    Dec 19, 2001
    Messages:
    8,726
    Gender:
    Male
    Location:
    Sweden
    That's basically what I've done in the modcomp I promised. No supply lines or anything, but that can be added easily through python or additional changes in the SDK.

    Download it here (Unit Fuel Mod)
     
  16. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Great job @ Mattastic!!!

    I came to this thread because I am working on a mod for Diplomacy games, and the main title image is green, dark brown, and gold. Which just so happen to be the same colors used in that image you posted. Would you mind if I used it for our mod? I'll give credit obviously, because that looks fantastic!

    I just realized how long ago he posted that, and that he didn't seem to have uploaded anything. :(

    Well back to the drawing board.
     
  17. Rayanth

    Rayanth Prince

    Joined:
    Sep 16, 2005
    Messages:
    303
    Good evening everyone!

    I am so incredibly glad to see that my old project on this has spawned enough interest to become a core part of many of the great Civ4 Mods out there.

    Sadly I haven't touched Civ4 in quite some time - I've fiddled a little here and there when the new expansions were released, but thanks to numerous changes in personal life, time is just so hard to come by.

    I managed to find a copy of Civ Revolution for Xbox 360 recently, and started thinking of this old HUD-modding project I had started back in the old early days of the game, and wanted to touch base with everyone who had seen this and thanked me and took my work a step further.

    First, my apologies for dropping the whole thing without warning. When I had originally started this project, I was a store manager at EBGames/GameStop. Losing that job caused a flurry of activites that, two years later, has resulted in my current occupation in the United States Air Force as an F-15 Mechanic.

    Unfortunately, my new career is infinitely time consuming. But my love of gaming has never died down, and I intend to take Civ4 off the shelf, dust it off a bit and give it another go. Between two MMO's that I currently play, and a handful of console games as well, though, I cannot say that I'll be able to do any sort of modding work.

    I wish everyone luck in their modding endeavors, and perhaps some day in Civ5 I'll find a way to get elbows deep in code again :D

    -- Rayanth
     
  18. xienwolf

    xienwolf Deity

    Joined:
    Oct 4, 2007
    Messages:
    10,589
    Location:
    Location! Location!

Share This Page