[TUTORIAL] Modular XML Modding With C2C

Hydromancerx

C2C Modder
Joined
Feb 27, 2008
Messages
16,281
Location
California, USA
This is a continuation of [TUTORIAL] Modular XML Modding With A New Dawn by Afforess, except this time rather than I being the student, I will be the teacher and steampunk1880 will be the student.

As said in the other thread, I asked him to follow the tutorial Afforess made for me and ask me any questions. This thread is made to help answer his questions as well as help tech anyone else who find this thread.

Now for the first questions ...

-----

steampunk1880 said:
It's bookmarked and I'd like to try to make a Municipal Computing Engine (as in the steampunk thread) as soon as possible but what's the icon and text file about?

First the icon. You can see how it is made here.

As Afforess says you will need some sort of art program, MS paint works fine.You will need to add the border around it and then use DXTBmp to put on the alpha layer.

----

As for the text, this is the most simple of the stuff. You file will look like this ...

Spoiler :

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by XMLSPY 2004 Professional Ed. Release 2, Installed Multi + SMP for 3 users (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Game Text - New -->
<Civ4GameText xmlns="http://www.firaxis.com">
	<TEXT>
		<Tag>TXT_KEY_BUILDING_OTTER_CAMP</Tag>
		<English>Sea Otter Hunter's Camp</English>
		<French>Sea Otter Hunter's Camp</French>
		<German>Sea Otter Hunter's Camp</German>
		<Italian>Sea Otter Hunter's Camp</Italian>
		<Spanish>Sea Otter Hunter's Camp</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUILDING_OTTER_CAMP_STRATEGY</Tag>
		<English>Build a Sea Otter Hunter's Camp to increase your cities wealth.</English>
		<French>Build a Sea Otter Hunter's Camp to increase your cities wealth.</French>
		<German>Build a Sea Otter Hunter's Camp to increase your cities wealth.</German>
		<Italian>Build a Sea Otter Hunter's Camp to increase your cities wealth.</Italian>
		<Spanish>Build a Sea Otter Hunter's Camp to increase your cities wealth.</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_BUILDING_OTTER_CAMP_PEDIA</Tag>
		<English>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</English>
		<French>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</French>
		<German>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</German>
		<Italian>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</Italian>
		<Spanish>Archaeological evidence indicates that for thousands of years, indigenous peoples have hunted sea otters for food and fur. Large-scale hunting, part of the Maritime Fur Trade, which would eventually kill approximately one million sea otters, began in the 18th century when hunters and traders began to arrive from all over the world to meet foreign demand for otter pelts, which were one of the world's most valuable types of fur.</Spanish>
	</TEXT>
</Civ4GameText>
You first will need to rename your file. The one above was was called Trapping_CIV4GameText.xml. Use Notepad to open it up to see.

1. You will want to keep all the top part the same.

2. The first tag is going to be the same type of tag you use throughout your building. in this case "OTTER_CAMP" but for yours it could be "COMPUTING_ENGINE" or whatever tag you decided for it.

3. Then under that you will want to put the name of the building. Instead of "Sea Otter Hunter's Camp" you will want "Municipal Computing Engine".

4. Next is some more tags with the same tag name as before. But in this strategy text you will want to say something about it such as ...

"Build a Municipal Computing Engine to increase your cities science."

whatever the most important stat is you will want to mention it in the strategy.

5. Lastly the pedia. This is usually taken from Wikipedia and is rather short (like a paragraph) You will also need to remove the foot notes that look like [2] or [5]. Those look ugly and can sometines mess up thing in the game.

6. Then save your file if you have not already.

----

This should get you started. Let me know if you ave any other questions.

Give a man a fish and you feed him for a day. Teach a man to fish, and your feed him for a lifetime.
 
This is awesome to bring up here and be willing to hold lessons on Hydro! Great idea! I could use some review myself... I'll read that thread again and once I've caught back up with this I may have some questions of my own.
 
@Thunderbrd

Well unlike with RoM/AND there was only Afforess to tech stuff. However in C2C we have many skilled and experienced modders who know many areas of the game. I am sure if you (or anyone) asked a question someone on the team would know an answer to it.

I am still very much a student, but I have enough experience to get someone like steampunk1880 started and off to being more independent. I know how frustrating it can be to be begging for stuff to be made and no one responds. This should at least give him a chance learn and contribute to C2C.

Especially when he has such a passion for alternative timelines and hardly anyone is doing anything with it. Seems like its the perfect project for him to both learn and add to C2C's awesome features.
 
While I promised I would get started on it, I just got back from a couple hours job searching. Before I leave again in an hour to go to my night job I'll try to make a button out of http://i.neoseeker.com/boxshots/Qm9...e_engine_frontcover_large_dBaezEdsWy3Kim1.jpg that giant honking computer on the cover.

I should get the "CIV4BuildingsSchema, the CIV4BuildingInfos, and the CIV4BuildingClassInfos" as well as the "CIV4ArtDefinesSchema and the CIV4ArtDefines_Building." from the Cavement2Cosmos-->assets-->XML folder right? I mean, yeah duh nevermind. OK there's gotta be a better .xml reader than the Internet Explorer it always wants to open it with..and then locks up... Notepad works. Should I copy the straight buildings schema or the AFFORESS buildings schema?

where do I get a copy of the standard civ 4 border icon. or i can probably just get it from the post about art
 
While I promised I would get started on it, I just got back from a couple hours job searching. Before I leave again in an hour to go to my night job I'll try to make a button out of http://i.neoseeker.com/boxshots/Qm9...e_engine_frontcover_large_dBaezEdsWy3Kim1.jpg that giant honking computer on the cover.

I should get the "CIV4BuildingsSchema, the CIV4BuildingInfos, and the CIV4BuildingClassInfos" as well as the "CIV4ArtDefinesSchema and the CIV4ArtDefines_Building." from the Cavement2Cosmos-->assets-->XML folder right? I mean, yeah duh nevermind. OK there's gotta be a better .xml reader than the Internet Explorer it always wants to open it with..and then locks up... Notepad works. Should I copy the straight buildings schema or the AFFORESS buildings schema?
The Afforess one. I guess maybe we should look if we can't delete the non Afforess one to avoid confusion and then maybe rename the Afforess one.
 
The Afforess one. I guess maybe we should look if we can't delete the non Afforess one to avoid confusion and then maybe rename the Afforess one.

I have been meaning to suggest this for quite awhile. I suspect "we" have made many changes since moving from RoM/AND. Btw how do I request changes to the schema and exposing the fields to python?
 
I have been meaning to suggest this for quite awhile. I suspect "we" have made many changes since moving from RoM/AND. Btw how do I request changes to the schema and exposing the fields to python?

By asking here ;) One of AIAndy or I will get to any such requests the purpose of which seems to have good levels of support before too long.
 
