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

[MODCOMP] Upgradeable Buildings

Discussion in 'Civ4 - Mod Components' started by TheLopez, Sep 14, 2006.

  1. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Upgradeable Buildings
    By: TheLopez

    Last Updated 11/08/06

    Version: 0.3w
    Patch Compatibility: Warlords v2.0.8.0
    MP Compatible: ?
    Download Mod v0.3w

    Version: 0.2
    Patch Compatibility: v1.61
    MP Compatible: ?
    Download Mod v0.2


    Description:
    This mod implements the concept of upgradeable buildings and buildings that
    when constructed obsolete a building in the Installation. The building upgrade
    part of the mod works like the unit upgrade system in regards to how the
    upgrade chain is defined and buildings are upgraded. As a proof of concept the
    Barracks have been broken up into a base building that only gives 1 experience
    point and two building upgrades that give the rest of the experience points
    that the original Barracks gave.

    The second part of the mod allows for buildings when constructed to obsolete
    one or more buildings. For example the forge can be obsoleted when a factory is
    built.

    Screenshots:
    Spoiler :





    Installation Instructions:

    1) Unzip this into the "civ4_install_folder\Mods\" folder.
    2) Open the CivilizationIV.ini configuration file
    3) Change the Mod line to read: Mod = Mods\Upgradeable Buildings
    4) Load the game.
    5) Then play as normal.

    -----Game Play-----
    Spoiler :

    - Split up the barracks building into three buildings: Barracks, Barracks II
    and Barracks III. Barracks have been changed to only give 1xp instead of 4xp
    and they upgrade to Barracks II.

    - Factories now obsolete forges.

    - Information for upgraded buildings includes the information from the base
    buildings. For instance if barracks are upgraded to Barracks III then the text
    displayed for them would be "New Land Units Receive +4 Experience Points" not
    "New Land Units Receive +2 Experience Points".


    -----Buildings-----
    Spoiler :

    Barracks II:
    - Requires: Construction Tech
    - Costs: 60
    - Abilities:
    - New Land Units Receive +1 Experience Points

    Barracks III:
    - Requires: Military Tradition Tech
    - Costs: 60
    - Abilities:
    - New Land Units Receive +2 Experience Points


    -----Notes to Modmakers-----

    If you want to use Upgradeable Buildings in your mod I have tried to make
    things as easy as possible for you. In the Python files I have added
    # < Upgradeable Buildings Start > and # < Upgradeable Buildings End > in all of
    the places that I have made changes to the original files.

    In the SDK files I have added // < Upgradeable Buildings Start > and
    // < Upgradeable Buildings End > in all of the places that I have made changes
    to the original files.

    In the XML files modified sections are enclosed by:
    <!-- -->
    <!-- Upgradeable Buildings Start -->
    <!-- -->
    and
    <!-- -->
    <!-- Upgradeable Buildings End -->
    <!-- -->

    -----Version Information-----

    -----v0.2------

    - Fixed the issue causing the game to throw C++ exceptions whenever a wonder is
    built. As it turns out the CvCity::hasBuilding interface cannot be changed
    because there are calls to the method from the exe file. Reported by
    Ploeperpengel.

    - Added the code to display the missing information for several of the values
    that buildings could have. Reported by Ploeperpengel.

    - Changed the temple buildings for each religion to upgrade to cathedrals, they
    still require n number of temples though.

    Spoiler :

    -----v0.1------

    - Setup the Upgradeable Buildings mod infrastructure

    - Added the new tags and code behind the tags to add building upgrade support.

    - Added the new tags and code behind the tags to allow the obsoleting of
    buildings when a building is constructed.

    - Updated the CIV4BuildingInfos.xml file to use the new tags by splitting up
    the amount of experience given by the barracks building into three barracks
    buildings. Also updated the factory definition so when it is built it will
    make the forge obsolete.

    - Updated the building text display code in the SDK so when a building is
    upgraded the information from the base buildings are still shown.


    -----===Credits & Thanks===-----

    - Exavier
    [TAB]Composite Mod - readme.txt format

    - Snaitf
    [TAB]For originally proposing this idea

    - Testers
    [TAB]Ploeperpengel and Aussie_Lurker
    [TAB]
     
  2. Jeckel

    Jeckel Great Reverend

    Joined:
    Nov 16, 2005
    Messages:
    1,637
    Location:
    Peoria, IL
    Ooo, a good oldy finally done right, right on TheLopez. :D
     
  3. Dom Pedro II

    Dom Pedro II Modder For Life

    Joined:
    Apr 3, 2002
    Messages:
    6,811
    Location:
    Exit 16, New Jersey
    *shakes his fist*

    I've just spent the night trying to integrate all your other stuff into one mod! Now I have to add something else...

    But a very nice addition indeed :) Keep up the good work! :goodjob:
     
  4. Impaler[WrG]

    Impaler[WrG] Civ4:Col UI programmer

    Joined:
    Dec 5, 2005
    Messages:
    1,750
    Location:
    Vallejo, California
    I've looked at the initial code you sent and I think it could be speeded up by including a boolen array in the City to handle the obsoleted Buildings. That would allow the CvCity::canConstruct function to run much faster. I'll see what I can do with it.
     
  5. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Why would I want to do that? I just reused the code that is used to obsolete buildings when a certain tech is discovered. Plus during my testing I didn't notice any slowdown.
     
  6. Impaler[WrG]

    Impaler[WrG] Civ4:Col UI programmer

    Joined:
    Dec 5, 2005
    Messages:
    1,750
    Location:
    Vallejo, California
    The loop in hasBuilding will check every BuildingClass so their is definitly going to be some slowdown though it may not be very noticable when that is the only change to the DLL. I'm concerned because I combine a lot of mods each of which adds more code to the game, so its best to have everything optimized.

    Notice that Firaxis felt it was important to make that function fast, it grabs 2 booleans off two Arrays and OR's them together, thats being changed to a full loop of all BuildingClasses with several if statments in their too. Multiply that by the huge number of times that function is called both in the DLL and in the UI and got to be significant even if its not noticable, add up enough significant yet on their own un-noticable changes and you can get some noticable slowdown especialy as people add more BuildingClasses.
     
  7. juni_be_good

    juni_be_good Black mage

    Joined:
    Jun 26, 2005
    Messages:
    115
    Location:
    Caen, France
    Do you have any idea of how long it will take to get a Warlords 2.08 compatible version ?
     
  8. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Working on it right now, I should have all the Warlords versions of my mod comps updated to v2.0.8 in a couple of days.
     
  9. juni_be_good

    juni_be_good Black mage

    Joined:
    Jun 26, 2005
    Messages:
    115
    Location:
    Caen, France
    These are very good news, awesome :goodjob:
     
  10. TheLopez

    TheLopez Deity

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Updated Warlords version to be compatible with the v2.0.8.0 patch.
     
  11. Psychic_Llamas

    Psychic_Llamas Wizard in the Making

    Joined:
    Nov 25, 2005
    Messages:
    6,366
    Location:
    Western Australia
    sorry about the thread necromancy here, but can someone update this mod to be BTS compatable? i really want to use it...
     
  12. rockinroger

    rockinroger WoC Team Member

    Joined:
    Feb 6, 2006
    Messages:
    1,312
    Location:
    Overland Park, Kansas
    We WoC'ed it. Coming soon!
     
  13. rockinroger

    rockinroger WoC Team Member

    Joined:
    Feb 6, 2006
    Messages:
    1,312
    Location:
    Overland Park, Kansas
    Hey Psychic Llamas, do you have a new link for the mushrooms resources? looks like the hackers got it also.
     
  14. Shiggs713

    Shiggs713 Immortal

    Joined:
    Mar 11, 2007
    Messages:
    2,361
    Location:
    Indianapolis
    nice job WoC team and friends
     
  15. Psychic_Llamas

    Psychic_Llamas Wizard in the Making

    Joined:
    Nov 25, 2005
    Messages:
    6,366
    Location:
    Western Australia
    whats a WoC?

    and im fixing the links as i type ;) thanks for reminding me Rockinroger :)
     

Share This Page