• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

MY Add a Civ Tutorial

Thanks for the info....i figured out how to make the name change but only by altering all the appropriate in game files. ive read thats a bad idea but im not involved in a major game yet where reinstalling would kill me. But your way seems to actually add the name NEFERTITI to the game instead of replacing one right?

I actually fiddled around and found by going in leaderheadinfo and in the description line just removing TXT_KEY_LEADER_ and leave the new name by itself actually worked.

thanks for the tips and im sure ill be asking more questions as i get deeper into this modding.....
 
Thanks for the info....i figured out how to make the name change but only by altering all the appropriate in game files. ive read thats a bad idea but im not involved in a major game yet where reinstalling would kill me. But your way seems to actually add the name NEFERTITI to the game instead of replacing one right?

yes you add the file info so that TXT_KEY knows where to reference it

it will still replace Hats name as long as you use that TXT_KEY tagline instead of the original version


I actually fiddled around and found by going in leaderheadinfo and in the description line just removing TXT_KEY_LEADER_ and leave the new name by itself actually worked.

thanks for the tips and im sure ill be asking more questions as i get deeper into this modding.....


you can do that also...

my way just lets you translate the name in different languages (if you want)

I just use it because thats how I was taught and its easier to keep track what I done

anyway both ways work ;)
 
So, you want to add a Civilisation to the hugely popular game Civilization IV?

For beginners, this can be a fairly large undertaking.
Fortunately I’m here to both guide and provide some aids.

Part 1: The tools
Before you start anything, you need to make sure you have the right tools.
We’re going to be editing XML files.

