Small Combat Additions for other moders to use.

Jorgen_CAB

Warlord
Joined
Feb 11, 2004
Messages
132
Location
Sweden
If it is of any interest for any modders out there, i have just incorporated an extra attack value for different terrains and features.

I managed to insert two new values into the XML schema called <TerrainAttack> and <FeatureAttack> and they do exactly what they are suppose to do, give a unit an attackvalue when they attack another unit occupying a certain type of terrain or feature plot.

Of course this did entail some minor addition to the SDK, but I will have everything documented and ready for use if it is of any use.


I have attached some picture to show this change...

http://forums.civfanatics.com/attachment.php?attachmentid=125390&d=1146489356

http://forums.civfanatics.com/attachment.php?attachmentid=125391&d=1146489356


Right now, units will not gain any defensive bonus from a tile unless they have bin stationary for at least one turn, I will incorporate a value called Light_Unit or some such to neglect this (in different terrain also, called Forrester_Unit and Hillmen_Unit and DesertRaider_Unit). Any special bonuses from Terrain or Features will not be affected by this.

All this may be used in Python as Functions/Values and also used for Promosions, haven't testet everything yet but it should work.

I have not intended to upload anything at the moment becuase this is not usable by anyone of the bat since it will require a Schema change and updating of a few other XML files. Though I will provide with information of how to do and the DLL, or to incorporate it to anyone elses project if you changed it.
 
Sounds very interesting. I'm not sure if we have a need for that in the SMAC-mod, but it sounds very cool.
 
Yes, interesting. I was noticing last night while I was studying XML files that there are open fields for terrain and feature defense, as well as terrain and feature impassables. Looked to me like you could make some units unable to enter certain terrains, for example tanks couldnt enter jungle. It isnt entirely realistic (because a tank could feasibly move in the jungle), but it could add some more stategic elements to warfare. You'd might have to go around certain terrains, or have your workers clear a path beforehand.
 
Good work with these Jorgen_CAB. I think that adding in new xml functionality with the SDK is going to be great for the modding scene.

I don't know if you're looking for new ideas to add in, but here are a few that I think most people would find useful:
1. Add in separate fields for attack and defense bonuses versus unit classes.

2. Add in a defense bonus against a single unit, like the current bonus against a single unit which is only for attack. You could also do a combined attack and defense bonus against a single unit.

I hope these ideas are possible for you to do. They seem like they should be fairly basic to add in, about the same difficulty of what you've already done. But I don't know C++ so I don't know. Thanks
 
Actually, I do think we have need for this -- native units should have a bonus when on their own "turf," so to speak. I look forward to something documented that we can make use of.

I think you can set the XML schema so these new nodes are not required, yes? Then we only have to update the schema and the units we wish changed.

I also hope this project will be integrated with whatever other efforts are ongoing to create extensible and compatible SDK mods so that we don't have to pick and choose between mods, because I think this is a great option.
 
Padmewan said:
Actually, I do think we have need for this -- native units should have a bonus when on their own "turf," so to speak. I look forward to something documented that we can make use of.

I think you can set the XML schema so these new nodes are not required, yes? Then we only have to update the schema and the units we wish changed.

I also hope this project will be integrated with whatever other efforts are ongoing to create extensible and compatible SDK mods so that we don't have to pick and choose between mods, because I think this is a great option.
That would make any XML addition by the SDK desirable to integrate.

Jorgen_CAB, I've had ideas about terrain attack bonuses on my plate for quite some time, although I admit I have not yet delved into the SDK to realize these desires. If you have done them already, no need for me to re-invent the wheel, but hopefully you can provide your code, plus documentation, so I could adapt it to the mods I'm working on :)
 
Rathelon said:
Yes, interesting. I was noticing last night while I was studying XML files that there are open fields for terrain and feature defense, as well as terrain and feature impassables. Looked to me like you could make some units unable to enter certain terrains, for example tanks couldnt enter jungle. It isnt entirely realistic (because a tank could feasibly move in the jungle), but it could add some more stategic elements to warfare. You'd might have to go around certain terrains, or have your workers clear a path beforehand.

I don't know how the feature of blocking movement in terrain for units work right now, can't you just use the XML to get that feature allready??

You can add a negative number on both attack and defence value to actually maka a weaker in some terrain if you want.
 
Gunner said:
Good work with these Jorgen_CAB. I think that adding in new xml functionality with the SDK is going to be great for the modding scene.

I don't know if you're looking for new ideas to add in, but here are a few that I think most people would find useful:
1. Add in separate fields for attack and defense bonuses versus unit classes.

2. Add in a defense bonus against a single unit, like the current bonus against a single unit which is only for attack. You could also do a combined attack and defense bonus against a single unit.

I hope these ideas are possible for you to do. They seem like they should be fairly basic to add in, about the same difficulty of what you've already done. But I don't know C++ so I don't know. Thanks

Yes, both these features would be rather easy to do, it would expand the schema somewhat, but that is not a problem, if you dont use it it will just take up some extra space on your harddrive... :)
 
Padmewan said:
Actually, I do think we have need for this -- native units should have a bonus when on their own "turf," so to speak. I look forward to something documented that we can make use of.

I think you can set the XML schema so these new nodes are not required, yes? Then we only have to update the schema and the units we wish changed.

I also hope this project will be integrated with whatever other efforts are ongoing to create extensible and compatible SDK mods so that we don't have to pick and choose between mods, because I think this is a great option.

