HOW TO: Add a civic option to your game

Ralendil

Augustus
Joined
Feb 6, 2002
Messages
274
Location
Somewhere on earth
Modifications: XML files
Files needed:
  • \Assets\xml\gameinfo\CIV4CivicInfos.xml
  • \Assets\xml\text\CIV4GameTextInfos_Objects.xml
  • \Assets\xml\text\CIV4GameText_Civilopedia_CivicsReligion.xml
  • \Assets\xml\text\CIV4GameText_Strategy.xml
  • \Assets\xml\text\CIV4GameTextInfos.xml
Purpose: Adding until 5 civic options to your game.

Introduction:

Ok... First you have to know that without making some modifications to the interface you will be able to add one line of civic option. By one line I mean one politic, one legal, one labor, one economic and one religious option.
Adding two lines will create some conflict with the pictures (I haven't tested it ;)).


Basically it is easy. All civic are built on same schema. So you can copy paste one and make some changes (like you want a new politic option you copy the hereditary rule section).

Off course you have to make some changes. Well let's talk about the file. First, all options begin with the line <CivicInfo> and end with the line </CivicInfo>. We take as exemple the Hereditary rule.

1. The entries in the main file CIV4CivicInfos.xml

  • <CivicOptionType>CIVICOPTION_GOVERNMENT</CivicOptionType>
    The type of the civic option. Possible entries are: "CIVICOPTION_GOVERNMENT" ; "CIVICOPTION_LEGAL" ; "CIVICOPTION_LABOR" ; "CIVICOPTION_ECONOMY" ; "CIVICOPTION_RELIGION"

  • <Type>CIVIC_HEREDITARY_RULE</Type>
    The valor that will use the game to refer to this civic option. This is only a valor, don't search a reference of this in the file you will never find it ;). You have to put a different name for each civic option, and never have 2 same names for two differents civic options.

  • <Description>TXT_KEY_CIVIC_HEREDITARY_RULE</Description>
    This line refers to the description that will be used in the game. You can find these descriptions in the file \Assets\xml\text\CIV4GameTextInfos_Objects.xml.
    Nota you can specify an entry that already exist.

  • <Civilopedia>TXT_KEY_CIVIC_HEREDITARY_RULE_PEDIA</Civilopedia>
    The civilopedia entry that will be used in the game. The texts are in the file \Assets\xml\text\CIV4GameText_Civilopedia_CivicsReligion.xml.
    Nota as above you can specify an entry that already exist.
    You can disable the civilopedia reference by replacing the line by this: <Civilopedia/>.

  • <Strategy>TXT_KEY_CIVIC_HEREDITARY_RULE_STRATEGY</Strategy>
    This refer to the advice displayed when you discover the civic option.
    You can find these advices in the file: \Assets\xml\text\CIV4GameText_Strategy.xml.
    Nota as above you can specify an entry that already exist.

  • <Button>,Art/Interface/Buttons/Civics/Hereditary_Rule.dds,Art/Interface/Buttons/Civics_Civilizations_Religions_Atlas.dds,3,3</Button>
    This is the button that will be used in the civic option pannel when you choose an option. Simple way is to use an existing one. Copy one of the line and use it for your own civic option.

  • <TechPrereq>TECH_MONARCHY</TechPrereq>
    The technology needed in order to see the civic option avalable.
    The list of the technologies can be found in this file: \Assets\XML\Technologies\CIV4TechInfos.xml

  • <iAnarchyLength>1</iAnarchyLength>
    Anarchy or no anarchy ? Possible options are: "0" ; "1"

  • <Upkeep>UPKEEP_MEDIUM</Upkeep>
    The upkeep of the civic option. Possible options are: "UPKEEP_LOW" ; "UPKEEP_MEDIUM" ; "UPKEEP_HIGH" ; "NONE"

  • <WeLoveTheKing>TXT_KEY_CIVIC_WE_LOVE_DESPOT</WeLoveTheKing>
    Nota: I put this line here even if it is the last line of a civic option, cause this is part of the important entries you have to pay attention of.
    Here something important. For all CIVICOPTION_GOVERNMENT you have to specify a "We love the king" sentence. You can find these sentences here:
    \Assets\xml\text\CIV4GameTextInfos.xml

    The civic option that don't use the WeLoveTheKing sentences (all not CIVICOPTION_GOVERNMENT) will use this line instead: <WeLoveTheKing/>

  • The other entries will make your civic option different of the others. Here you have to test a little and see the impact of the game...
    Code:
    			<iAIWeight>0</iAIWeight>
    			<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
    			<iStateReligionGreatPeopleRateModifier>0</iStateReligionGreatPeopleRateModifier>
    			<iDistanceMaintenanceModifier>0</iDistanceMaintenanceModifier>
    			<iNumCitiesMaintenanceModifier>0</iNumCitiesMaintenanceModifier>
    			<iExtraHealth>0</iExtraHealth>
    			<iFreeExperience>0</iFreeExperience>
    			<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
    			<iImprovementUpgradeRateModifier>0</iImprovementUpgradeRateModifier>
    			<iMilitaryProductionModifier>0</iMilitaryProductionModifier>
    			<iBaseFreeUnits>0</iBaseFreeUnits>
    			<iBaseFreeMilitaryUnits>0</iBaseFreeMilitaryUnits>
    			<iFreeUnitsPopulationPercent>0</iFreeUnitsPopulationPercent>
    			<iFreeMilitaryUnitsPopulationPercent>0</iFreeMilitaryUnitsPopulationPercent>
    			<iGoldPerUnit>0</iGoldPerUnit>
    			<iGoldPerMilitaryUnit>0</iGoldPerMilitaryUnit>
    			<iHappyPerMilitaryUnit>0</iHappyPerMilitaryUnit>
    			<bMilitaryFoodProduction>0</bMilitaryFoodProduction>
    			<iMaxConscript>0</iMaxConscript>
    			<bNoUnhealthyPopulation>0</bNoUnhealthyPopulation>
    			<bBuildingOnlyHealthy>0</bBuildingOnlyHealthy>
    			<iLargestCityHappiness>0</iLargestCityHappiness>
    			<iWarWearinessModifier>0</iWarWearinessModifier>
    			<iFreeSpecialist>0</iFreeSpecialist>
    			<iTradeRoutes>0</iTradeRoutes>
    			<bNoForeignTrade>0</bNoForeignTrade>
    			<iCivicPercentAnger>0</iCivicPercentAnger>
    			<bStateReligion>0</bStateReligion>
    			<bNoNonStateReligionSpread>0</bNoNonStateReligionSpread>
    			<iStateReligionHappiness>0</iStateReligionHappiness>
    			<iNonStateReligionHappiness>0</iNonStateReligionHappiness>
    			<iStateReligionUnitProductionModifier>0</iStateReligionUnitProductionModifier>
    			<iStateReligionBuildingProductionModifier>0</iStateReligionBuildingProductionModifier>
    			<iStateReligionFreeExperience>0</iStateReligionFreeExperience>
    			<YieldModifiers/>
    			<CapitalYieldModifiers/>
    			<TradeYieldModifiers/>
    			<CommerceModifiers/>
    			<CapitalCommerceModifiers/>
    			<SpecialistExtraCommerces/>
    			<Hurrys/>
    			<SpecialBuildingNotRequireds/>
    			<SpecialistValids/>
    			<BuildingHappinessChanges/>
    			<FeatureHappinessChanges/>
    			<ImprovementYieldChanges/>

    Here I can't describe all lines (it would take a lot of time). Basically you have a lot of exemples in the civic options that already exist. Some things are not used at the moment by the civic option of the vanilla game.

2. Adding a civic option

Now time to show you :).

