Forgotten Hope Public Forum

Forgotten Hope 2 => Singleplayer and Coop => Topic started by: Drawde on 05-02-2010, 17:02:28

Title: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 05-02-2010, 17:02:28
DOWNLOAD LINK (v1.0) (http://www.users.globalnet.co.uk/~pinniger/games/fh2aitweaks.zip)

I think I've playtested it enough now to make sure that the AI is still working correctly, so here's the first version of my SP AI tweak mini-mod for FH2 2.25.

From the readme.txt:

Quote
FIXES:
- Bots now aim and fire AT guns and mortars.
- Fixed the error with the the Sherman roof-mounted MG which caused the "Luttich" map to crash in SP mode.
- Tank HE shell min/max ranges are now consistent with those for AP shells.
- US 57mm and 76mm AT guns now have the correct AI files for mobile and static versions.
- Disabled AI use of AT mines (bots don't know how to use them correctly, so just get themselves killed charging enemy tanks)
- All open crew positions on vehicles and guns now have the "exposed soldier" setting so the AI will fire MGs and small arms at them.

CHANGES, TWEAKS + ADDITIONS:
- Completely revised the weapon AI data for all vehicle and AT gun/artillery weapons. Vehicles will (most of the time) use both MGs and shells against infantry targets and guns, and will prioritise AP, HE and special AP shells for different target types. Bots manning hull and cupola MG mounts will fire at their targets more reliably,
- Adjusted the AI data for infantry weapons. Changes to "small arms" (rifles, SMGs, MGs etc.) are minimal, but AT weapons (including grenades and explosive charges) have been tweaked significantly.
- Aircraft will strafe ground targets more, and (except for the Hurricane IID) will prioritise infantry and light vehicles. Still can't get them to drop bombs, though.
- Adjusted the "strategic strength" and "temperature" values in vehicle AI files, so bots are more likely to select vehicles and crew positions based on their effectiveness.
- Bots will avoid using (unarmed) passenger + tank rider positions on vehicles - they rarely know how to use these effectively, or when to get out, making them deathtraps.
- Bots will not attempt to move mobile AT guns (other than turning them in place) - as they don't really understand how to use mobile guns properly (treating them like extremely slow tanks).
- Bots will now fly spotter planes (they don't know how to use the artillery spotting ability, but the "radar" effect is useful for the player)
- Added unique AI files for vehicle + gun types that were either missing them completely (e.g. Cromwell, Churchill) or which used AI files from another vehicle of the same basic type but different function (e.g Opel Blitz Flak, SdKfz.251/10)
- Vehicles (and other PCOs) of the same basic type (e.g. all Sherman variants other than the Firefly and M4A1/76mm) now share object and weapon AI files. Static and mobile versions of AT guns now also share weapon AI files, though they have seperate object AI files.

KNOWN PROBLEMS (other than the usual BF2 AI issues, and pathfinding issues - such as tanks getting stuck and aircraft crashing into the ground - which are dependent on map scripting)
- Aircraft don't use bombs/rockets, despite all my attempts at getting them to do so. Maybe in the next version...
- Bots don't use static artillery (25pdr, LeFH18, US 105mm, Nebelwerfer) - although they will use emplaced mortars.
- Bots rarely seem to use static defensive MG positions.
- Bots don't fire certain vehicle gun positions (such as the Vickers .303 on the LRDG Chevy, and the rear MG34 on the SdKfz.251) although they will man them.
- The "Goodwood" map still crashes after around 15-20 minutes.

Now I've got a basic playable version out, I'll work on more AI fixes for the next version - including artillery, aircraft bombs and radio commands (no guarantees I'll be able to get any of these to work, but I can try!)
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Zoologic on 05-02-2010, 18:02:58
Cool, i'm downloading and will give feedback soon.

I hope Winterhilf and Legion see this too.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 05-02-2010, 19:02:13
*As Jumjum would've said in this instance*
Huzzah!

Thanks alot for this... Mortars?! Did I hear mortars?! DLing now and will give feedback...erm, I think I'm going to have to bottle the acid about this one though...

You just made my weekend, man!


Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Zoologic on 05-02-2010, 19:02:33
Tried a few hours.

First thing, map tested: Luettich (crashed, not AI related, perhaps map related), Aberdeen (crashed, same reason), El-Alamein (fine).

On Luettich i noticed that the tanks are very active, except a few sound effect glitches that were present since FH2.25. The infantry explores every corner of the map, including the bocage! Finally see some good fights there. Also, the American brought their tanks in from the first!

On Aberdeen, it is intense tank battle. They fire from long range, almost barely visible. But it is cool, and i like it. Getting surprised by 2 Pdr gunner. Now i see that bots don't easily jump on Chevy's bunk, Chevies are mostly manned by 2-3 men, all manning gunner or driver positions.

On El-Al... AA-guns work perfectly! I was pwned by their FlaK 88!!! The Vierlings are even deadlier. Also, i noticed that the AT guns are also very active, giving you more challenge. Also, mortars! When we raided the German positions, i was greeted with explosions which noises are previously unfamiliar... it was the mortar shell landing around us! Cool!

One thing i see to be added to your list:

-Looks like 20mm gunned vehicles don't fire their weapon (Panzer II and SdKfz.222), they just point the cannon but don't shoot at all. Saw this on Aberdeen and El Al.
-Some of the bots in El Al stuck inside several tent spawn points, a recurring problem, i saw this on Bardia, Giarabub, any map with spawn point inside a tent.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 05-02-2010, 22:02:16
My conclusion: Quite interesting

The Good
1/ AT guns and tanks fire from slightly further off than in 2.25
2/ The patch is so simple to apply, it defies BF2's supposed-not-to-have-been modability
3/ Bots certainly don't just jump on AT guns, but they use them quite effectively
4/ German tanks are as deadly to allied tanks as the other way round. We, the Germans held the Brits in Goodwood at their start base once we did a counter-attack and took Cagney eyc
5/ LOVE the way the Marder I maneuvers. as it doesn't have a turret, it doesn't allow its side to face the enemy, but turns corners sharply to keep its edge
6/ Mortars! Morars! WTF, Mortars! However, they don't seem to fire at really long range or really close range, but tend to fire within some distance and then, once the enemy is closer (But still within their range), they stop. In Alamein it was cool - But for some reason, they didn't fire in Tobruk
7/ Firing at humans on vehicles
8/ Non-movable mobile AT guns.. genius!
9/ The semovent is ALIVE!
10/ Tiger seems alot more maneuverable, hardlyh showing is back to the enemy
11/ Had an mg42 bipod gunner prone and fire at range.. but I think he was attacking those close to him and simply decided to pick of others further off afterwards - Still, was great to see it for the first time
12/ Hope that tanks can fire all their salvo - HE, AP and mg
13/ PzII fires more frequently, especially from range, but like always, stops firing altogether when right next to the enemy
14/ Bot infantry are quite agressive, almost conscious of player orders like move here....

The bad
1/ Bots still stick to mobile vehicles without ever bailing - Even trucks and APCs... and so that top mg issue in Luttich with the Axis jumping into the mg position atop the Panther still occurs
2/ Bots don't seem to know what each shell type is for. Sure they fire HE, AP and mg, but they fire AP and maybe mg more at infantry - Infact, the least thing they do use is HE on infantry, even less so that in the original 2.25 ai
3/ AT guns without AP still try to fire at infantry
4/ Don't think tanks use Capped AP - We still have the Valentine and Matilda in Sidi Rezegh pushing us all the way back to the main German base without the taking a single damaging hit, which should be if they used capped AP - They only use HE accidentally when firing at other tanks
5/ Now planes use mg on ground targets, which is so innacurate and thanks to BF2's hit detection of little consequence - You might want to keep them using HE on infantry and lightly armored vehicles - mg should only be used for ranging fire at enemy planes, and the Stuka should NOT engage other planes
6/ Now the Stuka flies like a turkey again as per 2.15
7/ bots don't even use the mgs they used to such as the Vikers and Mg15
8/ Marmon Herrington doesn't attack infantry anymore

The wierd
1/ PZ11 fires at planes with its main gun
2/ Allies with semi-auto fire their guns as fast as full auto and smgs! they fire the G43, M1 and M1A1 as fast the frigging thomson?
3/ AT rocket infantry (All of them) fire from way to far - Had a zookman firing from one end of Mortain to the other... even out of view

Hopes for the next update
/Restored aircraft firing HE
/Stuka strafing, using divehorn and planes dropping bombs and rockets
/Tanks firing HE at AT infantry and lightly armored vehicles, mg at other infantry, AP at other tanks, capped AP at heavier tanks, He or mg at AT guns, not AP
/Tanks not closing all the way in
/AT guns with HE using them on infantry
/ Howitzers
/ Mobile vehicle mounters being able to switch from gun to driver(when without driver), driver to gun (when attacked), bailing once close to destination (For any other position)
/Germans using the gabelt ladung or switching their kits with the gabelt grenade



hey, thanks for the mod - It certainly adds quite a bit - Just loving Goodwood now.... :-)

Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: cannonfodder on 06-02-2010, 04:02:39
Awesome...

Can't try it 'til later, but I posted the link over on BFSP (hope ya don't mind) so more people will get to reap the benefits of your hard work... :)

 - http://www.battlefieldsingleplayer.com/forum/index.php?showtopic=14805
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Zoologic on 06-02-2010, 06:02:40
Strange djinn, it is quite the opposite in my PC, although some issues you mentioned do occur sometimes.

The Good
1/ AT guns and tanks fire from slightly further off than in 2.25
2/ The patch is so simple to apply, it defies BF2's supposed-not-to-have-been modability
3/ Bots certainly don't just jump on AT guns, but they use them quite effectively
4/ German tanks are as deadly to allied tanks as the other way round. We, the Germans held the Brits in Goodwood at their start base once we did a counter-attack and took Cagney eyc
5/ LOVE the way the Marder I maneuvers. as it doesn't have a turret, it doesn't allow its side to face the enemy, but turns corners sharply to keep its edge

Agreed! Exactly what I observed.

Quote
6/ Mortars! Morars! WTF, Mortars! However, they don't seem to fire at really long range or really close range, but tend to fire within some distance and then, once the enemy is closer (But still within their range), they stop. In Alamein it was cool - But for some reason, they didn't fire in Tobruk

It is fine that way djinn... because the mortar lags (it projectile has to travel upward first then downwards, there is a slight lag time in that). So up close, it wasn't too effective. And also, i think the bots must see their opponents first before making a decision to fire (be it visual or on radar, sadly FH2 disables enemy viewing from radar/compass)

Quote
7/ Firing at humans on vehicles
8/ Non-movable mobile AT guns.. genius!
9/ The semovente is ALIVE!
10/ Tiger seems alot more maneuverable, hardlyh showing is back to the enemy

Same thing here.

Quote
11/ Had an mg42 bipod gunner prone and fire at range.. but I think he was attacking those close to him and simply decided to pick of others further off afterwards - Still, was great to see it for the first time

Yeah, i was pwned by one, in Luettich, one German bot slipped of my sight when he went prone and start spraying bullets to my position.

Quote
12/ Hope that tanks can fire all their salvo - HE, AP and mg

I saw them firing all, including Special AP rounds (High Velocity, Reinforced Penetrators). Because in Tobruk a Pz4D successfully scratched my Matilda! Because i know, their regular AP rounds fired from that short barrel cannons won't do it. Only HEAT rounds (their special AP) can.

Quote
13/ PzII fires more frequently, especially from range, but like always, stops firing altogether when right next to the enemy
14/ Bot infantry are quite agressive, almost conscious of player orders like move here....

Strange, PzII on me don't fire at all (hardly any kill message using PzII or SdKfz 222 noticed). They used to be quite deadly for infantries back in FH2.2 default.

And yes, bot is very aggressive, i saw no bots camping.

Quote
The bad
1/ Bots still stick to mobile vehicles without ever bailing - Even trucks and APCs... and so that top mg issue in Luttich with the Axis jumping into the mg position atop the Panther still occurs

In vehicles, it looks like they prefer the gun position more. When the driver bails, the machine gunners stayed and become sitting ducks.

Quote
2/ Bots don't seem to know what each shell type is for. Sure they fire HE, AP and mg, but they fire AP and maybe mg more at infantry - Infact, the least thing they do use is HE on infantry, even less so that in the original 2.25 ai
Quote

Haven't noticed this yet, but they do fire HE rounds at me most of the times, their MG spray is quite sporadic too.

Quote
3/ AT guns without AP still try to fire at infantry

True, especially British AT guns... but can't expect more, at least there is some boom boom boom around  ;D

Quote
4/ Don't think tanks use Capped AP - We still have the Valentine and Matilda in Sidi Rezegh pushing us all the way back to the main German base without the taking a single damaging hit, which should be if they used capped AP - They only use HE accidentally when firing at other tanks

I would blame that on Sidi's map design. It is designed in more MP in mind and less SP thought. In El Al, my Matilda can still be the queen of the battle, but when the Flak18 gunners spotted me, i too have to dodge every of those killer rounds. (and they are very freakin accurate, they even shoot down planes using that, human players have difficulties doing that).

And in Tobruk like i mentioned before, the Panzer 4 D (short barrel) scratched my Matilda (yeah, the HEAT rounds can only do that, at most 1/3 or 1/2 of the health bar), but the driver didn't do more than that before misfiring more precious rounds and getting killed by my uber-human skillz.

Quote
5/ Now planes use mg on ground targets, which is so innacurate and thanks to BF2's hit detection of little consequence - You might want to keep them using HE on infantry and lightly armored vehicles - mg should only be used for ranging fire at enemy planes, and the Stuka should NOT engage other planes
6/ Now the Stuka flies like a turkey again as per 2.15
7/ bots don't even use the mgs they used to such as the Vikers and Mg15

Same problem here. I don't know, the bots used to bomb us back in early FH2. Might be the problem with later BF2 patches breaking the AI code, not FH2 specific.

Quote
8/ Marmon Herrington doesn't attack infantry anymore

They FIRE AT PLANES!!! OMG. At least i saw that.

Quote
The wierd
1/ PZ11 fires at planes with its main gun

Not only PzII, Marmon Herrington, Sdkfz 222 too.

Quote
2/ Allies with semi-auto fire their guns as fast as full auto and smgs! they fire the G43, M1 and M1A1 as fast the frigging thomson?

Maybe sound engine error? Because sound from very far away can be heard as if it was next to you, producing interloping sounds. I faced bots in Luettich one-on-one with many different weapons and they all seemed normal to me (firing the rifles slowly, spraying MGs and SMGs, and train semi-auto weapons).

Quote
3/ AT rocket infantry (All of them) fire from way to far - Had a zookman firing from one end of Mortain to the other... even out of view

Same thing here, very frustrating.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 06-02-2010, 09:02:27
Yer, I'm sure infantry are too 'comfortable' with their guns now. The M1A1 carbine fires way too fast in Luttch, not to sure about the other 2 maps they are in since my PC lags like crazy in those and both Garand and G43 also fire just as fast - No sound issue, I watched the smoke and head the pings as they landed close to me

And yes, tanks only seem to fire accidental HE at other tanks. Tried Mersa which is the bastard child for any SP-attempt i.e. if SP worked well, Mersa Matru would play alright, but every little issue would show in full colour. It did! Tanks never fired HE at infantry even when swarmed with them- Didn't even see them fire mgs.

Final issue I noted was that AT-mine bots still charge tanks with their wares and try to plant them.


* A tip for all SP-devs... official or fan. If something works right, please don't modify it further, focus on the things that DON'T work. Every iteration of SP seems to bring its own issues which arre fixed only after a couple of versions, it seems. So progress is hard to quantify
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: cannonfodder on 06-02-2010, 13:02:19
I've only played one full round of El Al. so far...tried Goodwood twice and CTD twice within 5 minutes of the round starting...

Quote
Non-movable mobile AT guns...
I have to disagree on this one. They need to be able to at least rotate them, but AFAIK to do that they would have to be turned into stationary guns due to different controls.

We lost Mit. Ridge because a bot on the 6 pdr. couldn't rotate the extra 10-15 degrees needed to bring the Panzer capping the flag into his sights. ::)

The other things I noticed were the bots like the Flak38 and love the Marmon...had a bot bail out of the driver's seat of a Chevy so he could get to it... ;D

Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 06-02-2010, 16:02:12
Wierd about the movable AT gun... I've seen bots do a 180degree with it in Goodwood

Yer, Goodwood CTDed for me too... about 5minutes I think... but it doesn't or does after 20 or more minutes if I play as German ... wierd

AND I'm getting that issue with Germans spawning in the top floor of the marder base which I thought was altogether removed! AND worse, no tanks for the Germans! Like I did with 2.2 once upon a time

It happened after I felt I was getting too much lag, so I reinstalled FH2. Simply put, Deleted FH2 folder after not finding an unistaller, deleted the FH2 folder from my documents' Battlefield 2 folder, reinstalled FH2.2, pathched up to 2.25, applied patch... got in, and realized the issues which weren't there before reinstalling...

And the last time it occured, it didn't quit till I reinstalled my PC :-( wHHy.. Just when Goodwood got good

@ Cannonfodder
A bot bailed? Never seen that since 2.25.. or even 2.2, come to think of it, save for stationary guns
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 06-02-2010, 19:02:41
Thanks to all for the comments, criticism and suggestions. I'll hopefully be able to fix/improve some of the issues in future versions.

A few things I ought to mention first:

- The mod doesn't (currently) change any of the basic AI scripts, or the AI scripts and pathfinding for maps. It only affects the AI data for vehicles and weapons.
- There are also absolutely no changes to weapon or vehicle data (damage, fire rate, vehicle handling, etc.)
- Most of the issues mentioned are not caused by deliberate changes made in the mod. Some of them are problems found in the default FH2.25 AI which haven't been fixed, and others (such as the AI not using MGs, and the extreme range of bazooka/panzerschreck bots) seem to occur despite changing the data for the opposite effect.
Other issues - such as the behaviour of infantry bots - may be caused by changes to one area of the AI data causing subtle (unintended) changes to other aspects of the AI. The BF/BF2 AI system seems to be so complex and buggy/glitchy (presumably as DICE didn't put nearly as much effort into developing and troubleshooting it as with other aspects of the game engine) that it can be very hard to predict how the bots will behave, regardless of what the AI data files tell them to do!

I'll attempt to answer some of the individual issues here:

Bots not bailing from vehicles or changing crew positions: this issue was present in the default FH2 2.25 AI (referred to as "default values", "default FH2" etc. below), I've made a partial fix for it by giving passenger seats + tank rider positions a very low priority for the AI, so they rarely bother using them. The "vanilla" BF2 bots seem to know how to use APCs, transport helicopters, etc. properly - so hopefully this issue will be properly fixable in future, either by me or a more experienced AI modder.

Tank shell use: I've tried my best here, not sure if it's possible to improve this aspect of the AI or whether the BF2 AI just isn't capable of intelligently selecting different armament types for the same weapon (which weren't, IIRC, a feature in vanilla BF2). 
For the AI "strength" values in weapons.ai, I've set AP shells to have a high priority vs. tanks, medium priority vs. light armour (guns, trucks, APCs) and low vs. infantry. HE very high vs. infantry and light armour, very low vs. tanks, APC/APDS/HEAT very high vs. tanks, very low vs. everything else, Canister very high vs. infantry, very low vs. everything else.
However, the AI's selection of shell types seems to be very haphazard/random at best. I've sometimes been shot at with HE when on foot or manning a gun, but at least as often with AP (to be fair, the bots are pretty good at killing AT guns with only AP shells). For now I'm just happy that (unlike default FH2, most of the time) they do use multiple shell types, and will (sometimes) fire at infantry + guns with both MGs and shells at the same time!

AT guns firing AP rounds at infantry: I'll definitely fix this, setting the "strength" value for non-HE shells to 0 vs. infantry should do the trick. AT guns definitely shouldn't waste time and ammo firing at targets that they have almost no chance of hitting, especially when this might mean they don't notice more important targets!

Tanks with 20mm not firing: Never noticed this myself, I've been killed by these (and the Fiat L6/40) plenty of times, in tanks, on foot and manning AT guns. The behaviour and aggressiveness/awareness of AI tanks does seem to be very variable though, even on the same map.
Regarding the Pz.II not firing at close range, this is probably because of the minimum range value, which I set to 2 or 2.5 (less than the default FH2 which is 10), I'll try reducing it to 0.5 or even 0 for non-HE shells.

Vehicles firing at aircraft: This is intentional - light vehicles with fast-firing weapons have their "anti-aircraft" value in objects.ai set to 2, which, according to what I've read on BF2 AI coding, means that they'll take "opportunity" shots at planes that fly into their field of view, but won't actively chase after and track them (as they would if you set it to 1). I've shot down quite a few planes with PzIIs and Marmon-Herringtons myself, so it seems only fair that the AI gets a chance to do the same!
This isn't a new idea/addition of my own: a number of vehicles in default FH 2.25 have this setting (including those with heavier guns, not very practical for AA), I just made it consistent (all heavier tanks have the anti-aircraft value set to 0)

Marmon-Herrington AC not firing at infantry: I'll look into this, there definitely seem to be some AI issues with this vehicle - even in default FH2 it tended to drive around not firing at anything. I've definitely seen it fire at tanks.

Bots not using stationary MGs: This is one issue that's really annoying me and I still haven't worked out why it's happening - the AI's use of AT guns is very good, but they still don't seem to understand MGs. I've given all stationary MGs high "temperatures" (which affect how likely the bots are to use vehicles and other PCOs) as well as the highest possible defensive "strategic strength", and have also given the actual MG weapons a very high strength vs. infantry in their weapons.ai files.
I have to say that I very rarely saw bots using stationary MGs in default FH2 - but whether or not my mod has made things worse, it certainly hasn't made them better! I'd really appreciate any advice from more experienced AI modders.

Bazooka/panzerschreck ranges: I noticed this too (the fog in Luttich makes it particularly noticeable). I've set the AI maximum range for these weapons to be substantially LOWER than the default values, so I'm not sure why this happens. It may be because the default minimum ranges for these weapons were so high that bots rarely used them, making the issue less noticeable.
Lowering the maximum range even more should help. What was the real-life effective range of the bazooka, panzerschreck and PIAT considered to be?

Semi-auto rifle fire rate: Seems weird, I'll definitely look into this. I haven't intentionally changed any of the rifle values, other than a few tweaks to the min/max range. Currently I haven't changed the AI data for any small arms much - only tweaking the min/max ranges and in some cases adding an "effective range" value so that bots are more likely to close in with weapons like SMGs and pistols.

Bot use of AT mines and grenades/charges: All AT/AP mines now have AI strength for all weapons set to "0" which should prevent bots from using them, certainly I haven't seen the "engineer mine charge" since changing this. I've changed the AI data for AT charges and grenades (e.g Geballte Ladung, sticky bomb) so the bots should be able to use them (previously, the min/max ranges made it very hard for them to do so) and I've certainly seen occasional kill messages for AT grenades and satchels.
Another issue is that there are still far too many AT bots around, even on infantry-only maps! I'm not sure if bot kit selection is alterable, or if it's random/hard-coded.

Aircraft strafing: I agree that planes (other than the Hurricane IID) definitely shouldn't strafe tanks with their cannons, they can't do any damage even if they hit anything. This will be easy enough to fix by setting the AI strength of their guns to 0 vs. heavy armour. IMHO strafing of infantry and light armour/soft targets (AT guns, trucks, jeeps + APCs) should be kept in, especially with 20/30mm guns (even strafing with MGs can kill exposed gun + vehicle crew)
Unfortunatly, lightly armoured vehicles like the Vickers Mk.VI and SdKfz.222, which heavier aircraft guns might have a chance of hurting, are still classed as "heavy armour" so there's no way to allow planes to attack these without also having them strafe heavier vehicles that are immune to their fire.

Aircraft bombing, Ju87 behaviour: I haven't yet worked out how to get AI planes to drop bombs. The odd behaviour of the Stuka (crashing into scenery, kamikaze dives) appeared to be just as bad in default FH2 - again, I yet haven't looked into why this is happening. The issue of the Stuka dogfighting with enemy planes will probably be less noticeable when/if it can use its bombs (so the AI can pay more attention to ground targets). I haven't changed the performance/handling data for the Stuka or any other planes, the only changes are to the gun + bomb AI data.
Bots are lethal with aircraft bombs in vanilla BF2, so this issue should be fixable. It hasn't been broken by a BF2 patch, either - I have BF2 patched to the latest version and regularly get bombed by AI aircraft, though they don't understand the TV-guided missiles (not a problem for FH2!)

Mobile AT gun issues:
I've set them to be rotateable but immobile (in objects.ai - doesn't affect player control of the gun, only bots), so far I haven't seen any problems. Bots seem to be able to rotate them in place, the same as with static guns. But the AI's behaviour does seem to be very variable!

Radio/map commands: I haven't made any attempts at fixing this area of the AI yet, and have only just started looking into it. I'm hoping to eventually get the ability to command bots closer to how it was in vanilla BF2; I'm guessing the main cause of the problem is that when the "comm rose" was replaced, the FH2 developers didn't add the AI trigger commands into the scripts for the new radio comm interface.

Mersa Matruh, and general AI map issues: This is definitely one of the more "broken" maps AI-wise (though maybe not as bad as Supercharge where the Allied AI seems to be unable to understand how to get into the walled town that's the main German base). But my experience with Mersa Matruh (playing as the Allies) seems to be the opposite of djinn's. The German tanks all park on top of the hill overlooking the town and "snipe" anything they can see, on foot or in a vehicle, using both HE and AP! Deadly as this is, it still isn't very effective in the long run as most of the tanks don't go in to cap flags (even the railway station) and they eventually get picked off by the few Allied tanks + AT guns that manage to avoid getting sniped.

One persistent issue I've noticed in a lot of maps is the "traffic jam" where multiple stationary tanks and vehicles sit in a group, usually in between their base and an enemy's, and often in a position where they can't fire at anything. This ties up a lot of bots and vehicles that could otherwise be fighting and capturing CPs, and would make a very good target for bombers if the AI actually knew how to drop bombs! I suspect this is purely a map AI scripting/navmesh issue and changing the basic AI will have no effect.

Anyway, I hope this has answered some of your questions -even if it ended up as a (very) long post.


9/ The semovent is ALIVE!
10/ Tiger seems alot more maneuverable, hardlyh showing is back to the enemy

What maps are the Semovente and Tiger on? I assume there's a Tiger on Goodwood, but I've never played long enough (due to crashes) to see one. The only Italian vehicle I've seen is the Fiat L6/40.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 06-02-2010, 22:02:47
You should go over to the battlefield Singleplayer forum and download the FH mod made for 2.15 by Redsand and WinterHilf, before he was an official developer of FH2.

It has maps not in - Still in various levels of beta, like Alam Halfa, Gazala (Where the semoventes are) and Bardia. Actually every single one of the North African maps, save for Mareth have ai if you include this mod... You might want to take out the maps from the stock minimod though and incorporate them directly as I'm not too sure it will work for 2.25... Goodwood has a Tiger I, not the Tiger II that is in Conquest, sadly, but it still pwns now.

Here's the link:
http://www.battlefieldsingleplayer.com/forum/index.php?s=0e86bbfe119e260b8255f169e4bbcff9&showtopic=13215&st=0&start=0

Thansk for the feedback... Just tried Luttich which is an excellent mod save for AT-rangers and no HE... Would really be an epic map if the AI commander for this map (Not a bot issue I imagine) will command his troops out into the field. Played it for a good 30minutes, excited about everything until the Germans got all the bases and parked like 3 or 4 tanks in the town of Mortain and the game came to an almost stand-still.

I don't know why tanks seem to prefer firing HE and AP at other tanks and rarely mg and more often AP at infantry, but it may also have to do with the buggy code of BF2... I actually saw a Stuart firing cannister at an APC... it killed the APC, but I don't think that's what it was trying to fire... 88s have the same issue as do AT guns.. they are more likely to fire HE at a tank or AT gun than at infantry.

There is something nice about the randomness of an HE shell fired at a tank, but not firing HE EVER at infantry. and especially coax-mg really makes FH2.25 a bit depressing for me

The Stuka DID kamikazi in 2.2, but this was fixed in 2.25, I believe by given the Stuka a fighter-plane ai template. It fly well, but a tad too low, making it easy prey to AA guns... but it strafed, which was kewl... Maybe a modification of that ai to make it fly alot higher and whatever miracle you figure out for the bombs would make it fly more like a real Stuka should...

This one is a big favor... Please, pleas, pretty-please try to see if you can get the Stuka using the divehorn once it sees enemy units and decides to attack.... that will be tres cool. I know planes used ot use (they may still use) airbrakes, which is the same key, so I'm hoping its doable...

Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Zoologic on 07-02-2010, 06:02:44
I played Fall of Tobruk yesterday, and yes, the Panzer II is active now. They fired HE shells at my hiding position.

But it looks like they won't fire into Shermans and Matildas back in El Al (it is useless anyway, since PzIIs can't scratch them).

BTW, divehorns i think should be the least priority. But it is cool to have too, by default, it uses afterburner keys (left shift). I hope you can work on this.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 07-02-2010, 20:02:04
Thanks for the link to the SP mod! I didn't realise this was available. So the maps will still work with FH2.25 if you take them out of the mod? (I'm not going to attempt running the mod itself, even if it runs with 2.25 there'll probably be compatibility issues). 

The Stuka is really odd... I haven't changed anything in the Stuka files other than the weapon data and the AI temperature/strategic strengths. And I distinctly remember seeing it do its kamikaze nosedive on Tobruk and Mersa Matruh before I made any attempt at modding FH2.

But I haven't really made any serious attempt to mod/fix the planes yet, now tanks are working reasonably well (other than the shell usage issue) I'm going to pay more attention to the planes. I'm not sure what it is in the Stuka files that trigger its diving behaviour (other planes don't do this) nor what it is that prevents AI planes from dropping bombs, when in vanilla BF2 they can do so very accurately!
What I'll do first is compare the Stuka .tweak and .ai files with those from another plane (e.g Hurricane) and see exactly what the differences are. If I can get the Stuka to fly properly, I'll then do the same thing comparing the weapon data for bombs in FH2 to that in the vanilla BF2 files. I'll also definitely see if I can get the divehorns working, though I definitely don't guarantee it!

The inconsistency with tanks using their coax MGs is also really annoying me. Sometimes they use them readily, other times they only fire shells. I wonder if AI behaviour is influenced partly by things like the map layout, pathfinding, whether the bots are attacking or defending, etc.? How BF2's bots behave seems to be often completely unrelated to what the .ai files are actually telling them to do.

BTW, I followed (in another Stuka) an AI Stuka on Mersa Matruh to see exactly what it did; it took off, climbed to a fairly high altitude, flew level until it reached the railway station CP, then nosedived straight into the enclosed compound where the Crusader + truck spawn.  On other maps (like Tobruk) the Stukas seem to die more often from flying so low that they run into hills, rather than by diving straight into the ground. (This is another thing that made me wonder how much the AI behaviour was influenced by the map)
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: cannonfodder on 09-02-2010, 10:02:31
On El Alamein, I noticed the Beaufighter diving toward the ground (next to Mit. Ridge on the German side) as if he was trying to bomb someone, but he dropped no bombs. He circled around and dived at nearly the same spot again, coming so close to the ground that if there was a vehicle there, he would have slammed into it. On the fourth dive he hit the ridge.

The next round, I waited in a Spitfire and followed the Beau...he gets halfway to the Ridge, banks left and dives at the ground. When he pulled back up, he banked right 'til he'd pulled just over a 180-turn, flew straight for a bit, then banked left and dove...

I was following, watching him do this for a minute or so when it dawns on me...he's flying in a big figure 8!!! Which he did for almost five minutes before I got sick of tailing him...::)

Watching the Stuka, it looks to me like it's trying to pull out of it's dive just before it hits the deck.

As for the sirens...don't hold your breath, I don't think BF2 bot pilots use the afterburners (do they?) and I know the bots in AIX won't use the over-boost on Clive's WW2 planes (activated by the sprint key).


EDIT: After another round, the Beau was doing the same thing (the diving) but was turning left or right at random, not left-right-left-right (figure-8's)...maybe the bot in other round got stuck in a loop... :-\
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 09-02-2010, 13:02:19
The fighters in fh2 did use airbrakes until 2.2. And the beau stil droppd bonbs afta bf2 1.5, so thats not it
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 09-02-2010, 18:02:13
I -think- I may have solved the problem with the Stuka's kamikaze diving, it appears to be caused by the AI input to select the rear gunner position (in objects.ai) being set to PIMenuSelect2 (which should be the key to switch between 50kg/250kg bombs), rather than PIPositionSelect2. I added the bomb select key (missing from the default files). This didn't cause any problem in default FH2.25 as there was no bomb select key in weapons.ai, but I added one (without spotting the error in objects.ai) so presumably when the bot pilot got within range of the enemy and attempted to select a bomb type, he instead started switching between the pilot and gunner seat, causing the plane to crash.

Fixing this error makes the Stuka much less prone to crash into the landscape, but it still flies very sluggishly, doesn't attack anything, and usually ends up getting killed by flying out of the playable area.  The AI control input parameters for the Stuka are also set to be much less sensitive than other aircraft (including the Ju52); I suspect this is the cause of the latter behaviour, so will change it and see what happens. Still no guarantees I'll be able to get bombs working, though...

I haven't really looked into the fire rate issue with semi-auto rifles yet, but I suspect it's because these guns don't actually have a fire rate defined in their .tweak files, they fire as fast as the player can click the mouse button. Since bots don't need to use a mouse, they can fire them a lot faster than a human player 
 ;D
I've also done some more tweaking to the tank gun + MG files, and have made a couple of changes that seem to make tank vs. infantry combat work better; firstly, I gave AP shells a strength of 0 vs. infantry for all tanks that have HE shells, secondly I gave coax MGs a much higher strength (15) and reduced their range to 150. Within this range tanks will prefer to use MGs rather than shells against infantry, beyond it they'll fire HE shells - at least in theory. I think part of the reason for the erratic behaviour of tanks was that HE shells and MGs had a similar strength vs. infantry, the bots couldn't decide which to use!
I've also reduced the minimum range of AP shells to 1 and HE shells to 5.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Raziel on 10-02-2010, 09:02:55
Woohoo! Thanks Drawde! You are making real progress!! ;D
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 11-02-2010, 12:02:15
Excellent work, Dawde. By the way, great job on kit mg gunners. The really impact as they should.

Bots however only fire mortar bombs at vehicles and never infantry.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 11-02-2010, 16:02:00
Woohoo! Thanks Drawde! You are making real progress!! ;D

Unfortunately NOT much progress with plane AI  >:( although I think I've managed to get tanks working reasonably well.

Bots definitely seem to use handheld LMGs more effectively than they used to, though getting them to use deployable weapons sensibly may be beyond BF2's AI limitations.

Also, infantry weapons have the highest priority for AI mortars, with heavy armour the lowest... seems to be another example of the AI doing exactly the opposite of what the game files tell it to do.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 11-02-2010, 21:02:54
Im surE if bots got the same priority for other mgs as they do for the mg15, they shouldn't hav an issue with deployables, granted that the deployed ones like the vikers are added to the mg list. Bots after all use deployed mortar as readily as the would stationary ones.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 12-02-2010, 01:02:27
Also mortar is actually pretty darn inaccurate. This isn't top priority at all, but perhaps if bots could use mortar on moving targets with an algorithm similar to other projectiles it might be able to 'lead' targets more.

Also an increase in line of sight might make it more effective. Currently it fires within ranges of only half that of cannons

Oh and if you fix shell selection for tanks, please note, the 88 and AT guns have it too
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 20-02-2010, 19:02:12
Is the fix for tanks shel selection small enough that it can be posted to be DIY?

Also, perhaps the Stuka can be made to use both mg and bombs in any attack on soft targets. When at bomb range, it will automatically stop firing as it wont be aiming at that target any longer.

Also, if mame to fly higher, it could avoid AA more and do steeper dives. After all, it does dive already.

You just miit want to adjust the height at which it drops bombs so it can recover in time.
I guess the divehorn could be like the mg and bombs i.e 'fired' once on a strafing run.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 20-02-2010, 20:02:59
Hopefully the next version of the mod should be ready within a few days. I just need to test it a bit more to check that all the aircraft are still working correctly. It also has some improvements to tank gun/MG use (doesn't fix it entirely, there still seems to be a random element involved) and entirely prevents AT guns (and tanks with HE) from firing AP shells at infantry.

I'm not sure whether it's possible to control the flying height of AI aircraft, or if this is map-specific (they definitely seem to fly higher on some maps than others)
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 20-02-2010, 21:02:44
Wow! Can't wait. Btw, any chance of getting bots to be able to bail vehicles? Not static ones, but mobile ones, specifically positions that don't make bots
useful to the battle such as external positions on tanks, all gp vehicle positions and all positions within apcs save for mg position. If the driver gets to a flag surroundee by a minefield, he should be able to get out, cap the flag and get back into his vehicle afterwards.

Only tank drivers and mg positions on vehicles should be camped

Also, any luck getting bots to use mgs of all kinds using the mg15 code?

I played earlier, alamein with 64 bots in sp and 1.0 difficulty. Aircrafts, even with just mgs are able to destroy gp vihicles in one run! I was on foot and got strafed by a bf109 firing simple mgs. It killed me and blew up two trucks next to me!

88 become more accurate than tanks with their range, but AT guns get too accurate.

A single 6pdr held off the german offense from the frontline Brit base, destroying pz4s as far as Kidney ridge!

A possible counter will be to get tanks firing ap and he at same strength on the offending gun. Ap will kill it, but tanks not being as accurate as AT, can kill the gunner with HE too. Same goes for all stationary vehicle positions: HE.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 20-02-2010, 22:02:57
Perhaps Plane mg accuracy can be increased so that there is no need to play the insane 1.0 to have them get it right. They can then use cannons on other target types, like concealed positions and light armor.

Also any luck getting mortar and perhaps howitzers firing at unseen far targets by elevating their perspective. Planes see targets very far off on account of their height.

Im sure arty will be able to fire at range if this were done.

Finally, you might want to know that even with the absense of vehicles bots never fire mortar at infantry with the rarest exception of phl.

Should'nt arty be 1st and foremost anti-personel before antitank?
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 21-02-2010, 21:02:44
Wow! Can't wait. Btw, any chance of getting bots to be able to bail vehicles? Not static ones, but mobile ones, specifically positions that don't make bots
useful to the battle such as external positions on tanks, all gp vehicle positions and all positions within apcs save for mg position.
...
Also, any luck getting bots to use mgs of all kinds using the mg15 code?

Not sure about the bailing/switching position - this seems to be one of the hardest aspects of the AI to get right. I think it's mainly related to the different Temperature and StrategicStrength values of different crew positions, but it seems very hard to predict exactly what the AI will do. This area of the AI worked really well in vanilla BF2, was completely broken in default FH2.25, and slightly improved with my AI minimod (bots aren't so keen to use passenger/tank rider positions, for example) but not by much - I'd like to get things closer to how they are in vanilla BF2, but am not sure how. (Even after giving tank rider positions - useless deathtraps for bots - a temperature of 1 and StrategicStrength of 0, I still see quite a few bots using them  ??? )

I think I've partly fixed the MG use issue, I originally gave MGs a very low StrategicStrength for offense, so bots didn't waste time sitting on them when they should be attacking - but it looks like this means that they very rarely use them unless their AI commander has specifically ordered them to defend a CP. I gave them a medium offensive StrategicStrength (4-5) and have noticed a few more MG kill message for bots since doing so.

I'm not sure if it's possible to change the AI view position on artillery without also changing it for the player. But the AI seems to be capable of spotting targets quite far away = a number of times when manning a 2pdr on Siege of Tobruk I've been "sniped" by the German PaK 37mm from beyond visual range!
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 21-02-2010, 22:02:05
Yer, but those are usually placed with a large field of view - Once the bots' views are obstructed, they don't fire - That's why they fire at full range in El Alamein, but only rarely in most other maps.

I don't know about perspective for bots being the same for players either. What I do know for sure is that raising their view point when on the gun from the artillery piece to some 30 or 40 feets directly above, depending on the range of each gun will likely allow them to see targets that may have otherwise been obstructed by walls, topography or such and as long as it doesn't screw up their aiming, they should be able to fire at great ranges, lobing shells over buffs and walls and completely changing the gameplay... hopefully for the better, whether or not it changes players perspective too - After all, we only use 1st person view to calibrate the gun, not to aim it

Also, any chance German bots can get similar code for their gabellte ladung as the Brits get for charges?

thanks for the feedback...
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: anglosaxon on 23-02-2010, 08:02:00
For some reason this tweak slows my co-op games down to 9fps.  Makes em unplayabled.  :(
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: cannonfodder on 23-02-2010, 09:02:31
 ???

I don't know what would cause that...did you install it properly?
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: cannonfodder on 24-02-2010, 11:02:40
@ Drawde: I just noticed that your minimod is causing a CTD on Goodwood-16... ???

Before installing it, GW-16 was one of the (my) most stable maps.

I've tried it 4 times since installing the minimod, and it's CTD 3/4 times; the three times it crashed I was on the British side, and the one it didn't I was as a German.

So I just "uninstalled" it and played 8 rounds (4 per side) with no CTD... :-\


EDIT: OK, scratch that. I just "reinstalled" the minimod to be 100% sure it was causing problems on GW-16, and I played 6 rounds (3 per side) and no CTD at all... ::)

*sigh*...oh well, maybe XWW2 will ease the SP pain when I DL it tomorrow...
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 25-02-2010, 20:02:00
I also got a CTD on Goodwood 16, about 5-10 minutes after starting the game, playing as Allied. I'll try it again later to see if I get similar results. I also get CTDs on Goodwood 64 and Anctoville, but not (so far) on any other Normandy maps.
I've no idea what the cause of the problem might be, other posters have suggested it might be due to the AI pathfinding for a particular building model. I assume it isn't vehicle-related, as there aren't any in Anctoville or Goodwood 16.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 28-02-2010, 19:02:56
Any word on this? Is this still going on?

Excuse my paranoia, but it seems every AI project by WinterHilf, Legion or any other good Samaritan who takes up a personal AI project for the good of the community (and especially as fixes or improvements between official releases) tends to go silent after 1 or 2 permutations...

Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 28-02-2010, 21:02:21
Sorry for the delay in releasing the next update. I've been trying to playtest the mod as much as possible to make sure the AI is still working properly, and haven't found a huge amount of spare time to do so in the last week - but I hope to have the next version of the minimod ready by the end of the week, possibly in the next few days.

One minor bit of good news is that I've managed to track down the sound-looping bug with the 2pdr AT gun ("ObjectTemplate.fire.addFireRate" needs to be set to 0 in the .tweak file)

Regarding Goodwood 16, I managed to play an entire game as the Allies, but playing again as Axis got a CTD after about 5 minutes. In the first game, all the CPs changed hands multiple times, so the crash seems to be unrelated to this. My suspicion is that it's a pathfinding issue related to one (or more) of the buildings in Cagny, presumably the building is at the outskirts so on the 16 map bots don't always encounter it, but in the 64 map they always do sooner or later.
Would the editor debug mode be any use in tracking down this issue?

Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 28-02-2010, 22:02:40
thank u, thank u... I must admit I was having a rather depressing weekend, but this really lifts my spirits.. As unsettling as it makes me feel saying so :-\

I'm glad you've solved the 2pdr issue - It must be the same thing with German APCs mounted with the mg34... the issue isn't with the Mg42 version though, but it was first noticeable with the mg34 variant of the APC

About Goodwood - I must say, it baffles me. I'm sure people have tried using debug since it was first recommended when it became clear that alot of 2.2 maps had ctd issue... especially Goodwood - But so far, you've been an ace discovering and fixing bugs that no one else has such as the Stuka, and now the 2pdr.. So I say try it out again... You might find something that we all missed...

Hey, does the Stuka bomb issue that you found a solution for apply to the typhoon's rockets and the FW190's bomb? I've noticed that the typhoon to be precise aims at me once i enter the StuG, but doesn't fire.

Another thing i've noted from your last version is that bots seem to attack armored vehicles with anything they've got. They throw nades at it and fire riflenades too, even at tanks

Here is a list of all the major considerations I could think of, some of which you might have already implemented, others you might consider:
a/ Getting bots to bail mobile vehicles?

b/ Getting armored cars like the 222 and Marmon herrington to focus on infantry and less on tanks?

c/ Getting AT guns without HE to not fire (Not essential, but worth noting)

d/ Getting AT guns, including those on halftrucks to fire HE at infantry if they have it

e/ Tanks and the 88 firing HE at infantry instead of AP

f/ Reducing the range for rocket infantry

g/ Giving AT guns the accuracy of tanks... currently they are insanely accurate

h/ Making German infantry use the gabellte landung and American infantry, comp. B in the same way as the Brits use charges on armor

i/ Planes firing cannons at infantry once again, or at least firing them at light vehicles and concealed infantry

j/ Tanks selecting special AP against superior tanks... the PZII should only use its normal rounds on the
Stuart or anything lighter

k/ All mgs being used as readily as the mortar or mg15, including deployed ones

l/ Raising the view perspective for mortar to allow bots to use them against targets concealed by walls, topography etc - And bots using mortars on infantry before considering them for vehicles

m/ Bots using howitzers, including rocket howitzers

n/ The Stuka's divehorn, used like a 'fired' armament or like the airbrake but before an attack, rather than after

o/ Tanks using AP and HE with equal merit at AT guns

p/ Not all traversable positions are used in traverse... eg. the vikers is never tranversed properly to fire at enemy units - For all variants i.e. the stationary version, the deployed version or the chevy-mounted version, nor is the .50 cal atop the M10,

q/ Ability to switch to driver position if the driver of a vehicle isn't available for a while, to switch to mounted mg if the vehicle is under attack from infantry or bail if the bot gets to as close to its destination as the vehicle would allow, but no further.

r/ PZII and other 20mm tanks using their cannon even at point blank range, instead of going silent and becoming sitting ducks

s/ Putting code for the commo-rose back so that bots would follow orders from it.

I also suggest, making the Stuka fire mgs as first resort on infantry and using its bombs on vehicles so that it doesn't 'see' bombs as better all the time

now again, this is a long list and some of them might be difficult, impossible, or just too close to release to implement. However, this list does capture practically all current issues with the ai, save for those that your previous version already solved, such as traversal of AT guns. You might find it worthwhile for later changes

We SPers really cannot thank you enough, Drawde... you do us a really, really, big favor here :-)


Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 01-03-2010, 20:03:15

I haven't tried fixing the Typhoon rockets yet - I think this'll have to wait for either the next official FH2 version or at least improved AI versions of the Normandy maps. Currently the only SP map with the Typhoon is Winterhilf's infantry-only Totalise, since the German bots don't use vehicles, AI Typhoons don't have much to fire their rockets at. The bombs on the Fw190 and other aircraft should be fixable in the same way as the Stuka's (rem out the line that rotates the bomb 180 degrees), in fact I think I've already done this.
I've also now stopped infantry from using rifle grenades other than HEAT against tanks, they'll still use thrown grenades as a last-resort weapon (they unnerve human tank drivers, if nothing else - and can damage some light vehicles) but I might disable this also in future. Not sure why bots don't use the Geballte Ladung, it has the same AI data as the British AT weapons.

So far I've stayed away from attempting to fix map bugs, partly because other developers like Winterhilf are already working in this area, but mainly because I have virtually no BF/BF2 mapping experience! Please don't mistake me for any kind of genius modding expert - the only reason I've managed to make so much progress with improving/fixing the FH2 AI is because it appears to have been so neglected by most of the mod developers (understandable given that the mod is focused on MP)

These are the issues in your list which I've fixed at least partially in the current version of the AI minimod (to be released soon):

- AT guns without HE not firing (at infantry, I assume you mean) - fixed
- Tanks + AT guns firing HE at infantry rather than AP: I've done as much as I can to fix this, all tanks + guns with HE will (theoretically) never fire
  AP at infantry. Similarly, they should prefer HE shells for attacking AT guns and MG positions. However, the AI doesn't seem to always "do as it's told"
  in this case. I suspect the BF2 AI just isn't fully programmed to cope with multiple ammo types for the same weapon (vanilla BF2 doesn't have any AFAIK)
- PzII and other tanks not firing at point-blank range - fixed, the minimum ranges for tank guns are greatly reduced.
- Bots using static MGs more: improved, though not fully fixed.
- Planes using MGs/cannons: fighters will strafe infantry and light vehicles/AT guns (often quite effectively) but bombers rarely do, I've only once seen the Stuka fire its MGs at anything.

Things I'll try and fix (as far as possible) in a future version:

- bots bailing and switching crew position (they do it in vanilla BF2, so surely should be able to do it in a mod)
- radio/comm rose commands working correctly (already made some progress on this, but not fully tested, so won't be in the next minimod release)
- fix bots not aiming/firing some MG positions (Vickers on Chevy, rear MG34 on 251, .50 cal on M10, etc.)
- bots using German and US AT charges
- reducing range of infantry AT rockets
- Stuka (and other bombers) using guns on infantry rather than bombs (possibly)
- reducing accuracy of AT guns: not sure why this is happening, they have the same "deviation" settings as equivalent tank guns.
- armoured cars focusing on infantry: again, they ought to do this already, their weapons have a much higher AI strength vs. infantry than armour.

Things I'd like to try and fix but don't guarantee anything:
- Stuka dive horn working
- bots using artillery howitzers and Nebelwerfer (even if only against targets that they can see directly)
- raising the AI view perspective for artillery - probably not possible unfortunately, I don't think you can have separate view positions for AI and human players.
- tanks only using special AP vs. tanks with heavy armour: almost certainly not possible, currently there is no way for the BF2 AI to tell the difference between different tank types, they're all in the "HeavyArmour" category (and "LightArmour" is already used by AT guns and unarmoured trucks)
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 02-03-2010, 08:03:27
Thanx for the detailed reply.

I do think Legion could pick up the latter projects such as artillery perspective and vehicle bailing. As was with Fh1, having these active on the battlefield will really make all other shortcomings forgivable.

It's unsettling how there's been absolutely no word from him or WinterHilf on any of this. I would say you guys should work together on this sp minimod. But seeing how he went silent after doing his thing officially, I'm not sure that'll be such a
good idea, a sad fact.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: winterhilf on 02-03-2010, 13:03:46
Still around, real life's been hammering me recently though.

Cheers Drawde, Gunnie's reexported those wrong way bombs, they're in the build & working fine with ai now.

I've got bots firing the Nebelwerfer, again this is already in the build but if you'd like a look here'tis
http://rapidshare.com/files/357843717/Nebelwerfer_ai_tweak.zip
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 02-03-2010, 18:03:38
Sorry to hear, but nice to know you are still around

I tried the patch, but truth is, bots don't seem to like the Nebelwerfer. The last time I actually saw it manned was in 2.2, so for now I cannot tell how bots use it

That said, I'm most curious about the feasibility of rasing the elevation for view points on artillery pieces to aid bots fire at targets which, at ground level they cannot see. You might be aware of Drawde's success in making bots fire mortar tubes (A feat which I personally consider astounding since it has been deemed the most impossible of bot feats since 2.0 as a result of the high elevation).

Thanks again for the little gift, Winterhilf. For some of us SP in FH2 is really all we have now since the PC I have at the moment is really the lowest that BF2 will allow so it makes online play, and in fact, playing any other game I have impossible, making the beta of FH2 bots, the only respite I have recently (Probably until the summer).

Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 02-03-2010, 19:03:10
I think I've fixed the problem with the Chevy Vickers .303 MG not firing - it appears to be caused by the AI min/max rotation values in objects.ai. These are the same as the actual min/max values in the .tweak file, but nevertheless, increasing the maximum elevation + depression values seems to do the trick in getting the bots to aim and fire this gun correctly.
There are quite a few other vehicles with inconsistencies between the AI and actual min/max rotations for weapons (the worst is the Valentine which can't rotate its turret 360' !) - this may be part of the reason for tanks not firing at close range, as many have AI settings that don't let them depress their gun as low as they're actually capable of doing (hope this makes sense) so I'll try fixing these and see how it changes the AI behaviour.

This is the last change/fix I'll attempt to make before I release the next version of my mod (promise!)

(I'd try out Winterhilf's Nebelwerfer fix, but Rapidshare now seems to be virtually unusable for non-paying users)
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 03-03-2010, 01:03:55
Actually I downloaded it under 5seconds and I am not a subscriber of RapidShare

Title: Best of luck!
Post by: TheLotusEater on 03-03-2010, 07:03:24
Well... best of luck to you guys. Really looking forward for your minimod update Drawde and glad to see you back Winterhilf. Now let's win this fight with the ai! 8)
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: cannonfodder on 03-03-2010, 09:03:35
...Regarding Goodwood 16...My suspicion is that it's a pathfinding issue related to one (or more) of the buildings in Cagny, presumably the building is at the outskirts so on the 16 map bots don't always encounter it, but in the 64 map they always do sooner or later...
When I first got my dirty mitts on GW-16, I played about 14 rounds straight (mostly as a Brit) so I'd say the chances of it being a pathfinding issue is pretty low. Although it may very well be the problem on GW-64...

Drawde, I've played another few rounds (all as a Brit) after reinstalling your minimod with no CTD... ::)

I dunno why it was causing a CTD before and not now I've "reinstalled" it; I just swapped the serverarchives.con around. I'm gonna try it again just to be sure.

Just a thought...maybe there's a spawnpoint somewhere (in GW-64) that's allowing bots to spawn "off the mesh", as soon as they do it causes a CTD?... :-\

I'm not a subscriber either and I don't have any problems with Rapidshare, but I find if I try and DL something off it after 10pm (Sydney time) it can take up to a dozen attempts before there's an empty slot.


EDIT: Just played another 3 rounds on GW-16 with no CTD...

Tried the Nebel fix on Totalize, bots weren't interested. I'll try raising the temp of the gun to get them to use it.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 04-03-2010, 20:03:14
Not good news from the point of view of a release in the next few days, I've just found a CTD in "Supercharge" 64 (occurred two times, both about 8-10 minutes after starting the game, so not just a coincidence).  >:( >:(
 This didn't occur with earlier versions of my mod (certainly not the first released version) but I've made many, many changes to the mod since the last time I tested Supercharge, so tracking down exactly what causes the problem is going to be a tricky job given that when BF2 CTDs you never get any sort of helpful error message or log giving you a clue as to what exactly caused the crash ::)

I'm going to try downloading + installing the BF2 editor (haven't bothered with it until now, as I've never got into mapping for BF/BF2) and seeing if the "debug" mode in the editor will let me track down the cause of the issue.
If this works, it might also help me track down the CTD bugs in other maps like Goodwood. If not, though I'll have to go back to the old method of progressively removing modded files until the game stops crashing - this doesn't take too long when fixing a CTD that occurs during map loading, but an in-game one several minutes after the start of the game would be very tedious to fix this way, especially if the crash doesn't always occur at the same time and even (as with Goodwood 16) doesn't happen every game. Either that, or I'll just revert to an older backup of the mod (last was about a week ago) and re-do the changes I made since then.

Sorry for the long post, but this has really annoyed me seeing as I was hoping to release the next version in the next couple of days  :(

EDIT: Tried bf1942_r.exe and couldn't even get as far as the main menu, after clicking past a dozen or so non-critical error messages I get an "unhandled exception" error. And the most recent backup copy of the mod still crashes on Supercharge; the one before that is too old to revert to, I've made too many changes since then for it to be worth using. So it looks like I'll have to fix this problem the hard way...
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 04-03-2010, 22:03:33
sorry to hear that. We are all really grateful for the effort you've put into all this

Good luck finding the bug

BTW, a small issue I noted with the mg42 stationary bipod:
In PDH, I saw a German man it for the first time since 2.25 was released (Bots were fine with it till then). Well, this bot manned it and was being shot at by everything and eveything, rockets, bullets, riflenades.. but he wont open fire, he didn't even change the guns' position in order to aim at anyone in particular...

The tripod version fires fine, although barely used - I saw it used in PHL, as is the mg34 tripod (Not sure about the mg34 bipod though), the mg15 has no issues either..

EDIT: If you wont mind releasing it twice, you can upload the current build and get others to try it out - it might be faster finding the issue that way - You might not want it to reflect the quality of the minimod though, so you could upload it and give the link to only a select few *How you doing*

Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 05-03-2010, 20:03:09
EDIT: If you wont mind releasing it twice, you can upload the current build and get others to try it out - it might be faster finding the issue that way -

I think that's what I'll do if I haven't fixed the problem within a couple of days. I think, though, that I might have just been unlucky with the CTDs on Supercharge; the last two games I played on this map didn't crash.

A few things I noticed -
- I saw a bot use a Geballte Ladung charge for the first time - took out an Allied tank but blew himself up in the process, maybe this is why bots are disabled from using these in the default FH2 AI! But I'll continue trying to get the AI to use these weapons properly (after I've released the current version).
- I also saw a bot fire the 25pdr howitzer, using it like an AT gun to fire AP rounds at a German tank. Still no progress with getting them to fire HE indirectly, but at least it shows the AI is capable of firing these weapons.
- Supercharge gets really hard for the Germans once the British get as far as Gazal Station! They don't have anything that can reliably kill the heavier Allied tanks (Sherman, Grant, Valentine) other than the Pz.IIIJ's special AP rounds, and I think the German aircraft also stop spawning once the Allies get this far.
- Bots really don't seem to understand how to use AT rifles correctly - they never lie down to fire them, so rarely hit anything even at point-blank range. Not sure why this is, since they seem to understand how to use MGs. Since at least one in four bots seem to be using the AT kit, this makes AI infantry rather less effective than it should be.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 05-03-2010, 21:03:25
EDIT: If you wont mind releasing it twice, you can upload the current build and get others to try it out - it might be faster finding the issue that way -
I think that's what I'll do if I haven't fixed the problem within a couple of days. I think, though, that I might have just been unlucky with the CTDs on Supercharge; the last two games I played on this map didn't crash.

Supercharge developed a CTD issue from FH2.2, it might just be that

A few things I noticed -
- I saw a bot use a Geballte Ladung charge for the first time - took out an Allied tank but blew himself up in the process, maybe this is why bots are disabled from using these in the default FH2 AI! But I'll continue trying to get the AI to use these weapons properly (after I've released the current version).

Bots in 2.0 used the gabellte Ladung - It was stopped after that release... But the truth is, even I die from it sometimes inspite of fleeing after dropping it. It has a larger explosion than sticky bombs - Same goes for British charges. They too die sometimes, inspite of fleeing - Perhaps its about how far they flee, since IMO, they already do

- I also saw a bot fire the 25pdr howitzer, using it like an AT gun to fire AP rounds at a German tank. Still no progress with getting them to fire HE indirectly, but at least it shows the AI is capable of firing these weapons.

Another weapon that worked fine in 2.0 save for indirect fire. Again, you might really want to consider my suggestion of elevated perspective, irrespective of how it affects players' view point in COOP/SP. It seems a sure bet - Don't forget BF2 vanilla never supported manned artillery and so indirect fire as existed in FH1 might be impossible, or require toying with hardcode, which will make FH2 contraband. Yes, with the insane range AT guns seem to fire, increased elevation should certainly do it if it is possible

- Supercharge gets really hard for the Germans once the British get as far as Gazal Station! They don't have anything that can reliably kill the heavier Allied tanks (Sherman, Grant, Valentine) other than the Pz.IIIJ's special AP rounds, and I think the German aircraft also stop spawning once the Allies get this far.

That, coupled with bots not being able to use the gabellte landung and Supercharge having some insane commander logic which goes bonkers once the Germans only hold the town - For both armies... In reality, the battle should move to the town with bots moving in mechanized groups up to the town, dismounting and proceeding inward to take the flags, facing stiff infantry resistance from the mg, AA (Another reason for making AA anti-vehicle and anti-personnel also) and close-range infantry combat... For the last bit, the Germans excel.. IF the British actually get off their vehicles to move in. Tanks fighting in the outskirt become secondary.. simply defending the flanks and preventing a breakout, with German tanks trying to force that breakout... It actually does happen, but rarely.

- Bots really don't seem to understand how to use AT rifles correctly - they never lie down to fire them, so rarely hit anything even at point-blank range. Not sure why this is, since they seem to understand how to use MGs. Since at least one in four bots seem to be using the AT kit, this makes AI infantry rather less effective than it should be.

Personally, I think the AT rifle as it is is fine since AT rifle bots also have the AT bombs to compensate for the rocket AT bots who have both range and destructive power in their single main weapon. Also, the devs made bots own a unique AT rifle, that unlike its Conquest counterpart, can be fired standing but at terrible accuracy - Nonetheless, bots have no issue taking out PZIIs and anythin lighter - Even Crusaders, ever so often, so I think its fine in that sense..

Thank you so much for the feeback - Really looking foward to the release :-)
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 06-03-2010, 20:03:43
Quote from: djinn
Also, the devs made bots own a unique AT rifle, that unlike its Conquest counterpart, can be fired standing but at terrible accuracy - Nonetheless, bots have no issue taking out PZIIs and anythin lighter - Even Crusaders, ever so often, so I think its fine in that sense..

