• Civ7 is already available! Happy playing :).

Unique Civics

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 :

civ4screenshot0001s.jpg


civ4screenshot0005c.jpg


civ4screenshot0006f.jpg


civ4screenshot0007b.jpg



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).
 
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 ;)
 
Wow. Very nice implementation. Looks very professional, as if this were an add-on of sorts by Firaxis.

Thanks! one of the best compliments I got :blush:
 
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.
 
Yeah, could you 'convert' this mod to RevDCM, if you get what I mean? Great job though!
 
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.
 
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.
 
@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 :)
 
@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 :)

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. ;)
 
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. ;)

And modmodmodmod it myself? :lol:
 
Would this mod, if / when it's BUG compatible, be RevDCM compatible?
 
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. ;)

If my modmod is based off Orbis, should I take the hated Civic code from Lena or RifE?
 
Top Bottom