Don't pay attention to the bonuses I have putted, I would advice you strongly to not use this civic option added to a vanilla game without any balancing of it ;).
In the translation you will see some strange entries like German / Italian etc... It is cause I am not speaking so many languages :p. So it works for French and english games... but anyways It is to show you an exemple...

--------------------[ Open File ]--------------------
\Assets\XML\Units\CIV4UnitInfos.xml

--------------------[ Find ]--------------------
Code:
	<WeLoveTheKing>TXT_KEY_CIVIC_WE_LOVE_MONARCH</WeLoveTheKing>
		</CivicInfo>

--------------------[ Add under ]--------------------
Code:
		<CivicInfo>
			<CivicOptionType>CIVICOPTION_GOVERNMENT</CivicOptionType>
			<Type>CIVIC_OLIGARCHY</Type>
			<Description>TXT_KEY_CIVIC_OLIGARCHY</Description>
			<Civilopedia>TXT_KEY_CIVIC_OLIGARCHY_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_CIVIC_OLIGARCHY_STRATEGY</Strategy>
			<Button>,Art/Interface/Buttons/Civics/Representation.dds,Art/Interface/Buttons/Civics_Civilizations_Religions_Atlas.dds,6,2</Button>
			<TechPrereq>TECH_CODE_OF_LAWS</TechPrereq>
			<iAnarchyLength>1</iAnarchyLength>
			<Upkeep>UPKEEP_MEDIUM</Upkeep>
			<iAIWeight>0</iAIWeight>
			<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
			<iStateReligionGreatPeopleRateModifier>0</iStateReligionGreatPeopleRateModifier>
			<iDistanceMaintenanceModifier>+25</iDistanceMaintenanceModifier>
			<iNumCitiesMaintenanceModifier>0</iNumCitiesMaintenanceModifier>
			<iExtraHealth>0</iExtraHealth>
			<iFreeExperience>0</iFreeExperience>
			<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
			<iImprovementUpgradeRateModifier>0</iImprovementUpgradeRateModifier>
			<iMilitaryProductionModifier>0</iMilitaryProductionModifier>
			<iBaseFreeUnits>0</iBaseFreeUnits>
			<iBaseFreeMilitaryUnits>0</iBaseFreeMilitaryUnits>
			<iFreeUnitsPopulationPercent>0</iFreeUnitsPopulationPercent>
			<iFreeMilitaryUnitsPopulationPercent>0</iFreeMilitaryUnitsPopulationPercent>
			<iGoldPerUnit>0</iGoldPerUnit>
			<iGoldPerMilitaryUnit>0</iGoldPerMilitaryUnit>
			<iHappyPerMilitaryUnit>0</iHappyPerMilitaryUnit>
			<bMilitaryFoodProduction>0</bMilitaryFoodProduction>
			<iMaxConscript>0</iMaxConscript>
			<bNoUnhealthyPopulation>0</bNoUnhealthyPopulation>
			<bBuildingOnlyHealthy>0</bBuildingOnlyHealthy>
			<iLargestCityHappiness>0</iLargestCityHappiness>
			<iWarWearinessModifier>0</iWarWearinessModifier>
			<iFreeSpecialist>0</iFreeSpecialist>
			<iTradeRoutes>0</iTradeRoutes>
			<bNoForeignTrade>0</bNoForeignTrade>
			<iCivicPercentAnger>0</iCivicPercentAnger>
			<bStateReligion>0</bStateReligion>
			<bNoNonStateReligionSpread>0</bNoNonStateReligionSpread>
			<iStateReligionHappiness>0</iStateReligionHappiness>
			<iNonStateReligionHappiness>0</iNonStateReligionHappiness>
			<iStateReligionUnitProductionModifier>0</iStateReligionUnitProductionModifier>
			<iStateReligionBuildingProductionModifier>0</iStateReligionBuildingProductionModifier>
			<iStateReligionFreeExperience>0</iStateReligionFreeExperience>
			<YieldModifiers/>
			<CapitalYieldModifiers/>
			<TradeYieldModifiers/>
			<CommerceModifiers/>
			<CapitalCommerceModifiers/>
			<SpecialistExtraCommerces/>
			<Hurrys>
				<Hurry>
					<HurryType>HURRY_GOLD</HurryType>
					<bHurry>1</bHurry>
				</Hurry>
			</Hurrys>
			<SpecialBuildingNotRequireds/>
			<SpecialistValids/>
			<BuildingHappinessChanges/>
			<FeatureHappinessChanges/>
			<ImprovementYieldChanges>
				<ImprovementYieldChange>
					<ImprovementType>IMPROVEMENT_HAMLET</ImprovementType>
					<ImprovementYields>
						<iYield>0</iYield>
						<iYield>0</iYield>
						<iYield>1</iYield>
					</ImprovementYields>
				</ImprovementYieldChange>
				<ImprovementYieldChange>
					<ImprovementType>IMPROVEMENT_VILLAGE</ImprovementType>
					<ImprovementYields>
						<iYield>0</iYield>
						<iYield>0</iYield>
						<iYield>1</iYield>
					</ImprovementYields>
				</ImprovementYieldChange>
				<ImprovementYieldChange>
					<ImprovementType>IMPROVEMENT_TOWN</ImprovementType>
					<ImprovementYields>
						<iYield>0</iYield>
						<iYield>0</iYield>
						<iYield>1</iYield>
					</ImprovementYields>
				</ImprovementYieldChange>
			</ImprovementYieldChanges>
			<WeLoveTheKing>TXT_KEY_CIVIC_WE_LOVE_SENATE</WeLoveTheKing>
		</CivicInfo>