This can be done in window’s notepad, but I find that notepad++ ( http://notepad-plus.sourceforge.net/ ) is better, as it provides find and replace tools, as well as a few tools for working with XML files.

There is also going to be some Image editing and converting.
For any kind of image editing, I use Paint Shop Pro (Now at version 9).
If you’re looking for a free alternative, The GIMP ( http://www.gimp.org/ )is perfectly useable (so I’m told).
All images/textures in the game are .dds files. This stands for Direct Draw Surface, and is a texture format for DirectX..
There are plugins for Photoshop, Paint Shop Pro and The GIMP that will output .dds files, but they are very iffy. Luckily there is DXTbmp (http://www.mnwright.btinternet.co.uk/programs/dxtbmp.htm ), a stand alone program that will take in most image files and save them as any flavour of .dds.

Part 2: Planning
Now you have the tools, you need to figure out what you’re going to do with them.
So, go off and get yourself a coffee/tea/double malt scotch on the rocks…

You’re back? Then we can begin.
First off, obviously, you’re going to need to know what Civilisation you’re going to make. For this tutorial I’m going to do Australia.
After that is decided, you have to think about a few other things:
City Names: Fairly obvious here. You could only have one city name, but after that it’ll start pulling random names for your new towns.
A good idea would be to have 15+

Starting Techs: In the game all the original Civs have 2 starting techs from the first 6 available (Mining, Mysticism, Fishing, The Wheel, Agriculture and Hunting).
The Starting Techs can be any techs that are available, and you can have more then two. But unless you want to unbalance the game, stick with just having two from the starting six

Unique Units: All the original Civs have one unique unit. These units are slightly better versions of other units in the game, and actually replace them for that Civ.
Each Civ can have more then one unique unit, but this can unbalance the game if you’re not careful.

Leaders: Each leader has their own Traits and favoured civic. As with the Starting Techs and The Unique units, you can have more then what the Civs in the original game had, but again, beware of unbalancing the game (unless that’s what you’re planning on doing)

Part 3: Setup
Civ4 has a very strict directory and file structure for mods.
You are going to need to set up a structure like this, in the \\Firaxis Games\Sid Meier's Civilization 4\Mods folder
YourCiv\Assets\Art\Interface\Buttons\Civilizations \
YourCiv\Assets\Art\Interface\Buttons\Units\
YourCiv\Assets\Art\Interface\TeamColor\
YourCiv\Assets\Art\Interface\Leaderheads\
YourCiv\Assets \XML\Art
YourCiv\Assets \XML\Civilizations
YourCiv\Assets \XML\GameInfo
YourCiv\Assets \XML\Text
YourCiv\Assets \XML\Units

Or just download this .zip ( http://vic.australis.com.au/charcoal/newciv.zip ) and unzip it to the Mods folder.

Now you’re going to need to copy some of the XML files from the original game into your mod directory, as we’ll need to edit them later.
The files come from \\Firaxis Games Civilization 4 and go into \\Firaxis Games Civilization 4\Mods and the same structure.
The files you need are:
Assets\XML\Art\CIV4ArtDefines_Civilization.xml
Assets\XML\Art\CIV4ArtDefines_Leaderhead.xml
Assets\XML\Civilizations\CIV4LeaderHeadInfos.xml
Assets\XML\Civilizations\CIV4CivilizationInfos.xml
Assets\XML\GameInfo\CIV4DiplomacyInfos.xml
Assets\XML\Interface\CIV4ColorVals.xml
Assets\XML\Interface\CIV4PlayerColorInfos.xml
Assets\XML\Units\CIV4UnitInfos.xml


Part 4: Making the Pictures - Graphics (Civ Flag and Leader Head)
First off we’ll create your civilization’s flag.
The flag is displayed at the bottom right, near the minimap and near each of your units.
The texture we have to create is 128x128 in size, but in game the flag is scaled down about %25 horizontally to fit on the flag model.
The easiest way I can think of making the flag is creating a 96x128 image and then stretching the horizontal %25 to 128.

I got my source image from ( http://flagspot.net/flags/au.html ), rotated it right 90 degrees, and resized it so the height was 128. Then I added some boarders to the side to make it 96 pixels in width. Finally I resized it to 128x128.
Here is the result: http://vic.australis.com.au/charcoal/ausflag.jpg
Now, save your image as a .bmp somewhere, I usually put it where the end .dds file will be put. This would be YourCiv\Assets\Art\Interface\TeamColor\

Open up DXTbmp and load the .bmp
You now should be looking at something like this: http://vic.australis.com.au/charcoal/dxtbmp.jpg
Over to the right hand side of the window it that ’Alpha Channel’ box.

The Alpha Channel is a map that tells the game what pixels of the texture are transparent, and which aren’t. In our case, all white pixels are transparent, and will show the default colour of the civilization.
So, we want to change the Alpha channel to all black.
Double click on the white part and it will load the Alpha channel in your default image editor. Bucket fill it all black, save it and click on the 3rd icon (white arrow up) to reload the edited Alpha channel.

Now go to File->Save As->DDS Texture. You be shown a save box.
Navigate to YourCiv\Assets\Art\Interface\TeamColor\ and save the file, making sure you change save type to DDS DXT 3. That is very important.

With that flag, the in game the flag turned out like this: http://vic.australis.com.au/charcoal/badflag.jpg
So, I added a border to the top, giving these (better) final results:
http://vic.australis.com.au/charcoal/ausflag2.jpg and http://vic.australis.com.au/charcoal/goodflag.jpg

With that done we’ll now do the Leaderhead image.
The original Leaderheads are actual 3D Meshes, unfortunately no one is able to make and import them yet. But we can put in static images, much in the same way we did with the flag.

The Leaderheads also have the same problem of being a square texture, but showing in a rectangle that is ~%25 smaller horizontally. The only difference is that the texture is a 512x512.
So, doing the same thing we did with the flag, make/get a base image that is 384x512 and then resize it to 512x512.

I’ve decided to have John Howard as the leader for the Australians, mainly because he was the easiest to get a picture for.
Source image: http://www.defenselink.mil/photos/Jul2005/050718-D-9880W-065.jpg
I just cropped out Howard at about 0.75 ratio, then resized it to 512x512.

This time when you run it through DXTbmp, just leave the Alpha Channel white.
Then save it to YourCiv\Assets\Art\Interface\Leaderheads\

Part 4:Making the Buttons - Graphics(Buttons)
Now we have to make three buttons, one for your Civ, one for your leader and one for your Unique Unit.

For all three buttons, here is a border and Alpha channel:
Border: http://img309.imageshack.us/img309/4900/civ4bracket2rt.jpg
Alpha Channel: http://img186.imageshack.us/img186/5908/buttonalpha3zi.jpg
Save both of these somewhere.

First off, I’m going to do the Civ button.
This is going to be the image for the flag, put into the above border. I imagine that you know how to do that. If you don’t, it isn’t needed, but it’ll make it look nicer.
Load the finished image into DXTbmp, then click on the first button under Alpha Channel. This is how you load the Alpha Channel bitmap you saved before.
Navigate to the Alpha Channel bitmap and load it.
Then save the .dds as to YourCiv\Assets\Art\Interface\Buttons\Civilizations\
, using the same options as before.

Next up is the Leader button, again, I’m going to get this from the image I made before, and merge it with the border image.
Run it through DXTbmp, with the same Alpha Channel bitmap, and save the file in YourCiv\Assets\Art\Interface\Leaderheads\, obviously with a different name then the actual Leaderhead picture.

Lastly we need to do our Unique Unit button.
This is exactly the same as the last two, except we need to find/make a new source image.
Here is mine: http://www.heatwave-toys.com/hwt_2001/image/pics-bbi/mls-bbi-ef-sasr.jpg
Run it through DXTbmp, exactly the same as the last two times and save it in YourCiv\Assets\Art\Interface\Buttons\Units\

My 3 buttons: http://vic.australis.com.au/charcoal/buttons.jpg

Part 5: Making the Words - XML(Text XML)
First off I’ll try to provide a crash course in XML.
XML is a way of storing and organising information..
Most, if not all information is enclosed by tags, these tags look like this:<tag>information</tag>
The tag part can be anything, usually it’s something that describe what the information is.
There are also these tags:<tag/>
<!-- Comment -->

The first one is used when (in this instance), there is no information for this tag and the second is used for comments.
I think that’s about all you need to know. Just be wary of typos in tags, if your not copying them from somewhere.

Now, to the XML text file.
This file is a little different from all the other XML files, mainly because it’s name can be anything and it’s loaded in addition to the same (types) of XML files that come with the game.
Anyway, this file contains the text that will be shown in the game.
All the other XML files reference these text XML files when anything is needed to be written to the screen. This is so multi-language is made easier, and when one section of text it’s needed to be used multiple times.
With this it’s only needed to be written out once, rather then every time it’s needed to be used.

Everything in this file is in this structure: <TEXT>
<Tag>TXT_KEY_CIV_YOURCIV_DESC</Tag>
<English>Your Empire</English>
<French>in French</French>
<German>in German</German>
<Italian>in Italian</Italian>
<Spanish>in Spanish</Spanish>
</TEXT>

I imagine it’s fairly straight forward.
First it opens a TEXT tag, this is just a way of telling the game “Hey, everything up to the close of this tag, is all together”
Next it opens a TAG tag. The text that is contained within this tax is what will be used in the other XML files to print this line (depending on what language you are using).
After this is the tags for the individual languages that are needed.
And that’s it about the file.

Here is a text XML file that contains the basics of what you’ll need to make a civilization: http://vic.australis.com.au/charcoal/GameTextInfos_YourCiv.zip
Download it and unzip it to in your YourCiv\Assets \XML\Text directory, then open it up for editing.
It’s a slightly edited version from this tutorial: http://forums.civfanatics.com/showthread.php?t=144425
While the file is good, the tutorial isn’t complete.

All the data in this file is very easy to understand, just change all the YOURCIV, YOURLEADER and YOURUNIQUEUNIT parts of each tag and then the information contained in each of the tags below it.

Part 6: Adding the Civ - XML(Civilization Infos and more text XML) (long)
Navigate your way to Assets\XML\Civilizations and open CIV4CivilizationInfos.xml.
This file contains all the information about the civilizations.
What we’re going to need to do is add another entry for Australia.

The easiest way to do this is copy and then edit one of the civilizations that are already there.
I copied the American Entry and have edited that.

If you look at the entries for the tags Description, ShortDescription and Adjective, you should see that they match up with entries in the GameTextInfos_yourciv.xml file.

For now, don’t worry about the DefaultPlayerColor tag.
I’ll cover that one later.

Have a look at the city tags now. They should look something like TXT_KEY_CITY_NAME_WASHINGTON.
Look familiar?
They are the same type of tags that Description and the rest use.
If you put 2 and 2 together, you’ll figure out that the city names are put into the GameTextInfos_yourciv.XML file…
These are a little different then the other texts, mainly because they are names, and how different languages handle names. Here is an extract from CIV4’s City name file: <TEXT>
<Tag>TXT_KEY_CITY_NAME_WASHINGTON</Tag>
<English>Washington</English>
<French>
<Text>Washington</Text>
<Gender>Male</Gender>
<Plural>0</Plural>
</French>
<German>
<Text>Washington</Text>
<Gender>Male</Gender>
<Plural>0</Plural>
</German>
<Italian>
<Text>Washington</Text>
<Gender>Female</Gender>
<Plural>0</Plural>
</Italian>
<Spanish>
<Text>Washington</Text>
<Gender>Female</Gender>
<Plural>0</Plural>
</Spanish>
</TEXT>

Fairly self explanatory, and if you want you can just include the English entry, but I don’t know what will happen when people from other languages play the mod.

Anyway, copy that code, and put it at the end of the GameTextInfos_yourciv.XML file. Then edit the Tag name and the entries beneath it.
After you’ve done that, go back to the CIV4CivilizationInfos.xml and add in the new city name tags.

I’m going to put in 20 cities and be lazy, by just putting in the English ones.
Got the list of cities from here: http://www.reference.com/browse/wiki/List_of_cities_in_Australia

After this we have the Units/Unit tags.
This is where the Unique Unit is assigned to the Civ.
There needs to be a bit of explaining here.

There are tags for UnitClassType and UnitType. Each basic unit is in it’s own UnitClass, wether their Workers, Macemen or Stealth bombers.
The Unique Units share the UnitClassType with the unit they replace.
So, for example: Unit Name: Worker Fast Worker
UnitClassType: UNITCLASS_WORKER UNITCLASS_WORKER
UnitType: UNIT_WORKER UNIT_FAST_WORKER


With that explained, you might want to go hunting around \New Civ\Assets\XML\Units\CIV4UnitInfos.xml to find the unit class of the unit that you want your Civ’s Unique Unit to replace.

In adding Australia’s SAS, it isn’t going to be much different from America’s Navy Seal. It’s actually going to be of the same UnitClassType.
So all I have to do here is change the UnitType.

Next up is the FreeUnitClasses/ FreeUnitClass tags.
This is a way for you to give extra units at the start of the game to your civilization.
There are two tags here: UnitClassType and iFreeUnits.
The first one, is as with the last one, the unit class, not the actual unit it’s self.

The second tag needs a little explanation.
At the start of the tag is an “i” this means that the information contained between the tags is an integer, or any whole number.
Whatever number you put here is the amount of that type of units you’ll get extra at the start.

So, with this, you could give a Civ 2 extra Warriors or 1000 ICBMS at the start. Also, you can give the Civ more then just one type of unit, just copy everything between the <FreeUnitClass> and </FreeUnitClass> tags, then modify them

All the original civs give 1 of the UNITCLASS_SETTLER, so I suggest you do the same. And leave it for balancing issues.

Now we move onto the FreeBuildingClasses/ FreeBuildingClass tags.
This is a way to give your Civ a building at the start of the game.
Again, there are two tags here: BuildingClassType and bFreeBuildingClass
BuildingClassType is the same as the UnitClassType we worked with just before. Except, it’s obviously for buildings.

The other tag, bFreeBuildingClass, is yet another that needs a little explanation.
The “b” at the start means that it’s a Boolean tag. For those that don’t know, that means that it can be either “True” or “False”, these are represented by 1 or 0 respectively.
You’ll notice that all the ones in the file are given a 1. This indicates that it is a Free Building. You could add a BuildingClassType and make the bFreeBuildingClass eual 0, but then it would behave as a normal building.

With this you could give your Civ a Hospital from the start, but I think that it only gives one building of that type.

All the original civs again have one here. They give a BUILDINGCLASS_PALACE, which obviously is the Palace. I suggest you do the same and leave it for balancing issues, again.

Next we have the FreeTechs/FreeTech tags.
This is where the techs that each Civ starts with are listed.
As with the others, there’s 2 tags: TechType and bFreeTech
TechType is the tag of the tech, and bFreeTech works like the one for the free buildings.

As explained before, all original Civs have 2 techs from the first 6 that are available.

Next up there is a closed tag for DisableTechs.
So, if you wanted you could disable some techs for your Civ, but I’m not going to go on about it here.

Moving on we have the InitialCivics and AnarchyCivics.
Self explanatory, it’s the civics that your Civ is on at the start of the game and during the anarchy after changing Religion or Civics.

All the original Civs have the “basic” Civics for both of these, but you could easily change them.

Now we have the Leaders/Leader tags.
Much the same as most of the others, two tags: LeaderName and bLeaderAvailability.
LeaderName is something that we will be adding later, but you can add in what it will be, should be along the lines of LEADER_LEADERNAME.
Then bLeaderAvailability, is weather the leader is available.

I think you could add leaders from other civs into this, so with a little editing, you could have Ghandi leading the French, or Washington leading the Germans.

Finally we have the CivilizationSelectionSound and CivilizationActionSound tags.
I personally am not too sure about sounds (yet), so just leave them.
You could possibly make them closed tags, if you wanted

...

Sorry, Charcoal, but I find this hard to understand. What XML document contains the text with different languages? Also, note that I am building this in the Warlords directory.
 
Sorry, Charcoal, but I find this hard to understand. What XML document contains the text with different languages? Also, note that I am building this in the Warlords directory.


any xml files in the text folder

Path: assets\XML\Text folder

for example in the CIV4GameTextInfos_Objects.xml File:


Code:
	<TEXT>
		<Tag>TXT_KEY_UNIT_KNIGHT</Tag>
		[COLOR="Blue"]<English>[/COLOR]Knight</English>
		[COLOR="Blue"]<French>[/COLOR]
			<Text>Chevalier</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>
		</French>
		[COLOR="Blue"]<German>[/COLOR]
			<Text>Ritter</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>
		</German>
		[COLOR="Blue"]<Italian>[/COLOR]
			<Text>Cavaliere:Cavalieri</Text>
			<Gender>Male</Gender>
			<Plural>0:1</Plural>
		</Italian>
		[COLOR="Blue"]<Spanish>[/COLOR]
			<Text>Caballero:Caballeros</Text>
			<Gender>Male</Gender>
			<Plural>0:1</Plural>
		</Spanish>
	</TEXT>

notice the different language taglines

similarily a "blank" tagline template following this format would look like this:


Code:
	<TEXT>
		<Tag>TXT_KEY_</Tag>
		<English></English>
		<French/>
		<German/>
		<Italian/>
		<Spanish/>
	</TEXT>


any language changes you can add by following the english tagline example.

Hope that helps ;)


PS Unsure if this works in Warlords... but I dont see any problems
 
Okay, first of all, great tutorial. It was really a huge help at tackling this really, honestly, intimidating thing. I did of course do some adapting (so, my Civ has a unique building) to Warlords, but it works fine.

Two things, howsoever: One, whenever I start up, I'm bombarded with error messages telling me some color references are wrong (i.e. Orange) but my Mod runs fine nevertheless. I do wonder why they are happening (I shall post the exact contents of each message if it is asked), and what they exactly mean, and why when I doublechecked each path it asked about it persists.

Second, whenever I try to enter WorldBuilder, it crashes. To be expected, but I wonder if there is a way to avoid that?

I also had a problem with my flag, but I fixed that, and other than the above, the civ runs very fine. Thanks, both for the tutorial and in advance.
 
Okay, first of all, great tutorial. It was really a huge help at tackling this really, honestly, intimidating thing. I did of course do some adapting (so, my Civ has a unique building) to Warlords, but it works fine.

Two things, howsoever: One, whenever I start up, I'm bombarded with error messages telling me some color references are wrong (i.e. Orange) but my Mod runs fine nevertheless. I do wonder why they are happening (I shall post the exact contents of each message if it is asked), and what they exactly mean, and why when I doublechecked each path it asked about it persists.

Second, whenever I try to enter WorldBuilder, it crashes. To be expected, but I wonder if there is a way to avoid that?

I also had a problem with my flag, but I fixed that, and other than the above, the civ runs very fine. Thanks, both for the tutorial and in advance.



Im not sure cause I havent worked on warlords version...

but do you use existing colors and player colors? or do you use the tutorial to make new colors?

if you make new colors do they appear correct in your mod?

check some of the taglines and make sure they are correct... XML is pretty picky about syntax (comma/period/space/proper tagline info/etc)

Finally if it works and it doesnt slow performance... I wouldnt worry about it too much.... :crazyeye:
 
Turns out I *did* need to adjust for Warlords. Hah! At any rate, Worldbuilder works now (no idea why), and the colors are in order.

But all is not well. For starters, Kublai Khan's background (stony, ivy wall) has this red line running along the bottom. Why? It's not a big problem, it just pesters me.

And I'm having some trouble with the UB, but alas, that's Warlords for you.

Anyway, if anyone has any solution as to why that red line is there, I'd appreciate it.
 
Turns out I *did* need to adjust for Warlords. Hah! At any rate, Worldbuilder works now (no idea why), and the colors are in order.

But all is not well. For starters, Kublai Khan's background (stony, ivy wall) has this red line running along the bottom. Why? It's not a big problem, it just pesters me.

And I'm having some trouble with the UB, but alas, that's Warlords for you.

Anyway, if anyone has any solution as to why that red line is there, I'd appreciate it.

sorry I havent modded in warlords yet :rolleyes:
 
When I load the Mod i get error messages lol :crazyeye: :crazyeye:

The name appears on the list of civs you can choose from, but like this

TXT_KEY_CIV_LEADER_VAYNE
TXT_KEY_CIV_ARCHADIA

nobody appears in the civilopedia

the game shuts dome just when its done loading :crazyeye: :crazyeye: :crazyeye: :crazyeye: :crazyeye:
 
When I load the Mod i get error messages lol :crazyeye: :crazyeye:

The name appears on the list of civs you can choose from, but like this

TXT_KEY_CIV_LEADER_VAYNE
TXT_KEY_CIV_ARCHADIA

nobody appears in the civilopedia

the game shuts dome just when its done loading :crazyeye: :crazyeye: :crazyeye: :crazyeye: :crazyeye:

see post 144 for answers for the TXT problem

usually the game crashes because the art file (.dds) are the wrong size or wrong type...

check all the art files you edited/added
 
OH NO!!!!!!! I am not going to reread this tutorial, so I can't say for sure, but I think it neglects to mention that you should COPY THE FILE TO EDIT IT, not directly modify XMLs! I am going to have to reinstall my game because I edited the original files. Don't blame me, I am not a modder!
 
The game goes crazy... My leader is Pink and my Cities are named TXT_CITY_GUNGA_CITY or things like that...Whats Wrong?! Here is my Mod: Hopefully someone can fix it...
 
When i copy the files from the civ 4/assets/xml. They are some kind of link to the internet, and my browser says they page cant be displayed. Does anyone know what to do.
 
i would really like some help with this. its been a few days and i want to get my civ running. I dont know if i am suppose to compy those files to notepad or what to do. As i said all the civ4/assets/xml are a link to the internet. And when i copy them to my new civ folders it says the page can be displayed.
 
I guess i found out how to edit it. But it still does not work i hope someone will take a look at it and see if they can help me out
View attachment 149828

I deleted the leaders picture to make room.

Open them with notepad:D

And I would like to say, thank you for this tutorial. I only have a few problems; the problem of pink buttons. But I think this issued has been handled before so you can just give me the number of the post. :D. My flag doesn't show up at all in the game. And the fact my custom made unit isn't quite available. I set everything to their destinctive path, but in civilopedia and in game. I still see a picture of a normal warrior.

The only thing I did recieve from my art file is my leaderhead :D
 
Back
Top Bottom