SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 03-20-21, 12:03 PM   #1
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

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.

That said, I will add a couple of quick thoughts:

- is the min_height parameter in cmdr_AIAirplane controller doing anything?

- Is there in SHSim.act anyhing that can be used to get aircraft altitude so that, when their height drops too much they can switch to normal flight or to any other tactic that won't result in a suicidal conduct?

Else, is it possible to differentiate strategies by aircraft unit type?
__________________
_____________________
|May the Force be with you!|
...\/
gap is offline   Reply With Quote
Old 03-20-21, 01:44 PM   #2
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 875
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by gap View Post
- is the min_height parameter in cmdr_AIAirplane controller doing anything?
To my utmost surprise, yes it does (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...
kapuhy is offline   Reply With Quote
Old 03-20-21, 05:37 PM   #3
Jeff-Groves
GLOBAL MODDING TERRORIST
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 4,242
Downloads: 149
Uploads: 0


Default

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.
Jeff-Groves is offline   Reply With Quote
Old 03-21-21, 05:51 AM   #4
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 875
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by Jeff-Groves View Post
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 View Post
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 is offline   Reply With Quote
Old 03-21-21, 02:35 PM   #5
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 875
Downloads: 72
Uploads: 3
Default

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:

kapuhy is offline   Reply With Quote
Old 03-21-21, 02:42 PM   #6
Jeff-Groves
GLOBAL MODDING TERRORIST
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 4,242
Downloads: 149
Uploads: 0


Default

Is that AI Subs firing deck guns?
Jeff-Groves is offline   Reply With Quote
Old 03-21-21, 02:49 PM   #7
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 875
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by Jeff-Groves View Post
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.
kapuhy is offline   Reply With Quote
Old 03-22-21, 01:49 AM   #8
GrenSo
The Analyst
 
GrenSo's Avatar
 
Join Date: Apr 2019
Location: Germany / Frankfurt am Main
Posts: 1,030
Downloads: 614
Uploads: 7


Default

Quote:
Originally Posted by kapuhy View Post
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:




Nice.

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.
__________________
Best regards,
GrenSo


“Mankind must put an end to war, or war will put an end to mankind.” - J.F.K.
GrenSo is offline   Reply With Quote
Old 03-23-21, 05:48 PM   #9
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 875
Downloads: 72
Uploads: 3
Default

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

- 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

- 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.

Last edited by kapuhy; 03-24-21 at 06:16 AM.
kapuhy is offline   Reply With Quote
Old 03-21-21, 01:47 AM   #10
Muckenberg
Planesman
 
Join Date: Dec 2014
Location: Czech Republic
Posts: 190
Downloads: 541
Uploads: 0
Default

Quote:
Originally Posted by gap View Post
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.
Muckenberg is offline   Reply With Quote
Old 03-27-21, 10:52 AM   #11
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 875
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by gap View Post
Else, is it possible to differentiate strategies by aircraft unit type?
- Possibly (haven't tested yet) by IsType() boolean - if "type" here refers to aircraft/ship type as defined in Names.cfg
- Other than that, by GetMyWeight which returns own weight in tons - while that doesn't directly differentiate by type, it can be used to sort out light bombers and fighters from heavy bombers for example.
kapuhy is offline   Reply With Quote
Old 03-27-21, 11:06 AM   #12
Jeff-Groves
GLOBAL MODDING TERRORIST
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 4,242
Downloads: 149
Uploads: 0


Default

Possibly IsType?
For example:
Ship:IsType(ESCORT) or Ship:IsType(BATTLESHIP)

Then see about GetMyWeight?
Jeff-Groves is offline   Reply With Quote
Old 08-03-22, 02:19 AM   #13
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 875
Downloads: 72
Uploads: 3
Default

Returning to meddling with plane AI after a long break. As a little recap, I made a video showing difference between airplane AI as it is in TWoS and what happens if we tell planes to strafe, not bomb, fast moving targets:



In the above, I set 6 planes starting at 6 km distance (Sunderland, B-17, Liberator, Swordfish, Martlet, Catalina) to bomb our boat which is simply sailing in straight line at flank speed.

Results:

- unmodified AI: only level bombers even drop bombs, and after 3 minutes U-Boat is more or less intact (only light damage from guns).
- "strafing" planes: two planes crash into sea, but remaining ones score several hits in 3 minutes sending U-Boat to the bottom.

Edit:
- Behaviour is only modified for targets moving over 5 kts. For static/slow targets planes use SetCourseBomb approach which is much safer.
- I tried to add condition checking plane's own speed to break off the attack if in danger of stalling, but to my suprise GetCurrentSpeed() function returns unit's maximum, not current speed so it proved useless for this. Only thing that somewhat reduces stalling is increasing plane minimum height, but this has to be done on plane-by-plane basis.

Last edited by kapuhy; 08-03-22 at 04:35 AM.
kapuhy is offline   Reply With Quote
Old 08-03-22, 05:22 PM   #14
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Brilliant!

Other than increased stalling chances for strafing planes, have you noticed any other undesired side effect?

On a partly unrelated note: as you probably know coastal defenses featured in TWoS are in reality floating gun platforms. This is the only workaround I and Vecko found to land units not being able to shoot their guns. IIRC in stock game coastal batteries can aim and follow targets, but they never fire. Do you think we can fix them by editing their AI routines, the way you did with AI sub's deck guns?

Edit: have you tried if the GetCurrentSpeedKnots() function works as supposed?
__________________
_____________________
|May the Force be with you!|
...\/

Last edited by gap; 08-04-22 at 04:00 AM.
gap is offline   Reply With Quote
Old 08-04-22, 11:11 AM   #15
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 875
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by gap View Post
Other than increased stalling chances for strafing planes, have you noticed any other undesired side effect?
Not really, I mean they do pull off unrealistically looking maneuvers but that's just SH5 physics. Also, slower planes do seem to follow a sinusoidal flight path sometimes for whatever reason.

Quote:
Originally Posted by gap View Post
On a partly unrelated note: as you probably know coastal defenses featured in TWoS are in reality floating gun platforms. This is the only workaround I and Vecko found to land units not being able to shoot their guns. IIRC in stock game coastal batteries can aim and follow targets, but they never fire. Do you think we can fix them by editing their AI routines, the way you did with AI sub's deck guns?
I don't know. Currently land units don't use any AI file, the question is if we create an AI script for land units will they even recognize it?

Quote:
Originally Posted by gap View Post
Edit: have you tried if the GetCurrentSpeedKnots() function works as supposed?
Different units, same problem - if returns unit's maximum speed in knots.

By the way, ship-weapons.aix script uses the same function to ensure an escort is not going too slow before dropping DC's. I bet this is bugged too and related to destroyers blowing themselves occasionally.
kapuhy is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:15 PM.


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