--------------------[ Open File ]--------------------
\Assets\xml\text\CIV4GameTextInfos_Objects.xml

--------------------[ Find ]--------------------
Code:
			<Text>Gob. hereditario</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>
		</Spanish>
	</TEXT>

--------------------[ Add under ]--------------------
Code:
	<TEXT>
		<Tag>TXT_KEY_CIVIC_OLIGARCHY</Tag>
		<English>Oligarchy</English>
		<French>
			<Text>Oligarchie</Text>
			<Gender>Female</Gender>
			<Plural>0</Plural>
		</French>
		<German>
			<Text>German</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>
		</German>
		<Italian>
			<Text>Italian</Text>
			<Gender>Female</Gender>
			<Plural>0</Plural>
		</Italian>
		<Spanish>
			<Text>Spanish</Text>
			<Gender>Female</Gender>
			<Plural>0</Plural>
		</Spanish>
	</TEXT>

--------------------[ Open File ]--------------------
\Assets\xml\text\CIV4GameText_Civilopedia_CivicsReligion.xml

--------------------[ Find ]--------------------
Code:
Sin embargo, los gobernantes hereditarios adolecen de las mismas debilidades que todos los líderes no electos; no son responsables ante el pueblo y, cuando son malos, puede ser extremadamente complicado librarse de ellos.</Spanish>
	</TEXT>

