[MODCOM] Air Forces Mod

@TheLopez

Did you take a look at lunarmongoose's work on interception and lethality tags.

Spoiler :
Mongoose AirLethalityMod 1.3 (CvUnit.cpp, CvUnit.h, CvInfos.cpp, CvInfos.h, CyInfoInterface1.cpp, CvGameTextMgr.cpp)

This modifies how damage dealt on interception is calculated. Originally it used an internal lookup table, but that had to be configured for each mod it was used with and changing the values required recompiling the DLL. It also had some limitations in differentiating units with the same intercept chance.

So! The <iInterceptionLethality> XML tag is now supported. It comes right after the <iInterceptionProbability> tag. (I threw the schema file in with the zip; it also has the <bFlying> tag in it.) Acceptable values for this tag are (-99 to -1), 0, and (1 to 100). They all do different things. Using 0 makes a unit do no damage on interception (though it'll stop the thing it intercepted from completing its air mission as you'd expect). (1 to 100) specifies the chance an intercept will be lethal. Using negatives in the range (-1 to -99) tells it to be non-lethal, with the damage done capped at the percent the sign-flipped version of your number specifies. (-40 will mean non-lethal, with damage ranging from 1% to 40% of the target's max HP. Things like this can still kill the target if it was not at full health to begin with.) The function "int getInterceptionLethality()" is available to Python as a member of CvUnitInfo (not CvUnit).

One final note, I cannibalized the unused "DomainModifier vs Air" tag to specify a special condition, which is currently only used by the Zeppelin. That unit has a "-90% vs Air" effect, which in the SDK code translates into "of all the interceptions made against this unit which prove non-fatal, 90% are then made fatal anyway". Later I will either have to special-case the python, or make it its own XML tag, to get a unique text description for the effect in the UI mouseover, but this will do for now.

Now has support for displaying iInterceptionLethality functionality in the UI, specifically in a unit's Pedia entry and in its mouseover pane. When combined with the TXT_KEY entries from the top of the now-included xml file, will cause units with any iInterceptionProbability > 0 to display either "Intercepts Deal Up To 50% Damage" or "Intercepts Are Lethal (50% Chance)", depending on settings, directly below the "Can Intercept Aircraft (50% Chance)" line.


Mongoose AirCombatMod 1.0 (CvUnit.cpp)

This is subject to change due to being relatively un-playtested, but I'm optimistic it can be kept. There are two big things this does. The first is that individual units (both air and surface) can now perform intercepts an unlimited number of times per turn. Their interception strength is still reduced if they are damaged (though this only applies to air units as before), and they cannot intercept if they did anything else this turn (bomb, recon, rebase, etc) also as before. This change is meant to get rid of the vanilla mechanic whereby the objective is to, if possible, amass more bombers than the enemy has interceptors and attack with all of them in one place, in one turn. If the defender has 10 units defending air, for example, your first 10 bombers will be at some amount of risk, but all additional bombers you throw at it on the same turn will get through unopposed. No more.

To compensate for this, surface-unit intercept values have been kept lower than fighters, stealth values on aircraft that have them (like the B2) still allow you to go in and try to ninja-bomb, and a new, more effective fighter-clearing mechanism has been implemented. Previously, the only way to offensively clear defending jet fighters was to go in with your own jet fighters under the guise of a wimpy bombing run of some type, deal with the fact that you'll get damaged or killed ~70% of the time, and try to leverage your counterattacks (damage or kill the fighter that comes to intercept you), which happen exactly 14% of the time in vanilla (assuming you're using a jet). That's a roughly 5 to 1 ratio in favor of the defender, which makes trying pretty pointless.

NOW what happens is, if you go in on a bomb or strike mission with a fighter, and the enemy's best defending interceptor is an air unit, an air battle (probably) ensues. (The actual chance is max(yourIntercept, theirIntercept), which I did b/c intercept chances universally go up with the technology level of the plane, and it seems logical the one with the better plane, be it attacker or defender, would want to push the air fight to happen rather than try to avoid it.) In an air battle (which can only be some form of fighter on some form of fighter), if the planes are equal then the odds are equal; if not the better plane has a higher-than-50% chance, proportional to the intercept difference (and stealth difference, if any), of being the winner. The winner then acts like interceptions normally do: there's a chance it damages you and a chance it kills you.

I am modifying fighters to have attack AI as well as defense AI, so that hopefully the computer players will throw some of their jets at you offensively (they don't need as many to defend air attacks under this system anyway), and thus perform the new air-superiority pseudo-mission accidentally, but still almost as effectively as if they meant to do it.


These might make good inclusions...
 
Great mod idea ! :goodjob:

About promotion, I thought of a camera promotion which reveals what is constructed in a city like when you have a spy in it. Maybe not a easy one to implement :confused:

but then there should be two interception mission : "intercept all" (bombing run, reco, and maybe rebase ?) and "intercept only bombing run"

an escort mission would also be great : if you bomber is intercepted by enemy fighter, your fighter in escort mode will try to intercept the enemy one first.

edit : and what about a "permanent reco mission", whith a plane always checking the same tile each turn until asked to do something else.
 
Good job
It was wat we needed for our ww2 mod
it was really weird that planes doesn't get experience, now it's corrected :) thx
 
No problem, if you think of any other air unit promotions let me know and I'll add them in :D
 
TheLopez said:
I am also looking for other ideas for air unit promotions... any suggestions?

Two things come to mind, but IRL they are used for fightercraft I think:

A stealth promotion: this could significantly increase the chance to evade interception. As button the silhouette of an F117 comes to mind.
An ICBM intercept promotion: An aircraft patrolling its city has a chance of intercepting incoming nukes on top of a possible SDI project.
 
