thadian
Kami of Awakened Dreamers
We all want to make the game how we want it, but it can be tough to do with all the strange codes and complex stuff. Recently, i have begun tearing into files of different mods, including Religion and Revolution for Civ4Col - and for Civ 5, i have torn into the files of Echoes of Ages and Community Call to Power. I have gained a great deal of knowledge in a short amount of time, and if i can do it, so can you! Now, i believe a core element in learning is teaching. In this instructional tutorial, my goal is to teach an average, unskilled Civilization 5 player how to create a building.
Lets start by downloading a program called Notepad++ which is a piece of freeware, very high quality notepad-like tool for modding. Using this, you can open almost anything, and with it's plugin's like Compare, you just can't go wrong. Only download this from it's official website.
1. Download, and Install Notepad++.
2. Open Notepad++.
3. Name your file - I named mine Buildings_Template.xml - XML is one of the bottom "save as" extensions on the list, use it.
Now that you have come this far, let's copy-paste a gift from me to you, This template can be used for EVERYTHING:
Don't worry, i will help you understand this as well as i do.
Before you confuse yourself, this is the Palace in your capital. We will analyze which functions from the above table is used in the palace.
Now, lets break this down.
Above us, This means the building is a Palace - and the Class is a Palace. This is because there might be multiple types of palaces (or barracks, such as Krepost).
Above us, These are your entries for texts, such as Civlopedia. Below this, most info should make itself obvious or be irrelevant in the starter stages. Note that <NeverCapture> Is used by National Wonders to prevent the conqueror from keeping the building when the city falls.
For art, to simplify things, we will use icons that exist in the game. There is no shame in setting up art files to these icons to get your building in the game - you can always go back and add a new artwork later, but that is a different tutorial.
Below us, Flavors tell the AI how to value a building. For example, FlavorType can be SCIENCE or GOLD. Sometimes a building can be more than ONE flavor to appeal to different AI mentality.
Below us, we are going to look at what causes the palace to produce gold, production and science.
Lets take just 2 minutes, and look at the "Template" i provided you. Can you find the values in it the palace is using? Your building, like the palace will need to do something. Now, to practice what we have learned and create a new building!
Open a new file in Notepad++. This will be called Palace_Altar.xml -
I will give you another present, you may even copy-paste this to the bottom of your template file so you can get use to this.
Copy / Paste this code into Palace_Altar.xml
Lets look at WHAT this building is going to do, one step at a time. Palace Alter uses a comment <!-- Here --> which keeps things clean. You should use comments to make small notes of things. <GameData> and </GameData> is how you begin and end EVERY file for it to effect the game.
Above we are setting the Building Class, Default Version of the building and it's description name. If we made it BUILDINGCLASS_MONUMENT, then this would be a unique monument instead of it's own building. Lets stick with PALACE_ALTAR.
Above us, we set the cost of 40 hammers, and 0 Gold in maintenance. Below us, we are going to tell it what it's description targets are.
Now we are going to cause it to give one happiness and set it's icons.
The next part will make the Palace Altar require a palace.
The next step is telling it to produce 1 Faith in addition to it's happiness.
Almost done, bear with me! Time to set the flavor. We could go with religion, happiness or both. I will let you choose, i set mine to Religion.
To be clean we will put our information right here for civlopedia entries.
Do you notice how easy this is? At this point, you can insert another comment for another cool building - or you can make changes to this one! Remember the template i gave you for the buildings?
Now would be a good time to go into one of these 2 places:
Vanilla:
C:\Program Files (x86)\Steam\steamapps\common\sid meier's civilization v\assets\Gameplay\XML\Buildings
Gods and Kings:
C:\Program Files (x86)\Steam\steamapps\common\sid meier's civilization v\assets\DLC\Expansion\Gameplay\XML\Buildings
Open these files with Notepad++ and look at them. Start by opening the template, then looking at the buildings. Library, Monument, Shrine, Palace, and Barracks give you a good idea of what lines in the template are used by that building.
Save your file, and make some changes. Change the name of the building and always ask questions when you have them - most modders are happy to help others learn. I welcome criticism on how to improve this tutorial, and better information from more experienced modders.
Please bear in mind this is a "101" tutorial, and the target audience is the person who has never modded before but just knows if they can just add ONE building, they can add more buildings, then a unit, then more units. We all start somewhere, and this building was my start and i share it with you.
Last thing:
Open modbuddy.
Click file, new project - name it! go through the basics until it stops guiding you.
Click "open" and "file" - open your .xml file you made.
Click build - build solution. Click build then build modname (under it build solution).
Click Save All.
Open Solution Manager, and right click - click properties.
Click Action
Click Add
UpdateDatabase - Modname.
this tells the mod to load itself into the database when the player clicks the green light to activate your mod.
Happy Modding!
Lets start by downloading a program called Notepad++ which is a piece of freeware, very high quality notepad-like tool for modding. Using this, you can open almost anything, and with it's plugin's like Compare, you just can't go wrong. Only download this from it's official website.
1. Download, and Install Notepad++.
2. Open Notepad++.
3. Name your file - I named mine Buildings_Template.xml - XML is one of the bottom "save as" extensions on the list, use it.
Now that you have come this far, let's copy-paste a gift from me to you, This template can be used for EVERYTHING:
Don't worry, i will help you understand this as well as i do.
Spoiler :
Code:
<GameData>
<Table name="Building_BuildingClassYieldChanges">
<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
<Column name="BuildingClassType" type="text" reference="BuildingClasses(Type)"/>
<Column name="YieldType" type="integer" reference="Yields(Type)"/>
<Column name="YieldChange" type="integer" default="0"/>
</Table>
<Table name="Building_Flavors">
<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
<Column name="FlavorType" type="text" reference="Flavors(Type)"/>
<Column name="Flavor" type="integer"/>
</Table>
<Table name="Building_ClassesNeededInCity">
<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
<Column name="BuildingClassType" type="text" reference="BuildingClasses(Type)"/>
</Table>
<Table name="Building_PrereqBuildingClasses">
<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
<Column name="BuildingClassType" type="text" reference="BuildingClasses(Type)"/>
<Column name="NumBuildingNeeded" type="integer"/>
</Table>
<Table name="Building_YieldChanges">
<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer"/>
</Table>
<Table name="Building_YieldChangesPerPop">
<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer"/>
</Table>
<Table name="Building_YieldModifiers">
<Column name="BuildingType" type="text" reference="Buildings(Type)"/>
<Column name="YieldType" type="text" reference="Yields(Type)"/>
<Column name="Yield" type="integer"/>
</Table>
Before you confuse yourself, this is the Palace in your capital. We will analyze which functions from the above table is used in the palace.
Spoiler :
Code:
<buildings>
<Row>
<Type>BUILDING_PALACE</Type>
<BuildingClass>BUILDINGCLASS_PALACE</BuildingClass>
<Cost>0</Cost>
<Help>TXT_KEY_BUILDING_PALACE_HELP</Help>
<Description>TXT_KEY_BUILDING_PALACE</Description>
<Civilopedia>TXT_KEY_CIV5_BUILDINGS_PALACE_TEXT</Civilopedia>
<Strategy>TXT_KEY_BUILDING_PALACE_STRATEGY</Strategy>
<ArtDefineTag>PALACE</ArtDefineTag>
<Capital>true</Capital>
<NukeImmune>true</NukeImmune>
<MinAreaSize>-1</MinAreaSize>
<Defense>250</Defense>
<ArtInfoCulturalVariation>true</ArtInfoCulturalVariation>
<DisplayPosition>32</DisplayPosition>
<NeverCapture>true</NeverCapture>
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>19</PortraitIndex>
</Row>
</Buildings>
Now, lets break this down.
Spoiler :
Code:
<Buildings>
<Row>
<Type>BUILDING_PALACE</Type>
<BuildingClass>BUILDINGCLASS_PALACE</BuildingClass>
<Cost>0</Cost>
Above us, This means the building is a Palace - and the Class is a Palace. This is because there might be multiple types of palaces (or barracks, such as Krepost).
Spoiler :
Code:
<Help>TXT_KEY_BUILDING_PALACE_HELP</Help>
<Description>TXT_KEY_BUILDING_PALACE</Description>
<Civilopedia>TXT_KEY_CIV5_BUILDINGS_PALACE_TEXT</Civilopedia>
<Strategy>TXT_KEY_BUILDING_PALACE_STRATEGY</Strategy>
<ArtDefineTag>PALACE</ArtDefineTag>
Spoiler :
Code:
<Capital>true</Capital>
<NukeImmune>true</NukeImmune>
<MinAreaSize>-1</MinAreaSize>
<Defense>250</Defense>
<ArtInfoCulturalVariation>true</ArtInfoCulturalVariation>
<DisplayPosition>32</DisplayPosition>
<NeverCapture>true</NeverCapture>
For art, to simplify things, we will use icons that exist in the game. There is no shame in setting up art files to these icons to get your building in the game - you can always go back and add a new artwork later, but that is a different tutorial.
Spoiler :
Code:
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>19</PortraitIndex>
</Row>
</Buildings>
Below us, Flavors tell the AI how to value a building. For example, FlavorType can be SCIENCE or GOLD. Sometimes a building can be more than ONE flavor to appeal to different AI mentality.
Spoiler :
Code:
<Building_Flavors>
<Row>
<BuildingType>BUILDING_PALACE</BuildingType>
<FlavorType>FLAVOR_GOLD</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<BuildingType>BUILDING_PALACE</BuildingType>
<FlavorType>FLAVOR_SCIENCE</FlavorType>
<Flavor>10</Flavor>
</Row>
<Row>
<BuildingType>BUILDING_PALACE</BuildingType>
<FlavorType>FLAVOR_CULTURE</FlavorType>
<Flavor>10</Flavor>
</Row>
</Building_Flavors>
Below us, we are going to look at what causes the palace to produce gold, production and science.
Spoiler :
Code:
<Building_YieldChanges>
<Row>
<BuildingType>BUILDING_PALACE</BuildingType>
<YieldType>YIELD_GOLD</YieldType>
<Yield>3</Yield>
</Row>
<Row>
<BuildingType>BUILDING_PALACE</BuildingType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>3</Yield>
</Row>
<Row>
<BuildingType>BUILDING_PALACE</BuildingType>
<YieldType>YIELD_SCIENCE</YieldType>
<Yield>3</Yield>
</Row>
</Building_YieldChanges>
Lets take just 2 minutes, and look at the "Template" i provided you. Can you find the values in it the palace is using? Your building, like the palace will need to do something. Now, to practice what we have learned and create a new building!
Open a new file in Notepad++. This will be called Palace_Altar.xml -
I will give you another present, you may even copy-paste this to the bottom of your template file so you can get use to this.
Copy / Paste this code into Palace_Altar.xml
Spoiler :
Code:
<!-- Palace Altar--->
<GameData>
<BuildingClasses>
<Row>
<Type>BUILDINGCLASS_PALACE_ALTAR</Type>
<DefaultBuilding>BUILDING_PALACE_ALTAR</DefaultBuilding>
<Description>TXT_KEY_BUILDING_PALACE_ALTAR</Description>
</Row>
</BuildingClasses>
<Buildings>
<Row>
<Type>BUILDING_PALACE_ALTAR</Type>
<BuildingClass>BUILDINGCLASS_PALACE_ALTAR</BuildingClass>
<Cost>40</Cost>
<GoldMaintenance>0</GoldMaintenance>
<Description>TXT_KEY_BUILDING_PALACE_ALTAR</Description>
<Civilopedia>TXT_KEY_CIV5_BUILDINGS_PALACE_ALTAR_TEXT</Civilopedia>
<Strategy>TXT_KEY_BUILDING_PALACE_ALTAR_STRATEGY</Strategy>
<Help>TXT_KEY_BUILDING_PALACE_ALTAR_HELP</Help>
<ArtDefineTag>ART_DEF_BUILDING_GPALACE_ALTAR</ArtDefineTag>
<MinAreaSize>-1</MinAreaSize>
<Happiness>1</Happiness>
<ConquestProb>66</ConquestProb>
<HurryCostModifier>25</HurryCostModifier>
<NeverCapture>true</NeverCapture>
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>19</PortraitIndex>
</Row>
</Buildings>
<Building_ClassesNeededInCity>
<Row>
<BuildingType>BUILDING_PALACE_ALTAR</BuildingType>
<BuildingClassType>BUILDINGCLASS_PALACE</BuildingClassType>
</Row>
</Building_ClassesNeededInCity>
<Building_YieldChanges>
<Row>
<BuildingType>BUILDING_PALACE_ALTAR</BuildingType>
<YieldType>YIELD_FAITH</YieldType>
<Yield>1</Yield>
</Row>
</Building_YieldChanges>
<Building_Flavors>
<Row>
<BuildingType>BUILDING_PALACE_ALTAR</BuildingType>
<FlavorType>FLAVOR_RELIGION</FlavorType>
<Flavor>10</Flavor>
</Row>
</Building_Flavors>
<Language_en_US>
<Row Tag="TXT_KEY_BUILDING_PALACE_ALTAR">
<Text>The Palace Alter</Text>
</Row>
<Row Tag="TXT_KEY_BUILDING_PALACE_ALTAR_HELP">
<Text>The Palace Alter adds +1 [ICON_PEACE] Faith.</Text>
</Row>
<Row Tag="TXT_KEY_BUILDING_PALACE_ALTER_STRATEGY">
<Text>The Palace Altar provides a boost to your [ICON_PEACE] Faith.</Text>
</Row>
<Row Tag="TXT_KEY_BUILDING_PALACE_ALTAR_Text">
<Text>The Palace Altar allows a great leader to perform spiritual ceremonies. These can be performed by a high priest or the leader personally. Inspiring faith and happiness among those closest to the throne, those officials will help garner the trust of the people. As your people explore the vast unknown, Faith provides security and hope in dangerous times while inspiring people during good times.</Text>
</Row>
</Language_en_US>
</GameData>
Lets look at WHAT this building is going to do, one step at a time. Palace Alter uses a comment <!-- Here --> which keeps things clean. You should use comments to make small notes of things. <GameData> and </GameData> is how you begin and end EVERY file for it to effect the game.
Spoiler :
Code:
<!-- Palace Altar--->
<GameData>
<BuildingClasses>
<Row>
<Type>BUILDINGCLASS_PALACE_ALTAR</Type>
<DefaultBuilding>BUILDING_PALACE_ALTAR</DefaultBuilding>
<Description>TXT_KEY_BUILDING_PALACE_ALTAR</Description>
</Row>
</BuildingClasses>
Above we are setting the Building Class, Default Version of the building and it's description name. If we made it BUILDINGCLASS_MONUMENT, then this would be a unique monument instead of it's own building. Lets stick with PALACE_ALTAR.
Spoiler :
Code:
<Buildings>
<Row>
<Type>BUILDING_PALACE_ALTAR</Type>
<BuildingClass>BUILDINGCLASS_PALACE_ALTAR</BuildingClass>
<Cost>40</Cost>
<GoldMaintenance>0</GoldMaintenance>
Above us, we set the cost of 40 hammers, and 0 Gold in maintenance. Below us, we are going to tell it what it's description targets are.
Spoiler :
Code:
<Description>TXT_KEY_BUILDING_PALACE_ALTAR</Description>
<Civilopedia>TXT_KEY_CIV5_BUILDINGS_PALACE_ALTAR_TEXT</Civilopedia>
<Strategy>TXT_KEY_BUILDING_PALACE_ALTAR_STRATEGY</Strategy>
<Help>TXT_KEY_BUILDING_PALACE_ALTAR_HELP</Help>
<ArtDefineTag>ART_DEF_BUILDING_PALACE_ALTAR</ArtDefineTag>
Now we are going to cause it to give one happiness and set it's icons.
Spoiler :
Code:
<MinAreaSize>-1</MinAreaSize>
[B]<Happiness>1</Happiness>[/B]
<ConquestProb>66</ConquestProb>
<HurryCostModifier>25</HurryCostModifier>
<NeverCapture>true</NeverCapture>
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>19</PortraitIndex>
</Row>
</Buildings>
Spoiler :
Code:
<Building_ClassesNeededInCity>
<Row>
<BuildingType>BUILDING_PALACE_ALTAR</BuildingType>
<BuildingClassType>BUILDINGCLASS_PALACE</BuildingClassType>
</Row>
</Building_ClassesNeededInCity>
The next step is telling it to produce 1 Faith in addition to it's happiness.
Spoiler :
Code:
<Building_YieldChanges>
<Row>
<BuildingType>BUILDING_PALACE_ALTAR</BuildingType>
<YieldType>YIELD_PEACE</YieldType>
<Yield>1</Yield>
</Row>
</Building_YieldChanges>
Almost done, bear with me! Time to set the flavor. We could go with religion, happiness or both. I will let you choose, i set mine to Religion.
Spoiler :
Code:
<Building_Flavors>
<Row>
<BuildingType>BUILDING_PALACE_ALTAR</BuildingType>
<FlavorType>FLAVOR_RELIGION</FlavorType>
<Flavor>30</Flavor>
</Row>
</Building_Flavors>
To be clean we will put our information right here for civlopedia entries.
Spoiler :
Code:
<Language_en_US>
<Row Tag="TXT_KEY_BUILDING_PALACE_ALTAR">
<Text>Palace Alter</Text>
</Row>
<Row Tag="TXT_KEY_BUILDING_PALACE_ALTAR_HELP">
<Text>The Palace Altar adds +1 [ICON_PEACE] Faith.</Text>
</Row>
<Row Tag="TXT_KEY_BUILDING_PALACE_ALTAR_STRATEGY">
<Text>The Palace Altar provides a boost to your Palace [ICON_PEACE] Faith.</Text>
</Row>
<Row Tag="TXT_KEY_BUILDING_PALACE_ALTAR_Text">
<Text>The Palace Altar allows a great leader to perform spiritual ceremonies. These can be performed by a high priest or the leader personally. Inspiring faith and happiness among those closest to the throne, those officials will help garner the trust of the people.</Text>
</Row>
</Language_en_US>
</GameData>
Do you notice how easy this is? At this point, you can insert another comment for another cool building - or you can make changes to this one! Remember the template i gave you for the buildings?
Now would be a good time to go into one of these 2 places:
Vanilla:
C:\Program Files (x86)\Steam\steamapps\common\sid meier's civilization v\assets\Gameplay\XML\Buildings
Gods and Kings:
C:\Program Files (x86)\Steam\steamapps\common\sid meier's civilization v\assets\DLC\Expansion\Gameplay\XML\Buildings
Open these files with Notepad++ and look at them. Start by opening the template, then looking at the buildings. Library, Monument, Shrine, Palace, and Barracks give you a good idea of what lines in the template are used by that building.
Save your file, and make some changes. Change the name of the building and always ask questions when you have them - most modders are happy to help others learn. I welcome criticism on how to improve this tutorial, and better information from more experienced modders.
Please bear in mind this is a "101" tutorial, and the target audience is the person who has never modded before but just knows if they can just add ONE building, they can add more buildings, then a unit, then more units. We all start somewhere, and this building was my start and i share it with you.
Last thing:
Open modbuddy.
Click file, new project - name it! go through the basics until it stops guiding you.
Click "open" and "file" - open your .xml file you made.
Click build - build solution. Click build then build modname (under it build solution).
Click Save All.
Open Solution Manager, and right click - click properties.
Click Action
Click Add
UpdateDatabase - Modname.
Spoiler :
this tells the mod to load itself into the database when the player clicks the green light to activate your mod.
Happy Modding!