Interesting, I didn't realise this - do you have any idea where the data for these bot-only AT rifles is stored? This might explain why none of the changes I've made to the AT rifle data seem to have much effect on the bot's usage of these weapons.

One major thing that still really needs fixing (I'll try and have a look at this once I've released the current version) is bots disembarking from vehicles and changing crew positions. Once this is in, bot usage of passenger + tank rider positions can be re-enabled, and infantry bots might actually stand a chance on some of the large North Africa maps!

It looks like the Supercharge CTD was not directly related to the changes in my mini-mod, I was just unlucky in having it crash early on twice in a row. However, I'm now getting CTDs on Mersa Matruh 64, usually about 10-15 minutes after starting. This seems to be related to either aircraft or possibly AA guns - when I remove my modded Stuka files, the map (unlike the AI Stukas) never seems to crash
Anyone else have CTDs when playing this map offline, with or without my mini-mod installed?
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 06-03-2010, 20:03:46
Sadly no... *sigh* man, I was actually fingers crossed when I saw Drawde as the latest post a few minutes ago, hoping it was a release

Well, sadly, Mersa has always been one of the more stable ones... Not even with your current patch does it give issues.. not even with my crappy PC, which might crash if things get too interesting..

So yes, there is a chance that this one is your fault(jk) as a result of something new