TheLopez said:
No problem, if you think of any other air unit promotions let me know and I'll add them in :D

We made for this ww2 mod 9 new promotions used by fighters, tactical bombersw and strategical bombers -

Combat Fighter 1
Combat Fighter 2
Combat Fighter 3
wich increased
<iBombardRateChange>5</iBombardRateChange>
Combat Bomber 1
Combat Bomber 2
Combat Bomber 3
Combat Bomber 4
wich increased
<iBombardRateChange>10</iBombardRateChange>
but it will be changed to something with interception and evasion
Radar
Improved Radar

not sure if it works cause didn't have time to test it how it goes for planes
if we couldn't make getting experience by units probably wewill solved it building units starting with promotions (like tanks with blitz)

I must test your mod first and sniff some xml - maybe there will be other promotions available :). If i understand correctly from earlier posts there's no possibility to attack ground units now? It's making tough for tactical bombers used in battles to attack ground units. :(

And eventually my proposition is you can make experience for destroying unit - 2 points
and escaping by bomber from assault- 1 point. OIf course to make it more ballanced the probility of intercepting could be higher.

but i must check your modcomp first :)

:cool: If you want some buttons for one of this promotions i could send you
 
Ok i checked your - mod nice job - it works perfectly (and attacking ground units is still available) :)

You can make more promotions changing (the numbers are taken from unitinfo for stealth fighter):
<iEvasionProbability>50</iEvasionProbability>
increasing evasion probabilty - i'm not sure what can it be - maybe promotion with speed - flying with 3 machs against slower machine makes bigger probability to destroy unit or evade

and

<iCollateralDamage>100</iCollateralDamage>
<iCollateralDamageLimit>50</iCollateralDamageLimit>
<iCollateralDamageMaxUnits>6</iCollateralDamageMaxUnits>
giving new types of boms or new tactics
for example
carpet bombing - making more damage to infrastructure
i dont know how it's in english - bombs with special chemical substances (napalm?) causing much more fire. - making damage to infrastructure and ground units
cluster bombs - making more damage to ground units

and i have one question. Do you know where can i set that only tactical bombers can attack ground units, and only strategical bombers infrastructure? If it couldd help: in mod i have three combat groups - fighters, tactical bombers, strategical bombers
 
TheLopez, this looks excellent! I've been trying to integrate this into sevomod + gir but can't get it to work. I've made the changes you marked out in the sdk and xml file. One file, CIV4UnitSchema.xml, doesn't have any changes marked with <Air Forces Start> and <Air Forces End>. Can you tell me what I need to add to that file in particular? Thanks again for all of your great mod components!
 
Well, for whatever reason the schema files don't react very well to the comment tags.

The main changes were in the PromotionInfos definition here are the new tags added:
<element type="iAirRangeChange" minOccurs="0"/>
<element type="iInterceptionProbabilityChange" minOccurs="0"/>
<element type="iEvasionProbabilityChange" minOccurs="0"/>

You will need to also add their definitions in the schema file a few lines above.
 
Could you also change mechanics of interception? Now we don't see any fighter combat - only interception :( Gaining air supperiority is impossible now :(
 
It is possible, but not directly. You have to send fighters to do bombing/air strike missions... then the enemy fighters move to intercept and could be destroyed themselves in the attack.
 
Dom Pedro II said:
It is possible, but not directly. You have to send fighters to do bombing/air strike missions... then the enemy fighters move to intercept and could be destroyed themselves in the attack.

Thx :) I didn't know that as I rarely play modern times ;)
 
Sounds like an awesome mod and i'll definitely try it out here in a few moments, but i do have one request right off the bat.....


Could you make it possible for bombers/fighters to destroy RailRoads?
 
BTW ... another promotion could be to set the "seeinvisible" tag to "INVISIBLE_SUBMARINE" so you can have ASW planes.
 
mattpilot said:
Sounds like an awesome mod and i'll definitely try it out here in a few moments, but i do have one request right off the bat.....


Could you make it possible for bombers/fighters to destroy RailRoads?

This is already done in my route pillages mod.
 
mattpilot said:
BTW ... another promotion could be to set the "seeinvisible" tag to "INVISIBLE_SUBMARINE" so you can have ASW planes.

Ya know thats actualy a good idea!!!!
It would require a bit of SDK work, but I'm sure TheLopez could tackle it.
 
Lopez, (Warlords)

I'm noticing an issue with air forces. I have merged in Dale's Missile Mod and have a nuclear bomber unit now. Its expendable (with the missile tag) and has a nuke setting of 0 which causes it to nuke but not do 9 squares of fallout.

Ok great.. No problems so far... (other than I don't see a mushroom but thats another issue) So its set as a standard bomber according to your schema and new tags. UNITCOMBAT_AIRPLANE

What is not happening is there is no interception no unit seems to intercept it and it never gets bounced from its mission. I know dale has hooks out to cause an interception chance as with just using DCM we would see interception, I am wondering if Air Forces bypasses what he is calling causing no interception to be made.

Could you possibly take a look into this...
 
Ket, I tested interception before releasing the mod and it was working in both vanilla and warlords... that said the only part of the interceptTest method that I touched was the part where units get XP for successfully evading interceptions or successfully intercepting units.
 
Ok so you dont touch interception at all, hmmm ok... So I'm sure that there is nothing that Air Forces brings in that could be causing the issue then. Allright... I'll check with Impaler and make sure the CCCP is not hitting interception either.
:goodjob:

It sucks not being able to step through the code in debug (codeblocks)
 
Top Bottom