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-24-21, 04:10 PM   #76
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,300
Downloads: 130
Uploads: 0


Default

You know Ships have this.
WNOperationAirContactComm

Now before anyone freaks about playing with the AI Files from TDW?
This is from the readme released with the Mod.
NOTE: this mod can be customized by editing the \data\Scripts\AI\init.AIX. I went to great lengths to make it user customizable and for testing different setups/configurations (testing)
__________________
I don't do Stupid. So don't ask.

Last edited by Jeff-Groves; 03-24-21 at 04:18 PM.
Jeff-Groves is offline   Reply With Quote
Old 03-25-21, 04:17 AM   #77
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 873
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by Jeff-Groves View Post
You know Ships have this.
WNOperationAirContactComm
Ok, I looked into it but fail to grasp how I can use this. It seems to be a strategy for warships for maneuvers when air contact is detected - three different maneuver patterns depending on distance to the plane (no threat, threat and critical). Granted I don't understand half these commands but nothing I saw seem to affect firing any cannons.

In other news, I did have a little progress yesterday. Since ship can fire AA, I thought I'd change relevant conditions and commands in Sub-Attack AI file from Sub: (command) to Ship: (command).

That got U-boats to fire AA guns at planes, but the fire was very intermittent (couple shots, back to ignoring planes, again couple shots after some time) and accuracy looks like they have gunner's mate first class Philip A. from Spaceballs manning the gun.

Edit: in general, something that can be looked into by modders re: sh5 scripting, is that it seems while various AI commands only work when used by "ship" "sub" or "plane", game seems to accept if we put "ship: do thing x" in plane ai file or vice versa. TDW already used this in his plane strategies, now it seems to allow subs to fire guns, perhaps there are more situations where using "someone else's" command can be beneficial

Last edited by kapuhy; 03-25-21 at 05:02 AM.
kapuhy is offline   Reply With Quote
Old 03-27-21, 10:52 AM   #78
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 873
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   #79
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,300
Downloads: 130
Uploads: 0


Default

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

Then see about GetMyWeight?
__________________
I don't do Stupid. So don't ask.
Jeff-Groves is offline   Reply With Quote
Old 08-03-22, 02:19 AM   #80
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 873
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   #81
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
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   #82
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 873
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
Old 08-04-22, 04:42 PM   #83
propbeanie
CTD - it's not just a job
 
propbeanie's Avatar
 
Join Date: May 2016
Location: One hour from Music City USA!
Posts: 9,719
Downloads: 439
Uploads: 2


Default

What CrewRating do you have the planes or AirBase set to kapuhy? We found in SH4 that they have to be set to Elite to even begin to look like airplanes flying, and even then, they will attempt 90 degree climbs, and even appear to stall-out and fall backwards after dive-bombing. Of course, we don't have scripting in SH4, therefore that CrewRating is very important.
__________________

"...and bollocks to the naysayer/s" - Jimbuna
propbeanie is offline   Reply With Quote
Old 08-04-22, 04:54 PM   #84
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,300
Downloads: 130
Uploads: 0


Default

One would need to release the scripts for others to check.
Just saying something means nothing so gives us nothing to work with.
I'm also wondering about any other attempts to do such things.
I don't recall details of HOW one did thimgs.
__________________
I don't do Stupid. So don't ask.

Last edited by Jeff-Groves; 08-04-22 at 05:02 PM.
Jeff-Groves is offline   Reply With Quote
Old 08-05-22, 01:27 PM   #85
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,300
Downloads: 130
Uploads: 0


Default

Just a quick look at the Scripting for AI Units?
I can't find any reason one could not do Scripts for the Land Units.
Even scanning the base files in SH5 leads me to believe it can be done.
__________________
I don't do Stupid. So don't ask.
Jeff-Groves is offline   Reply With Quote
Old 08-05-22, 02:18 PM   #86
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 873
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by propbeanie View Post
What CrewRating do you have the planes or AirBase set to kapuhy?
Default setting (that I used in video above) is Veteran. I've tested it again with Elite today, with mixed results:

Try 1: 1 plane crashed (Liberator), 1 minute to kill U-Boat
Try 2: 2 planes ran into each other and fell on U-Boat, killing it
Try 3: 1 plane crashed (Liberator), 2 minutes to kill U-Boat

So, mostly better in my first test but very inconsistent. I don't know what to make of it.

Also, some planes (Liberator for example) crash a lot more than others.

Quote:
Originally Posted by Jeff-Groves View Post
One would need to release the scripts for others to check.
Just saying something means nothing so gives us nothing to work with.
I'm also wondering about any other attempts to do such things.
I don't recall details of HOW one did thimgs.
I agree and the only reason I didn't simply attach files to this thread for anyone to test is I'm not sure I can, copyright-wise - after all, I just changed a bunch of lines in TDW's scripts, wouldn't uploading modified files on forum require his permission first?

That said, I'm pretty sure I can post exact changes I made. In Airplane.aix there's a strategy "BombCoursePopUp". I replaced it with this:

 
strategy BombCourseStrafe(Plane)
{
precond
{
Plane:GetContactRelDistOnWater() <= 3500 and Ship:GetContactSpeed() > 5
}
action
{
Plane:Strafe(1.0);
}
}

strategy BombCourseSlow(Plane)
{
precond
{
Plane:GetContactRelDistOnWater() <= 3500 and Ship:GetContactSpeed() <= 5
}
action
{
Plane:SetCourseBombs();
}
}


By the way, I have no idea what does the number in brackets after Strafe stand for. Tried various values here and plane behaviour seemed similar.

Quote:
Originally Posted by Jeff-Groves View Post
Just a quick look at the Scripting for AI Units?
I can't find any reason one could not do Scripts for the Land Units.
Even scanning the base files in SH5 leads me to believe it can be done.
Then it is certainly worth trying
kapuhy is offline   Reply With Quote
Old 08-05-22, 02:46 PM   #87
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,300
Downloads: 130
Uploads: 0


Default

His Copyright stuff really means nothing as He broke the License of the Game to start with and I'd doubt he'd even stand a chance inforcing anything.

As to uploading? He went 'POOF' years ago and does not respond to messages so it's fair Game to modify anything.

Of course I will state that IF you use his work? Credit it! Been enough of that issue going on.

Now. There's a lot of things in the Scripts one needs to understand and look at.
One can create different actions that you'll not find in the Scripts.
__________________
I don't do Stupid. So don't ask.
Jeff-Groves is offline   Reply With Quote
Old 08-05-22, 03:01 PM   #88
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,300
Downloads: 130
Uploads: 0


Default

As to Land Units?
I ask what gap and others tried to get them working.

I'm not about to start from scratch if other methods were tried.
__________________
I don't do Stupid. So don't ask.
Jeff-Groves is offline   Reply With Quote
Old 08-05-22, 03:54 PM   #89
Jeff-Groves
Village Idiot
 
Jeff-Groves's Avatar
 
Join Date: Sep 2014
Posts: 5,300
Downloads: 130
Uploads: 0


Default

On Plane Strafe?
I'm not finding a definition on that.
Any Action needs a defined definition.

So one would need to declare the Strafe Action.
That was never done in TDW's stuff so guess what?
It is a NULL action.
Should one write a Strafe Action for Planes?
You could control speeds based on different conditions.
__________________
I don't do Stupid. So don't ask.

Last edited by Jeff-Groves; 08-05-22 at 04:07 PM.
Jeff-Groves is offline   Reply With Quote
Old 08-06-22, 01:07 PM   #90
kapuhy
Grey Wolf
 
Join Date: Oct 2010
Location: Poland
Posts: 873
Downloads: 72
Uploads: 3
Default

Quote:
Originally Posted by Jeff-Groves View Post
On Plane Strafe?
I'm not finding a definition on that.
Any Action needs a defined definition.

So one would need to declare the Strafe Action.
That was never done in TDW's stuff so guess what?
It is a NULL action.
Should one write a Strafe Action for Planes?
You could control speeds based on different conditions.
Umm, newbie question time... Could you point me to an example of such definition (for any action)? I'd like to learn how these definitions work but was unable to find one.
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 04:28 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.