What makes you think its AA or aircraft... I could try to investigate, granted we don't have the updated files, but it will be more possible to deduce why it might be the case cuz I for one have plated FH2 COOP avidly since 2.0 and can tell you, like I did earlier all the possible nooks and crannys of bot behaviour or logic.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: Drawde on 06-03-2010, 22:03:55
I thought the problem might be aircraft-related as removing the modded Stuka files solved the crash problem completely. This is odd, as I haven't made any significant changes to aircraft in the last week or so, so it could possibly be caused by AA guns, maybe the Bren AA which there are plenty of in Mersa Matruh and which the bots rarely if ever seem to use.

But I managed to play for about 30min on Mersa Matruh today, using the modded aircraft files, without any crash (I exited the game after 30min rather than it crashing) so I think the minimod is stable enough for a "beta" release (see the new thread with download link)

Also, I think I've got somewhere in solving the bot disembarking/bailing/switching position issue - if you open aibehaviours.ai and find this line under the FixedWeights table (which is used by both stationary guns and all non-driver positions on vehicles):
Quote
aiSettings.setBehaviourModifier Change 0.0

Change "0.0" to any positive value, and bots will be able to exit or switch vehicle crew + passenger positions. I set it to 1.0 - this may not be the optimum value (too low, and it won't have much effect - too high, and bots will keep jumping in and out of vehicles) but I did notice, for example, bots leaving AT guns when there were no enemy vehicles around, and tank hull gunners switching to the driver position when you (the driver) exit the vehicle.
A fair bit more work will probably be needed for bots to use APCs and trucks effectively, so I haven't included this fix in the 1.1 release of my mini-mod.
Title: Re: AI tweak/fix mini-mod v1.0 ready for download
Post by: djinn on 06-03-2010, 22:03:42
In the words of Jumjum... HUZZAR!

That said, you make a mistake. The bots CAMP those bren-aas to the point where I have to execute half my army

You see, like other guns you set, bots will use them as defense weapons and quite deadly against aircrafts too.. two runs over one and I was 2/3rd gone in my Stuka

but yes, once we capped all flags but the two closest to the ocean, many of my teammates, spurred by a hysterical commander shouting endless commands to defend, camped practically all the AAs in their sector, making the allies require only jeeps and a few oldmen with boys rifles to reclaim the other mersa base...

Will definitely try the code you posted