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

Unique Civics

Discussion in 'Civ4 - Mod Components' started by Asaf, Mar 9, 2011.

  1. Asaf

    Asaf Sleep Deprived

    Joined:
    Mar 22, 2010
    Messages:
    1,326
    Unique Civics by Asaf (version 0.1)

    Download here

    (This mod was originally an idea/request by Cia in this thread)

    This mod allows for the addition of Unique Civics (UC's) for any civilization, the same way as they have unique units and unique buildings.
    Each civilization can replace one (or more) of the default civics.

    This mod component is based on BTS 3.19.

    Civic classes were added (same as unit classes and building classes) to help determine which civics replace which.

    UI was updated wherever needed (civics screen, civilopedia, tech tree, etc.)
    AI was also updated: it will only select allowed civics, and it values different game elements accordingly (techs, buildings, etc.)

    A few game concepts were modified to adapt to the new UC concept:

    Diplomacy/Trade
    Civic classes (instead of civics) are taken into account.
    If you replace your civic to match you rival's, you will change to the same civic class, but it might be a different civic.
    There is now a 'favorite civic class' for a leader, instead of a 'favorite civic'.

    Civic forcing
    This is true for both UN decisions and espionage missions which change civics: This now forces a civic class, instead of a civic.

    Events
    Events are triggered by civic classes instead of civics. Relevant python code was also changed to accomodate that.

    I created two sample Unique Civics (not intended for actual game play, only for demonstration):
    For the English Empire - British Royalty (replaces Hereditery Rule) - Adds +25% GPP.
    For the American Empire - First Amendment (replaces Free Speech) - Adds a free specialist in every city.

    Screen shots
    Spoiler :










    Notes for Modders:

    All changes in C++ and Python code were marked with a 'Unique Civics' comment.
    In the XML files - all changes in the schema files were marked as well, but in the data files I didn't mark them as it could sometimes cause parsing problems.

    XML
    Spoiler :

    Added a new file, CIV4CivicClassInfos.xml, which contains all the original civics as civic classes.
    Here's a sample XML:
    Code:
        <CivicClassInfo>
          <Type>CIVICCLASS_FREE_MARKET</Type>
          <Description>TXT_KEY_CIVIC_FREE_MARKET</Description>
          <CivicOptionType>CIVICOPTION_ECONOMY</CivicOptionType>
          <DefaultCivic>CIVIC_FREE_MARKET</DefaultCivic>
          <iCivicPercentAnger>0</iCivicPercentAnger>
        </CivicClassInfo>
    
    Note a few things:
    - The civic option was moved to the civic class
    - The civic class has a default civic
    - Civic percent anger was also moved to civic class (think of a case where each civ has a different kind of emancipation - you still want the anger to be calculated as if they all have it).

    The CIV4CivicInfos.xml file was updated. Here's a sample:

    Code:
        <CivicInfo>
          <CivicClass>CIVICCLASS_FREE_SPEECH</CivicClass>
          <Type>CIVIC_FIRST_AMENDMENT</Type>
    	  ...
    
    Note that each civic points to its class.

    In the Civilization Info there's a new section for UC's:
    Code:
          <Civics>
            <Civic>
              <CivicClassType>CIVICCLASS_FREE_SPEECH</CivicClassType>
              <CivicType>CIVIC_FIRST_AMENDMENT</CivicType>
            </Civic>
          </Civics>
    
    Note that it must come (if at all) after the UU's section and before the free unit classes.

    Other changes:
    - Event triggers now have civic class instead of civic.
    - Leader head now have favorite civic class.
    - Vote infos and vote source infos now have civic class instead of civic.

    Take a look at the schema files in the Assets folder for full detail change.


    Python
    Spoiler :

    Note that the random events functions now use civic classes instead of civics, in case you add new events.

    These are the changes I made in the exposed methods to Python (I added updated Python files from the original BTS files when needed):

    CyGame:
    - CyGame.getForceCivicCount(CivicTypes eIndex) was replaced by CyGame.getForceCivicClassCount(CivicClassTypes eIndex)
    - CyGame.isForceCivic(CivicTypes eIndex) was replaced by CyGame.isForceCivicClass(CivicClassTypes eIndex)

    CyGlobalContext:
    - Added CyGlobalContext.getNumCivicClassInfos()
    - Added CyGlobalContext.getCivicClassInfo(CivicClassTypes eIndex)

    CvCivicClassInfo (new class):
    - int CvCivicClassInfo.getCivicOptionType()
    - int CvCivicClassInfo.getDefaultCivicIndex()
    - void CvCivicClassInfo.setDefaultCivicIndex(int i)
    - int CvCivicClassInfo.getCivicPercentAnger()

    CvCivicInfo:
    - Added CvCivicInfo.getCivicClassType()
    - Note that CvCivicInfo.getCivicPercentAnger() still exists, but its value is taken from the class info on startup.

    CvCivilizationInfo:
    - Added int CvCivilizationInfo.getCivilizationCivics(int i)

    CvLeaderHeadInfo:
    - CvLeaderHeadInfo.getFavoriteCivic() was replaced by CvLeaderHeadInfo.getFavoriteCivicClass()

    CvVoteInfo:
    - CvVoteInfo.isForceCivic(CivicTypes eIndex) was replaced by CvVoteInfo.isForceCivicClass(CivicClassTypes eIndex)

    CvEventTriggerInfo:
    - CvEventTriggerInfo.getCivic() was replaced by CvEventTriggerInfo.getCivicClass()

    CvVoteSourceInfo:
    - CvVoteSourceInfo.getCivic() was replaced by CvVoteSourceInfo.getCivicClass()

    CyPlayer:
    - Added CyPlayer.isSameCivicClassSelected(CivicTypes eCivic) - returns True if the given civic has the same class as one of the current civics
    - Added CyPlayer.getCivicClassPercentAnger(CivicClassTypes eCivic) - returns percent anger for given civic class
    - Added CyPlayer.getCivilizationCivicForClass(CivicClassTypes eCivic) - returns the civic type used by this player's civilization for this civic (usually will be the default civic, unless there's a UC)
    - Added CyPlayer.isCivilizationCivic(CivicTypes eCivic) - returns True if the given civic is the one used by this player's civilization (not necessarily the current civic).
     
  2. CoffeeShopFrank

    CoffeeShopFrank Chieftain

    Joined:
    Jan 18, 2011
    Messages:
    111
    Looks awesome so far. Keep up the good work! :)
     
  3. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    30,802
    Location:
    Germany / Netherlands
    I second this :D.
     
  4. Asaf

    Asaf Sleep Deprived

    Joined:
    Mar 22, 2010
    Messages:
    1,326
    Thanks :)

    Just to clarify - I don't intend to add more civics. I'm more interested in building the infrastructure than adding the content.
    That's why it's in the mod components section...

    Please feel free to use this and add your own awesome content, and let me know if you do ;)
     
  5. ripple01

    ripple01 Chieftain

    Joined:
    Mar 7, 2006
    Messages:
    1,246
    Location:
    New York City
    Wow. Very nice implementation. Looks very professional, as if this were an add-on of sorts by Firaxis.
     
  6. Asaf

    Asaf Sleep Deprived

    Joined:
    Mar 22, 2010
    Messages:
    1,326
    Thanks! one of the best compliments I got :blush:
     
  7. Thunderbrd

    Thunderbrd C2C War Dog

    Joined:
    Jan 2, 2010
    Messages:
    24,850
    Gender:
    Male
    Location:
    Las Vegas
    Well done Asaf! Was looking forward to seeing what you'd do here. I'm wondering if your coding would be difficult to implement into the RevDCM/BUG environment... I may have to download and see but I can see some potential problem areas already.
     
  8. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Awesome! We were planning to do exactly this, and now we don't have to. Thank you for allowing me to continue being lazy. :goodjob:
     
  9. need my speed

    need my speed Rex Omnium Imperarium

    Joined:
    Oct 3, 2009
    Messages:
    2,034
    Gender:
    Male
    Location:
    European Union (Magna Batavia)
    Yeah, could you 'convert' this mod to RevDCM, if you get what I mean? Great job though!
     
  10. Asaf

    Asaf Sleep Deprived

    Joined:
    Mar 22, 2010
    Messages:
    1,326
    Thanks everyone :)

    I have no idea what changes RevDCM has in its code, so I don't know how difficult it'll be to merge the two.
    Unfortunately, I don't think I'll have the time to do so, so if anyone's interested - you can merge it yourselves ;)
    All the C++ and Python code changes are marked in the files.

    As for BUG - I imagine that you just have to merge the Python changes (there aren't too many) into the correct BUG files. I don't think there are changed XML files which also appear in BUG.
     
  11. Cybah

    Cybah Chieftain

    Joined:
    Jun 22, 2007
    Messages:
    1,480
    Great!

    I'd love a sevopedia/bug mod compatible version. :)
     
  12. WilliamOfOrange

    WilliamOfOrange Chieftain

    Joined:
    Jul 17, 2003
    Messages:
    998
    Location:
    Lincolnshire, UK
    So, if I understand this correctly, the AI sharing a civic class with you will still get you the diplo bonus even if you and/or the AI have a Unique Civic. Is it also possible to get a further bonus if two civs share the same UC?

    Also, what about with Lena where there were Hated Civics: could this be merged as well to have Hated Civic Classes and/or Hated Unique Civics? Just curious. What do people think of that. should be pretty easy to do, right?

    Great work, Asaf! Thanks for this.
     
  13. Asaf

    Asaf Sleep Deprived

    Joined:
    Mar 22, 2010
    Messages:
    1,326
    @Cybah: I might work on a BUG compatible mod sometime, but I'm not sure I'll get to it, so if anyone's interested in merging this with BUG - you're more than welcome (and don't wait for me if you want it ;) ).

    @William - It's possible, but it'll require extra coding.
    Although there's nothing that prevents two civs from sharing a UC, it's kinda against the spirit of the uniqueness - the same way that you don't have a shared UU or UB between civs.
    In addition, a specific diplo bonus for UC makes the game less flexible IMHO (e.g. to play against a certain civ you'd pick a civ it'll like more).

    Reg. hated civics - I wasn't aware of this mod. I imagine it should be fairly easy to merge.
    All that's needed to be changed is that the hated civic is actually a hated civic class.

    And thanks for the compliment :)
     
  14. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,292
    Location:
    israel
    great work buddy.

    &#1505;&#1495;&#1514;&#1497;&#1497;&#1503;!!!
     
  15. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Hated Civics were added by Opera for the LENA modmodmod for Orbis (modmod for FfH); AFAIK, the only mod that has it atm is RifE, which Opera joined some time ago.

    Feel free to grab the code if you want. ;)
     
  16. Asaf

    Asaf Sleep Deprived

    Joined:
    Mar 22, 2010
    Messages:
    1,326
    And modmodmodmod it myself? :lol:
     
  17. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Technically RifE is a Fall Further modmod, which is itself an FfH modmod (making us a Modmodmod :crazyeye:).

    I've seen a RifE modmod that requires another modmod... Making it a modmodmodmodmod. Yes. They exist.
     
  18. need my speed

    need my speed Rex Omnium Imperarium

    Joined:
    Oct 3, 2009
    Messages:
    2,034
    Gender:
    Male
    Location:
    European Union (Magna Batavia)
    Would this mod, if / when it's BUG compatible, be RevDCM compatible?
     
  19. The Capo

    The Capo godless Heathen

    Joined:
    Jan 29, 2001
    Messages:
    9,302
    Location:
    Washington, DC
    Pretty good idea, nice work. :goodjob:
     
  20. WilliamOfOrange

    WilliamOfOrange Chieftain

    Joined:
    Jul 17, 2003
    Messages:
    998
    Location:
    Lincolnshire, UK
    If my modmod is based off Orbis, should I take the hated Civic code from Lena or RifE?
     

Share This Page