Jump to content
IL-2 Series Forum

[MOD] AI Gunnery and aircrew despawn delay


Recommended Posts

Posted (edited)

Background (reproduced from old forum and reworked )

Based on Halfoat's work here Fewer icons & slight AI gunnery change - Mods - IL-2 Sturmovik Forum (il2sturmovik.com) I've been mucking about with the AI aircraft text files. Specifically, I used what Halfoat did as a base and expanded it to cover all the fighter/heavy fighter aircraft to change the ranges the different skill levels engage at. Halfoat's premise was that the original values are such that the Novices begin to fire only at close range and Aces begin to fire at long range (but very accurately) and this seemed backwards to what you read in biographies and general references. ie Novice pilots tended to misjudge range and open fire too far away and break off too soon scared of collision, aces fire at close range and kill with short bursts efficiently. 

I did some investigation on the accuracy of bomber gunners and assuming I haven't cocked things up it seems like generally the relative velocity differential between the gunner and attacking aircraft is the biggest factor in inducing error in the gunners aim. I used this info to make a custom version of the BlindGunners mod as it helped me tweak values. Note that attacking from dead astern with little G loading (attacker not jinking) with little relative velocity difference is as expected not a good idea if you look at the errors at range.

Formula behind bomber/rear gunner accuracy is:

error = tan (random number * ( AddCoef + (ProjSpeedCoef * speed diff)) * ((currrent overload * OverloadCoef) + CoefLow/Med/Hi/Ace)) * distance to target

I believe the error is calculated 3 times - once for each dimension in 3D space and this determines the result of each shot. Speed diff is the difference between the target and the gunner's vector in 3D space. So, for a fighter approaching slowly from the 6 o'clock, in level flight and co-altitude the difference will be solely due to the difference in airspeed. If the fighter's overtake is low, then the error will be small and likely result in the fighter being damaged. 

See turretcontrollerai.txt for explanation of parameters. Comments re constants below from Blindgunner thread

Note:

random number is a number between -1.0 and 1.0

stock skill coefficients are:

CoefLow        = 10.0f;
CoefMed        = 4.0f;
CoefHigh    = 2.0f;
CoefAce        = 0.7f; (This is the skill used for gunners on human flown aircraft)

 

Stock Constants:

OverloadCoef = 0.05f; 

// overload conversion rate to aiming units - believe Overload is the G loading on the gunner

//Comment: => this seems to be the effect on G forces, so how much the accuracy is affected by G-forces.
//High value: gunner is very inaccurate when plane is maneuvering.
//low value: gunner does not care about G forces at all

ProjSpeedCoef = 0.2f;

// coefficient of conversion of the speed difference of the object on which the turret and targets stand, in the aiming plane, to the error angles
//comment: setting this from 0.2 to 0.08 seemed to have quite an impact on accuracy
//high value: speed difference causes high inaccuracy
//low value: gunner will always be a sniper and has perfect lead to target

AddCoef = 0.05f; // default aiming error rate

MaxBotOverload = 5.0 //G loading value at which the gunner ceases to fire

EnoughAmmoCount = 150 //Ammo amount above which the turret will fire out to 3x normal range.

There are also various search time and wait time related parameters, usually by skill and all skill levels use the same burst length time range (a random time between 1 and 1.5 secs) and wait time range between bursts without consideration of ammo supply or barrel temperature. This often leads to turret guns badly overheating.

Using the mod the above values change to make the bomber/rear gunners:

  • More responsive and less likely to ignore enemies
  • Reduce MaxBotOverload to 3G for WW2 and 2G for WW1 and the overload coefficient applied is 0.1 and 0.2 respectively unless the gunner is the Fe2b gunner in which case they get a coefficient of 0.1. The Fe2b was a specific playability choice to help the aircraft perform slightly better than stock in combat.
  • Limited to the range of their weapon, no more 3x normal range
  • Use burst lengths consistent with the gun positions ammo supply and temperate constraints. Mostly this will mean shorter bursts and longer waits between bursts. This involved categorising every bomber/rear gun position with consideration to ammo supply and gun barrel temperate constraints and then allocating a min/max burst length time range and min/max wait between burst time range to each gun position. This greatly expands the granularity given by stock and generally results in different gun positions on the same aircraft having completely different firing patterns depending on weapon type and ammo.
  • Generally, less accurate than stock but the aim of the mod is to make things more believable and make players use real world tactics in attacking bombers.

AI pilots also have a hard coded min and max range at which they open fire at. In stock Ace pilots will open fire at 800m with great accuracy while Novices will open fire at 400m with much less accuracy. Essentially this mod tries to reverse this to eliminate the Ace's golden BB and imitate a typical Novice's poor range judgement by altering the min and max range to open fire for each skill level. Using these values, you will see Novices spray and pray, and Aces tend to hold fire and shoot short bursts that kill things. Other skills are in between. This definitely does make a difference and getting bounced by an Ace is usually lethal and you often don't know what hit you. Get attacked by a novice and you might get peppered a little but unless you are unlucky you are still in the fight.

Some other differences using the mod are:

  • AI fighter pilots will, depending on skill, attempt to gain a height advantage before attacking. The mod will generally increase this tendency and tend to lead to boom and zoom attacks on slow aircraft.
  •  "HitRateToDodge". Stock values are Novice = 2 ranging up to Ace = 5. I believe it is the number of hits received before jinking/breaking off an attack. I think it is meant to be related to morale and tenacity. A novice will take a couple of hits and dodge, but an Ace will persevere until taking 5 hits. Tests confirm this theory. Accordingly, I modded this value to 1 for all skills believing it might stop AI being so nonresponsive under attack at times.
  • Head on attacks are more likely.

 

Anyway, for whatever it's worth I thought to put the mod out here for people to play around with and see their feedback while also thanking and crediting Halfoat for the original work. 

I should point out that a great deal of testing is involved in changing the above-mentioned values and that many values are interrelated and often changing one can cause issues in other aspects.  Particularly the interaction between fighters and bombers is very difficult to balance to avoid impossibly difficult attacks on bombers or burning bombers falling in droves at the hand of a single human or AI fighter aircraft. 

The AI Gunnery pilot despawn delay mod is exactly what it says it is. Stock aircrew despawn on death in 15 secs and this often reduces immersion for players. The mod increases this to 120 secs with testing to ensure no major performance issue and the assumption that after two minutes the aircraft will likely have crashed and been destroyed or be exploded making the crews presence a moot point.

 

AI Gunnery

https://www.mediafire.com/file/wz432tqvea3f2o9/AI_gunnery.zip/file

(6.107b compatible)

AI Gunnery Pilot Despawn delay

https://www.mediafire.com/file/n4yganjqko7w73w/AI_gunnery_pilot_despawn_delay.zip/file

(6.107b compatible)

 

Changelog:

25 Nov 2025 - Made available in new forum

Edited by Stonehouse
  • Like 2
  • Thanks 1
Posted

Hey @Stonehouse!

 

Do you plan to create a thread here for your excellent AAA mods?

I take it you will not be able to update in the old forum...

 

Thanks for the great mods!

Posted
4 hours ago, Cardolan said:

Hey @Stonehouse!

 

Do you plan to create a thread here for your excellent AAA mods?

I take it you will not be able to update in the old forum...

 

Thanks for the great mods!

Yes, just haven't had time to organise it on mediafire plus parts of it need an update for EMGv91. Realistically it will be towards the end of next week as I am away from my pc for the next 5 or 6 days.

  • Like 2
  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...