New XML Tags

n003lb

Warlord
Joined
Oct 24, 2005
Messages
159
Location
Air Capitol - Wichita, KS, USA
I have not been working with XML for very long at all. Just started learning it when I got Civ IV. I do know enough about it to know that one of the reasons it is so nice is that you can create new tags to suit your needs. How does one do that in Civ IV? I mean, how do you tell the game what to do with your new data?

What I am trying to do here is figure out a way to allow Helicopters to travel over coast tiles. I am not sure if there is a way to do this with XML. I thought maybe we could create a new tag that would allow a unit to travel over specific tiles only. Then we could add the terrains that the helo could traverse (all lands except peaks, and coast). A better idea, if possible, would be to create a tag that allows the unit to traverse specified terrains in adition to the unit's chosen domain. An example: Gunship is a Land unit. Add Coast to this new tag, and then the gunship can travel land tiles and coast. Another use for this would be arctic soldiers or explorers. They travel like any land unit, except they can also travel on Ice terrain (with the new tag).

Does anyone that knows something about XML think this could be possilbe, or am I gonna have to wait for the SDK?

3LB
 
More likely than not, you would handle this through Python. XML simply holds the data; Python is what tells Civ how to handle the data. Sure, you could add a new tag, but until you tell Civ what to do with it, it would be useless.
 
donquixote235 said:
Sure, you could add a new tag, but until you tell Civ what to do with it, it would be useless.

That's what I an wondering. How do we tell Civ what to do with the new tag?

I thought Python was only for event scripting. I didn't think it had anything to do with how the game actually processes data.
 
n003lb said:
I didn't think it had anything to do with how the game actually processes data.

It does and it doesn't. You can look through the python files in your assets folder to get a sense of what it processes. You will need at least a rudimentary understanding of how an object-oriented laguage works though. If you've ever used C++ or Java, you shouldn't have too much trouble figuring it out.

Much of the data, including how units behave in the Land, Air and Sea domains is defined in the actuall C++ game code that is at present hidden from us. In the future they may give it to us in the SDK or they'll pull it out of the code and make it a script. Either way, you can't do it yet.

With what we have now, it would be possible to make a mod that allows Gunships to move across water.

You would have to change the coastal and ocean types to land:

chage <bWater>1</bWater> to <bWater>0</bWater>

Then you'd have to go through all the land units and add ocean and coastal to their impassible terrian section -- look at how galleys are prevented from going in the ocean to see how to do this. Then you'd have change all the naval units domain to land, and make all the normal land terrain--grassland, plains, hills, etc--impassible to them.

Now the lame part of all this. First, I haven't tried this, but I'm willing to bet this will completely confuse the ai. They will be incapable of using naval units, if this is the case. Second, by changing the water terrian to land with that 1 to 0 switch, the game's map generators get totally confused. While it would be possible to create a custom map generation script to accomadate these changes, the ai problem is pretty insumountable without the SDK.

But hopefully with the SDK, you wouldn't have to go through all this trouble in the first place. If the unit info xml had a section where we could simply add what terrains are passable to a given unit, beyond those of its domain, or if we could asssign multipe doimains to units this would be a mod anyone could create in no more than a few minutes.

I should say again that I haven't tried any of what I've just said. It seems a lot of work to do only to find out that the AI can't deal with it.
 
eljeffe said:
With what we have now, it would be possible to make a mod that allows Gunships to move across water.

You would have to change the coastal and ocean types to land:

chage <bWater>1</bWater> to <bWater>0</bWater>

Then you'd have to go through all the land units and add ocean and coastal to their impassible terrian section -- look at how galleys are prevented from going in the ocean to see how to do this. Then you'd have change all the naval units domain to land, and make all the normal land terrain--grassland, plains, hills, etc--impassible to them.

Now the lame part of all this. First, I haven't tried this, but I'm willing to bet this will completely confuse the ai. They will be incapable of using naval units, if this is the case. Second, by changing the water terrian to land with that 1 to 0 switch, the game's map generators get totally confused. While it would be possible to create a custom map generation script to accomadate these changes, the ai problem is pretty insumountable without the SDK.

I tried something similar to this back in Civ II and again in Civ III, and yes, the AI was totally stumpped. I'm not interested in trying that again.

I did come up with the option of making the Gunship an air unit, but since Civ IV uses a different combat engine for aircraft, it didn't really work out to well.

Would there be anyway to give a land unit air missions (Air Strike, Recon)? That would do the trick, but I doubt that is possible, currently.

Mainly what I want all of this for is so I can allow DDs to carry a single gunship (later on this will be changed to an ASW Helo, but that has to wait until we can make new unit graphics). Right now, I can allow the DD to carry a gunship, but without the ability to fly over water, th DD has to close up against the coast to deploy the chopper. This isn't very useful.
 
There doesn't seem to be any way to give the gunship the airstrike or bomb commands. All that looks to be hardcoded.
 
Back
Top Bottom