I actually have no clue how to do that currently, but I do know that if the SDK dll asks for a value in the XLM files it has to be there. I'm not 100% sure, but I think it crashed on me when I tried to load the game and the value didn't match what the DLL called for.

But it might be a way around it, any way I don’t think it would be such a big problem to expand on the XML file a little, it will probably take a few hour for a mod.

I did all things necessary changing all the values for the latest version of the TAM mod in little over an hour to have something to test the mod against.
 
Shqype said:
Jorgen_CAB, I've had ideas about terrain attack bonuses on my plate for quite some time, although I admit I have not yet delved into the SDK to realize these desires. If you have done them already, no need for me to re-invent the wheel, but hopefully you can provide your code, plus documentation, so I could adapt it to the mods I'm working on :)

That was my plan, I'm going to document all changes done in the SDK so that anyone can just add the changes to the dll if they want. I will also provide with a .dll and documentation for what XML files that have to be changed together with the new values and functions usable with python.

If i have the time I might be ready for a first release tomorrow, but that will only include what I have done so far, no additional ideas at this point.
 
Some more teaser pictures that i posted in another post...

attachment.php


attachment.php


I also discovered my first bug that I will correct tomorrow, and that is that you can't manipulate with hill defense using either the <TerrainDefense> or <TerrainAttack> section of the XML file. This is due to the fact that you can have two terrains in one plot at the same time and therefor the hill is treated differently and I must create a new value for that like the <hilldefense> value that exists now. I will simply call it <HillAttack>... :)

You may see this in the pictures...

Other than that I have played with this for a few hour and it works like it should.
 
Jorgen_CAB said:
I don't know how the feature of blocking movement in terrain for units work right now, can't you just use the XML to get that feature allready??

You can add a negative number on both attack and defence value to actually maka a weaker in some terrain if you want.

Yes, I believe you could, if you knew the syntax. There are tags for <TerrainImpassables>, <FeatureImpassables>, <TerrainDefenses>, and <FeatureDefenses> in the UnitInfos.xml already.

Probably something like:

<TerrainImpassables>
<TerrainImpassable>TERRAIN_JUNGLE</TerrainImpassable>
</TerrainImpassables>

And giving units extra defense in certain terrains is already defined (i.e. Aztec Jaguar):

<FeatureDefenses>
<FeatureDefense>
<FeatureType>FEATURE_JUNGLE</FeatureType>
<iFeatureDefense>25</iFeatureDefense>
</FeatureDefense>
</FeatureDefenses>
 
I was hoping that someone would come up with this, good job! The lack of ability to get a bonus while attacking is a glaring omition from the game, I glad that you were able to implement it.

This is definitely a "must have" feature and I am eagerly awaiting it's release.
 
When adding new XML tags to the Schema I always make them optional so pre-existing objects dont need to be laboriously redone. The GameInfo constructor should initialize your new value to zero/Null just like Firaxis has done, then when you call the getChildElementByName function you dont need to worry about the element not being their, the function wont crash and burn on an absent element. It just keeps your defaults which saves us a lot of head aches.

Oh and for the record I think we need some unconditional attack and defence modifiers, the Zuul unit promotions have long had equivilent promotions done by messy terrain/strength combinations. It would be great to see Zuul's promotions as they were ment to be!
 
Good point Impaler[WrG]!

That's another useful idea: <iAttack> and <iDefense> tags. :)

Jorgen_CAB:
That was my plan, I'm going to document all changes done in the SDK so that anyone can just add the changes to the dll if they want. I will also provide with a .dll and documentation for what XML files that have to be changed together with the new values and functions usable with python.
:beer:
 
Impaler[WrG] said:
When adding new XML tags to the Schema I always make them optional so pre-existing objects dont need to be laboriously redone. The GameInfo constructor should initialize your new value to zero/Null just like Firaxis has done, then when you call the getChildElementByName function you dont need to worry about the element not being their, the function wont crash and burn on an absent element. It just keeps your defaults which saves us a lot of head aches.

Oh and for the record I think we need some unconditional attack and defence modifiers, the Zuul unit promotions have long had equivilent promotions done by messy terrain/strength combinations. It would be great to see Zuul's promotions as they were ment to be!

You are right, it did work and it didn't crash the game when I started it. I have predefined the values in the contructur just as Firaxis did so everything was fine as it was, must have bin a freak of nature that time then... :crazyeye:

You mean a value for general defense and attack as combat give the unit a general strength value, consider it done. I will incorporate as many different values as I can if it does not hinder the expansion of the schema.

Just give me some more time and it will be done...
 
Now it's ready to be released... I have documented all code and made some instructions, but I don't know where to put the file. It is almost 2MB and I have no clue who will host the file :confused:

I will call this the Project X Modcomponent.
 
Set up an account here and I'll authorize you to upload. Drop me an email and I"ll give you instructions :)
 
Padmewan said:
Set up an account here and I'll authorize you to upload. Drop me an email and I"ll give you instructions :)


Thank you, I have uploaded it to the site now and craeted a thread in the modcomponent section here
 
Would you consent to having your mod incorporated in the Civ4CoreComunity Project? Were planning for an initial release soon and this would be a nice feature to add. We can do all the work with access to your sorce code and the new dll will be avalible on SourceForge and probably mirrored here as well.

Here is a link to the founding thread which elaborates on our mission goals.

http://forums.civfanatics.com/showthread.php?t=167004
 
Back
Top Bottom