SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH5 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=249)
-   -   [TEC] Some aircraft AI tests/questions (https://www.subsim.com/radioroom/showthread.php?t=248833)

kapuhy 03-20-21 01:44 PM

Quote:

Originally Posted by gap (Post 2737616)
- is the min_height parameter in cmdr_AIAirplane controller doing anything?

To my utmost surprise, yes it does :up: (I'm surprised because with previous behaviour, SetCourseBombs, it seemed inconsequential)

Setting it high (like really high, 200 m or more) prevents even B-18, the worst offender so far, from crashing into ocean. It still flies like pilot just downed a case of beer by himself, but it does so at higher altitude.

Now, all that's needed is:

- make planes fly more stable
- make them, if possible, drop bombs on first pass (now, even with Strafe behaviour, they usually make several circles and turns before they find a good position to drop bombs)

First I hope can be achieved with fine-tuning wings/rudders drag and engine parameters. For second, no clue now but perhaps something will click if we keep changing all values...

Jeff-Groves 03-20-21 05:37 PM

Depending on distance to target?
There is a AI Command.
StrafingTooClose

There's A LOT of Commands TDW didn't use.
NeedToDescend
LaunchTorpedoesStrafe
MoveAroundCannonTarget

Etc.

Muckenberg 03-21-21 01:47 AM

Quote:

Originally Posted by gap (Post 2737616)
As far as the strafe strategy will only be used in certain circumstances, I think we can live with the involved oddities. Some of them are not even so impossible; for one thing, I am sure I have read reports of ASW aircraft killing themselves with their own bombs dropped at too a low altitude.



Good day
So I know one confirmed case. It's an attack by Skua aircraft from Ark Royal on the U-30. Here the bombs bounced off the surface and exploded in front of the planes. :k_confused::k_confused:

kapuhy 03-21-21 05:51 AM

Quote:

Originally Posted by Jeff-Groves (Post 2737691)
Depending on distance to target?
There is a AI Command.
StrafingTooClose

This one is used by "avoid impact with water" routine, so I think (might be wrong though) "TooClose" in this case refers to distance to water, not target.

For distance to target, GetContactRelDistOnWater works fine.

Quote:

Originally Posted by Jeff-Groves (Post 2737691)
There's A LOT of Commands TDW didn't use.
NeedToDescend
LaunchTorpedoesStrafe
MoveAroundCannonTarget

Etc.

True, and it's my intention to test them all to determine how will units react to them, then report results here so that either myself or other modders can improve plane AI as much as possible.

-----
If any players who are currently playing a campaign using TWoS are reading this thread - Coastal Commma... wait, uhm, BdU Training Division would find it very helpful if you share your experiences with planes in game currently: how dangerous do you consider them to be, what are your usual reaction/tactic in dealing with them, what types of planes are most common in your game (my tests are very "clinical" and may not reflect real combat engagements).

kapuhy 03-21-21 02:35 PM

Umm... guys?

So, this is a little side effect of meddling with AI scripts today. It is in no way related to aircraft behaviour, but I hope you'll like it anyway:

https://youtu.be/nFYryWEduzU

Jeff-Groves 03-21-21 02:42 PM

Is that AI Subs firing deck guns?

kapuhy 03-21-21 02:49 PM

Quote:

Originally Posted by Jeff-Groves (Post 2737881)
Is that AI Subs firing deck guns?

Yes.

I added Ship:CanFireCannons as additional condition to hitherto non-functional surface attack strategy and AI subs started firing both AA and deck guns.

Jeff-Groves 03-21-21 02:56 PM

Now you need to add crew to those Guns!

Jeff-Groves 03-21-21 02:58 PM

Here's the complete list of AI commands.
I didn't take time to make it all pretty.

GetContactWeight
GetDepth....Dive....
CheckDepth..GetD
amage...InSpotLi
ght.GetCrewRatin
gSub....ContactD
etected.WaitActi
on..PeriscopeRai
sed.RaisePerisco
pe..GetContactAv
oidDist.GetConta
ctRelDist...GetS
ubMaxSpeed..GetC
ontactSpeed.CanF
ollowWaypoint...
ContactIsMoving.
SubInFrontOfCont
act.PersuingTarg
et..CanFire.Faci
ngTargetTrajecto
ry..FireTorpedoe
s...FireCannons.
ContactIs...AreE
nemiesPresent...
SetThrottleRatio
....IsDay...Turn
ToFaceTargetTraj
ectory..MoveOuts
ideDetectionArea
....MoveIntoPosi
tion....MoveNear
DetectionArea...
ApproachStillTar
get.MoveAroundCa
nnonTarget..SetT
hrottle.FollowWp
....CanFireTorpe
does....HasBombs
....HasTorpedoes
....CanFireBombs
....NeedToDescen
d...StrafingTooC
lose....FiredTor
pedo....LaunchTo
rpedoesStrafe...
ShouldPrepareToL
aunch...MoveToFi
reTorpedo...HasW
aypoints....HasC
annons..CanFireC
annons..HasGroup
....HasCommander
....HasSameConta
ctAsCommander...
FireBombs...SetC
ourseBombs..Stra
fe..AvoidWaterIm
pact....SetOnTar
get.ShouldSetOnT
arget...SetCours
eWaypoint...Floc
k...GetContactRe
lDistOnWater....
GetRole.IsType..
IsCommander.SetT
actic...EndCurre
ntTactic....CanC
ontinueCurrentTa
ctic....GetShips
DestroyedRecentl
yInGroup....Idle
ThisShip....AddR
ole.IsRoleInCurr
entTactic...SetL
ineFormation....
AssignRole..GetC
urrentTacticID..
GetCurrentTactic
MinShips....Wait
ForFormation....
GetShipCountInGr
oup.Random..Cont
actIsInsideGroup
Area....SetGotoF
orwardDist..SetG
otoDestRelToCont
act.SetGotoDestR
elToContactKeepF
ormationOrientat
ion.SetGotoDestR
elToGroupCenterA
longGroupHeading
....SetGotoDestR
elToGroupCenter.
StartFiringDCs..
StopFiringDCs...
EnableStarshells
....ShipWaitActi
on..GetMyWeight.
TimeEventHappen.
GetContactLostTi
me..CanFireDCRac
ks..CanFireHHogs
....CanFireDCThr
owers...TorpedoD
etected.CanFireS
tarShells...GetC
ontactDepth.GetC
ontactBearing...
ContactPresenceI
s...GetCurrentSp
eed.GetCurrentSp
eedKnots....Fire
DCRacks.FireDCTh
rowers..FireHHog
s...FireStarShel
ls..AvoidTorpedo
es..FollowWaypoi
nts.Spiral..Pine
appleFlares.Goto
....TurnToHeadin
g...TurnFormatio
nToHeading..GetC
urrentHeading...
GetCurrentFormat
ionHeading..GetF
ormationContactB
earing..GotoActi
on..SetRamDestin
ation...SetSenso
rFactor.IsNeutra
l...IsDocked....
HasContacts.GetC
rewRating...Chan
geStatusIcon....
IsAlone.

kapuhy 03-21-21 03:57 PM

Quote:

Originally Posted by Jeff-Groves (Post 2737888)
Here's the complete list of AI commands.
I didn't take time to make it all pretty.

Thanks :) In fact I already noted most of these down after doing, as you've suggested before, a string search in ShSim.act with 010 Editor.

GrenSo 03-22-21 01:49 AM

Quote:

Originally Posted by kapuhy (Post 2737879)
Umm... guys?

So, this is a little side effect of meddling with AI scripts today. It is in no way related to aircraft behaviour, but I hope you'll like it anyway:

https://youtu.be/nFYryWEduzU




Nice. :Kaleun_Applaud:

I didn't see any AI sub firing anything. No matter if German or allied subs they have only been driving past and do nothing else.

kapuhy 03-23-21 05:48 PM

Ok, little update on subs (see, I'm now derailing my own thread :D )

- They can fire at other subs as well if ordered, so no easy sinking British and Polish U-class subs with deck gun anymore. They will defend themselves :D

- I can't get them to fire AA at planes, sadly (even though they do fire AA guns at other ships). In this case, script debugger shows CanFireCannons condition as false even is targeted plane is clearly within field of fire. Maybe if I find parts of script that order surface ships to attack planes I could learn something from them... if we could get this to work, we could have functional UFlak escorts in game.

Edit: And if placed right next to surface vessel, surface ship has CanFireCannons=true and sub has CanFireCannons=false when enemy aircraft appears, while bothe have CanFireCannons=true when enemy ship appears. Seems like they really don't want to fight planes.

Jeff-Groves 03-24-21 11:43 AM

TDW included an AI Cannon for Subs but there is no AI AA gun for Subs.
Check the files.
Do a copy of the 20mm and follow what he did for the Deck gun.
Then check the Subs eqp files and adjust.

You have 010 so COMPARE the AI deck gun to the stock Deck gun!
Notice names are changed so ID's will change!
Adjust the SIM with Goblin (Or S3D if you have the SH5 files for it) to match ID's.

Should you want the CRC in the new edited GR2 file to be correct?
I have a script for 010 that will do that.

Jeff-Groves 03-24-21 03:21 PM

One thing that still bothers me.
How exactly are ID's being generated?
Sergbuto posted about it years ago but I still have not figured out how it's done!

Finding the key to THAT would make editing files SO MUCH faster!

kapuhy 03-24-21 03:48 PM

Quote:

Originally Posted by Jeff-Groves (Post 2738390)
TDW included an AI Cannon for Subs but there is no AI AA gun for Subs.
Check the files.
Do a copy of the 20mm and follow what he did for the Deck gun.
Then check the Subs eqp files and adjust.

You have 010 so COMPARE the AI deck gun to the stock Deck gun!
Notice names are changed so ID's will change!
Adjust the SIM with Goblin (Or S3D if you have the SH5 files for it) to match ID's.

Should you want the CRC in the new edited GR2 file to be correct?
I have a script for 010 that will do that.

I just tried this, but unfortunately it didn't work. There's a chance I bungled up something and I'll double-check it later, but for now I feel lack of AI AA gun for subs is not the cause for this problem. Why? Because for surface targets, ANY gun works - AI 88, normal 88, I can even mount a Bismarck turret and my Surcouf-VIIc will happily engage any surface target:

https://i.imgur.com/JVKDwwC.jpg

It will also fire at surface targets with its AA gun (and with any gun I tell it to mount on AA station), but refuse to use anything against planes.

So, no progress with AA for now. On the bright side, thanks to you I learned how to compare files with 010 today, something I feel will come in handy more than once :salute:


All times are GMT -5. The time now is 11:43 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 1995- 2024 Subsim®
"Subsim" is a registered trademark, all rights reserved.