--------------------[ Add under ]--------------------
Code:
	<TEXT>
		<Tag>TXT_KEY_CIVIC_OLIGARCHY_PEDIA</Tag>
		<English>***** Oligarchy is a Political regime where most political power effectively rests with a small segment of society (typically the most powerful, whether by wealth, military strength, ruthlessness, or political influence). The word oligarchy is from the Greek for "few" and "rule". Some political theorists have argued that all societies are inevitably oligarchies no matter the supposed political system.Oligarchies are often controlled by a few powerful families whose children are raised and mentored to become inheritors of the power of the oligarchy, often at some sort of expense to those governed. In contrast to aristocracy ("government by the 'best'"), this power may not always be exercised openly, the oligarchs preferring to remain "the power behind the throne", exerting control through economic means. Although Aristotle pioneered the use of the term as a synonym for rule by the rich, for which the exact term is plutocracy, oligarchy is not always a rule by wealth, as oligarchs can simply be a privileged cadre. It has also been suggested that America fits the definition of oligarchy in that the elected officials do not seem to represent the people that elected them, thus converting the Republic into an Oligarchy.</English>
		<French>*****L'oligarchie - du grec oligos, peu et arkhê, commandement - est une forme de gouvernement dans laquelle la plupart des pouvoirs sont détenus par une petite partie de la société (typiquement la plus puissante, que ce soit par richesse, force militaire, cruauté ou influence politique). Les analystes politiques disent que toute société est inévitablement une oligarchie quel que soit le système politique revendiqué. Le nombre de membres de l'oligarchie (nombre absolu ou relatif) n'apparait pas non plus un critère très sûr. Il est donc nécessaire d'analyser plus finement les critères d'appartenance à l'oligarchie : comment on y rentre, y reste, et en sort. Toutes sortes de critères, plus ou moins officiels et plus ou moins stables dans le temps, peuvent entrer en jeu. Les oligarchies sont des systèmes politiques complexes, avec souvent plusieurs cercles (plus ou moins formels) de pouvoirs de plus en plus concentrés, des spécialisations selon le domaine de pouvoir (commercial, juridique, religieux, militaire, technologique, etc.), et un exercice du pouvoir souvent discret et collégial. On y retrouve généralement des familles dominantes, pour qui la position politique est un élément de patrimoine transmis aux enfants, dont l'éducation est organisé dans cette perspective. On peut y trouver, ou non, des systèmes de caste.</French>
		<German>*****German</German>
		<Italian>*****Italian</Italian>
		<Spanish>*****Spanish</Spanish>
	</TEXT>