Using windows 7 paint I'm trying to paste the frame I got from http://forums.civfanatics.com/showpost.php?p=8921884&postcount=22 over my 64x64 pixel crop of the thingy by selecting "paste from". I get a duplicate of the blank white button. How would I make the whitespace transparent. And does it matter that the pic I'm working from is jpg and the frame I'm pasting is png when I'm going to ultimately save it as DDS.

Edit: gotta go, be back at about 10:00 PM PST
 
@steampunk1880

Using windows 7 paint I'm trying to paste the frame I got from http://forums.civfanatics.com/showpost.php?p=8921884&postcount=22 over my 64x64 pixel crop of the thingy by selecting "paste from". I get a duplicate of the blank white button. How would I make the whitespace transparent. And does it matter that the pic I'm working from is jpg and the frame I'm pasting is png when I'm going to ultimately save it as DDS.

I personally use Adobe Photoshop 7 since I have it. You may want to get GIMP which is a free art program that can do just about everything that Adobe Photoshop can. Its much more versatile than MS Paint. It should help you crop out the computer from the cover.

where do I get a copy of the standard civ 4 border icon. or i can probably just get it from the post about art

Here is the button outline and alpha channel that Affores gave me back when.
 

Attachments

  • exampleicons.rar
    5.1 KB · Views: 183
Yep... Gimp... and I too am trying to work my way around it since I'm proficient with Macromedia Fireworks and find some of its command methods a bit foreign still.

I also suggest you get Notepad++, another free to grab program that makes XML work MUCH nicer. There's a lot of little benefits for the modder in that program - anymore basic notepad bugs my eyes out.
 
Are there any other suggestions for specialized tools? For all purposes? I might should put together a civ 4 modding tools folder and populate it with clean blank xml files to copypasta as I make them, and maybe notes on how to do various things in the files when I learn them (IE "to add plus 1 unhealth to a building copy paste __________________* to this and that in these prepared blank files). And then the whole kit could be posted in the modders documentation thread as a do it yourself object maker so average Joes after me can put together their own projects.

Or maybe someone with much more experience than I have should do that. I'm still going to try to learn it the hard way though.

*don't know how to do this yet
 
I'm putting together a C2C database (starting with buildings) that will also help us keep track of what ALL our tags do... this will help guys like you and I still a bit new to some of those tags. It'll also help us all as a mod team to balance a great deal of the mod as a whole. Should be pretty cool when that comes together.

Creating a basic building template with all tags listed in a blank field xml format as a modder's building shell would be a really good idea too.
 
@steampunk1880

If you are going to have your own graphics you will need your own FPK which means you need to use "PakBuild". You can get it here. Note this also allows you to unpack existing FPKs.

Here are the example files that Affores gave me back when I was learning. They are kind of old but they should get you started.

Note the best way to find something you want is to look though civpedia and then find a building the stat you want. Then either go into the core or mods and just copy that line of code. OR ask where to find it. The attachment below should have a lot of example files.
 

Attachments

  • Example.rar
    22.9 KB · Views: 223
Ok, messing around in GIMP for an hour hasn't helped me put the frame over that attachment. Afforess says it's as simple as pasting the frame over the picture you made but no in Paint that gets me a blank white frame. And I'll be really very happy if I don't need to use GIMP ever again. Too many buttons and knobs.

Edit: one thing at a time please. I'd just like to make a button, save it as a DDS, and maybe tomorrow I can fill out the Civ4ArtDefines_Building. If I can't make a button then I'm thinking, darn, what makes me think I can do all this xml stuff.

Edit 10/31/11: removed attachment
 
Ok, messing around in GIMP for an hour hasn't helped me put the frame over that attachment. Afforess says it's as simple as pasting the frame over the picture you made but no in Paint that gets me a blank white frame. And I'll be really very happy if I don't need to use GIMP ever again. Too many buttons and knobs.

Try Paint.net. I haven't done picture editing for C2C but it's what I use for all my other photo/image editing needs. It is fairly straightforward and has much less features than GIMP.
 
@steampunk1880

Sadly buildings need buttons. You can get away with no model but the button is a requirement. Since this is your first button, its ok to make mistakes, but you will need to make it yourself.

I am not as familiar with GIMP but from what I hear its similar to Photoshop. You will need to make different "layers". With your picture there on the bottom and then the file in post #3 the next layer up. It will have a big white thing in the middle which you will have to select and then delete. Once the white space is removed you should be able to see the frame on to of your picture.

Note that I personally save an Photoshop file with it already removed and just paste stuff under the layer. I would give you the file but I do not think it would work in GIMP.
 
Erasing! Of course!

fifteen minutes later.

Button.

Hmm. Of course as soon as I try to post this the forums go down.

Edit 10/25/11:
I took jpg I had found from the internet, opened it in paint. Under view I zoomed in until I felt I could work with precision. Then using the select tool under the home tab I outlined a square 190x190 pixels and hit crop. Next I hit the resize button, changed the option from percentage to pixels and changed the 190 to 64 and saved it as a png.

I opened the png in GIMP. I selected file-->open as layers and found where i stashed the empty button.png. My picture became the background and the empty button became the first layer. Next I painstakingly used the erase tool to remove all the white from the inside of the button, having to pass multiple times in several areas to get rid of all the white (which was really annoying so I later went and made a pre-erased empty button named Actually Empty Button.png) Last, under the layer tab I hit merge down which placed the border over my picture.

The rest of the instructions on how to add the alpha layer and save it as a DDS are in that link in the OP. /end blow-by-blow

Edit 10/31/11: Removed attachment
 
@steampunk1880

Looking good! Looks like you got the alpha channel and everything!

For now you don't need an FPK yet if you don't want to.

Sicne this will be alternative timeline stuff you will want to put your mod in Caveman2Cosmos/Assets/Modules/Alt_Timelines.

There you can make a new Folder called "Steampunk".

In the Alt_Timelines Folder you will see a file called MLF_CIV4ModularLoadingControls.xml You will want to open that up with note pad and add your mod folder to it.

Spoiler :
Code:
			<Modules>
				<Module>
					<Directory>Lara_Croft</Directory>
					<bLoad>1</bLoad>
				</Module>
				<Module>
					<Directory>Dangers_Of_The_Deep</Directory>
					<bLoad>1</bLoad>
				</Module>
				<Module>
					<Directory>Megafauna</Directory>
					<bLoad>1</bLoad>
				</Module>
				<Module>
					<Directory>Sabretooth</Directory>
					<bLoad>0</bLoad>
				</Module>
				<Module>
					<Directory>Zebra</Directory>
					<bLoad>1</bLoad>
				</Module>
				<Module>
					<Directory>Zebra_Cavalry</Directory>
					<bLoad>1</bLoad>
				</Module>
[B]				<Module>
					<Directory>Steampunk</Directory>
					<bLoad>1</bLoad>
				</Module>[/B]
			</Modules>

What you want to add is in bold. The bLoad is set to 1 so it will be active. If you want the mod turned off then set it to 0.

Let me know if you have any questions.
 
On my desktop i have a folder called Municip Comp Project. It consists of 5 untouched xml documents and an art folder with a dds button in it. If I understand correctly you want me to move everything in my project folder over to a new folder called Steampunk in the Alt Timelines folder. Taking the MegaFauna folder for example would it be better to, after making a Steampunk folder, create a folder in that for the building I am creating?

And is it correct to assume the mod should be turned off by default until all of the xml is set up or it could cause bad things to happen if I tried to play C2C?

Then, in the ArtDefines_building xml, between the button tags I should write: Modules/Alt_Timelines/Steampunk/Municipal_Computer/Art/computing_engine_button.dds ?
(To keep with convention I should probably resave the button with caps at each word)
 
Top Bottom