--------------------[ Open File ]--------------------
\Assets\xml\text\CIV4GameText_Strategy.xml

--------------------[ Find ]--------------------
Code:
		<Spanish>Las unidades militares aumentan la felicidad de las ciudades.</Spanish>
	</TEXT>

--------------------[ Add under ]--------------------
Code:
	<TEXT>
		<Tag>TXT_KEY_CIVIC_OLIGARCHY_STRATEGY</Tag>
		<English>Can spend gold to finish production.</English>
		<French>Permet de dépenser de l'or pour achever une construction.</French>
		<German>German</German>
		<Italian>Italian</Italian>
		<Spanish>Spanish</Spanish>
	</TEXT>

--------------------[ Open File ]--------------------
\Assets\xml\text\CIV4GameTextInfos.xml

--------------------[ Find ]--------------------
Code:
		<Spanish>"Adoramos al monarca"</Spanish>
	</TEXT>

--------------------[ Add under ]--------------------
Code:
	<TEXT>
		<Tag>TXT_KEY_CIVIC_WE_LOVE_SENATE</Tag>
		<English>"We Love the Senate Day"</English>
		<French>"Nous adorons la fête du senat"</French>
		<German>German</German>
		<Italian>Italian</Italian>
		<Spanish>Spanish</Spanish>
	</TEXT>

Now you have added the Oligarchy to your game :).
 
Cool, it's really simple to mod it. I can't wait the SDK to see it's options. Because i'd like to add lumber camp into forrest (for production) and forrester to raise forest into no forrested terrain (if forest reday camp vanish). Thare should be camp to improve terrain tiles like desert. Works similar to cottage,hamlet,town - city has to work on it.
 
Modifications: Python files
Files needed:
  • \Assets\Python\Screens\CvCivicsScreen.py
Purpose: Permit to add more than one set of civic options.

1/ The lines of code:

  • self.TEXT_MARGIN = 15
    The size of text.
  • self.BUTTON_SIZE = 24
    The siez of the small button.
  • self.BIG_BUTTON_SIZE = 64
    The size of the big button.

Nota: To change the picture of the background you will (surely) need to open some files where you need some specific programs (I have seen 3dsmax for the nif files). As I don't have such programs...
The modifications below will permit you to add more than 1 set of civics options... That's the good news :).


2/ The modifications:

--------------------[ Open File ]--------------------
\Assets\Python\Screens\CvCivicsScreen.py
--------------------[ Find ]--------------------
self.TEXT_MARGIN = 15
self.BUTTON_SIZE = 24
self.BIG_BUTTON_SIZE = 64
--------------------[ Replace by ]--------------------
self.TEXT_MARGIN = 11
self.BUTTON_SIZE = 15
self.BIG_BUTTON_SIZE = 40
--------------------[ Save in CustamAssets folder & close ]--------------------


If someone succeed to redesign the background of the civic advisor tell us :).
 
Does anyone know what each modifier can do for the each entry?

ALSO: if you change the names of any pre-existing names--make sure u change it in the civ4leaderheads xml file as well
 
I have followed the guide to the letter, but the new civics I have create do not show up on the civics page, they dont even show up on the civilopedia!

This has really got me stumped, I dont undertand why, could someone please assist.

Regards :confused:
 
How can you add another civic option type? I have created the entry in CIV4CivicOptionInfos.xml, CIV4CivicInfos.xml and GlobalDefines.xml but I don't know how to add it in the python screen. Please help!
 
I got a simple question. Is it possible, to add global happiness changes depending on civic option, as I didn't notice anything like this in CivicInfos file?

Have you any idea how to implement such an option?
 
Well, it seems the pyton changes are a issue for many people, could someone Kindly post that file, with an added column, than we can work the xmls. Tanks, in advance
 
Hey, i have the program now and made the python changes expecting have space for 6 columns of civics but no, the screen is all accupied with the original 5 columns of civics, can you help me please. I pretend add a militaristic column.
 
Ralendil, thanks a bunch for this tutorial! I'm sure I'll come up with plenty of questions for ya when I get cracking at this! :)
 
btw, font size isnt controlled by self.TEXT_MARGIN. the margin of the text is, the distance between civics.
 
Back
Top Bottom