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 > SHIII Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 02-20-17, 04:43 PM   #1
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default Scripted Aircraft in Silent Hunter 3 (SH3)

Scripted Aircraft in Silent Hunter 3 (SH3) - Proof of concept and a hard-code solution.

When the developers created SH3, they intended that all aircraft would be spawned randomly from land bases placed in file campaign_RND.mis. Aircraft would be flown off at random intervals, based on the proximity of any air-base within range of the U-boat, but would not be permitted to fly in poor visibility. No aircraft were placed in the scripted layer (campaign_SCR.mis).

The Problem.
However, the randomly generated aircraft suffer from two defects:
1. Attacks are made far too frequently on a U-boat that is close to an air-base.
2. In real life, aircraft were sometimes given orders to patrol (fly up and down) specific areas of the sea and nowhere else. This was particularly the case for air patrols over the north-west of Spain from January 1943 to June 1944. The effect cannot be mimicked with aircraft from an air-base in campaign_RND.mis by any adjustment of the file airstrike.cfg.

It would seem, then, that scripted air patrols ought to solve both these problems. However, experience soon shows that scripted air patrols are not very successful. If they are placed in the campaign_RND.mis file, the aircraft behave like flying merchant-ships, often failing to see the U-boat at all, rarely dropping bombs, and never using radar. If the scripted air patrols are placed in campaign_SCR.mis, these difficulties are greatly reduced, but there remains one major difficulty. The aircraft continue to fly in ‘fog’ (bad visibility caused by storms), unlike the randomly generated aircraft from air-bases.

When one writes a scripted aircraft patrol, it is necessary to make the aircraft fly out from base, and then for very long patrols, usually involving a loop where the aircraft keeps going round in a scripted circle without ever returning to base (there is no limit to fuel for scripted aircraft). The alternative would be to write a scripted patrol for every day, for as many months as are needed - an enormous effort that would create a huge campaign_SCR.mis file. The air-bases of campaign_RND.mis need be written only once or twice, to accommodate changing numbers of aircraft and their types at each air-base. What if a scripted aircraft is shot down? Then there will be no replacement aircraft until the U-boat finishes its patrol and starts a new patrol.

A practical solution would be to allow seven-day scripted patrols, after which the next seven-day patrol followed, and so on for the total period required. Of course, if the aircraft was shot down on day one of its seven-day patrol, then there would be no patrol for the next six days, until the new patrol was due to begin. However, aircraft are rarely shot down, and this idea provides a less tiresome solution than writing daily scripts for months. Incidentally, tests of the code for SH3 during trials with scripted aircraft show clearly that a damaged aircraft is ‘repaired’ (and given a full bomb load) every time that it departs from the U-boat and is encountered at a later date.

The Solution.
The same idea also provides the solution to prevent scripted aircraft from flying in bad visibility. The weather is tested, and if the visibility is medium fog (or worse), the program itself can destroy the aircraft before the U-boat even encounters it (by identifying any scripted aircraft with exactly 288.75 hit-points at first contact). It will be replaced by a new scripted aircraft in up to a week’s time.

Aircraft don’t really use radar.
I believe from testing that actually no radar-fitted bomber uses its radar to locate the U-boat - the radar serves only to alert the U-boat in SH3. The scripted bomber flies unconcernedly on until it sees the U-boat visually - then it will attack. The land-based bomber however is generated just a short distance away from the U-boat, and is given the correct angle by the code to fly towards the U-boat. Only later does the aircraft see the U-boat lying across its path.

The package supplied:
A zip file called Scripted_Bombers.7z. It contains a folder that is ready for use with JSGME, with three campaign files - the campaign_RND.mis and campaign_LND.mis files contain nothing at all(! - except the single U-boat base of St Nazaire), while the campaign_SCR.mis file contains a single series of patrol files for a single Sunderland bomber ‘MKS’. These files are active during September 1943 ONLY. The package also contains TWO SH3_collisions.act files, one to replace the stock SH3Collisions.act, the other to replace H.sie's modified SH3Collisions.act

Feedback requested.
I’d be interested in feedback/suggestions from other users, especially those using stock SH3 or one of the super-mods that is not NYGM. You can add the MKS Sunderland with scripts to the bottom of your usual campaign_SCR.mis file, before the ordnance scripts.

Permanence.
You can leave your new SH3Collisions.act file in place *permanently* (even if you don’t want scripted aircraft), since the new code is only implemented when it encounters any aircraft with hit-points of exactly 288.75. Alternatively, you can modify some of your bombers to have HPs 288.75 and use them from air-bases in campaign_RND.mis AND in scripted missions in campaign_SCR.mis.

Download from:
http://www.subsim.com/mods1/nygm/Scripted_Bombers.7z

Be sure to read the read-me file, which contains important practical details too long for this post.

Stiebler.
Stiebler is offline   Reply With Quote
Old 02-20-17, 06:46 PM   #2
areo16
Sonar Guy
 
Join Date: Oct 2013
Posts: 377
Downloads: 64
Uploads: 0
Default

Hi Stiebler,

This is interesting but I am more interested in where in the hex or from what offset the heap for units generated within uboat line of sight are? For example, as you say the bomber will have full bomb load and not be injured when it returns to uboat. This means it is leaving and then reentering the stack, having the object being created again like new.

What is the offset and where is it located for ships, airplanes and land units that are near the uboat during patrol? This data would be very helpful.

I'm looking for pointers and offsets here. Thank you.
areo16 is offline   Reply With Quote
Old 02-21-17, 09:35 AM   #3
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default

@Areo16:

The specific intercept that I use is in the code beginning at SH3Collisions.act+02e70. Register ebx points to the active unit.

This is particularly useful, in that:
a) only scripted units (including the player's unit) pass through this code. Randomly-generated units and land units have their own code. This saves a lot of computation.
b) The SH3Collisions.act code is mostly activated only when other units are sufficiently close to the U-boat that a collision (eg with a bomb or shell) might occur.

Thus scripted aircraft can only make my new code active when they are close to the U-boat, but before the U-boat is seen, and before a radar-warning given. Then, in poor visibility, the hit-points at float[ebx+00B8] are set to zero and [ebx+00D0] is also set to zero, which kills further movement of the aircraft.

But note how useful this is: if there are many scripted aircraft flying nearby, only those sufficiently close to the U-boat will be eliminated. The others will continue to fly their scripted routes even in bad weather, so they remain still a threat to the U-boat when visibility becomes better.

I have also revised my plan stated above to provide multiple scripts at 7-day intervals for periods of months in area north-west of Spain. As just stated, most of the scripted aircraft will survive poor visibility anyway, because the U-boat is not near. Moreover - I forgot earlier - most U-boat patrols will be of at least six weeks' duration. Therefore it is only necessary to provide scripts, not for every seven days, but for every six weeks - and at 2-3 month intervals when the air cover was present, but weaker, in the same area.

Stiebler.
Stiebler is offline   Reply With Quote
Old 02-21-17, 11:26 AM   #4
Hitman
Pacific Aces Dev Team
 
Hitman's Avatar
 
Join Date: Sep 2002
Location: Spain
Posts: 6,099
Downloads: 109
Uploads: 2


Default

Here's an alternative for you: Make an invisible unarmed ship that is linked to an airbase (Aircraft carrier) that spaws the period appropiate aircraft. Then you have it patrol the Bay of Biscay or whatever area you want.
__________________
One day I will return to sea ...
Hitman is offline   Reply With Quote
Old 02-21-17, 02:26 PM   #5
Niume
Sea Lord
 
Join Date: Sep 2015
Location: Lithuania
Posts: 1,633
Downloads: 499
Uploads: 2


Default

Hitmans sound smart But would it work? I am really intrested in this project because I rarely see aircraft
__________________


GLORY TO UKRAINE!


[ENG] SH 4 KSD II Ace Edition
Niume is offline   Reply With Quote
Old 02-21-17, 03:45 PM   #6
areo16
Sonar Guy
 
Join Date: Oct 2013
Posts: 377
Downloads: 64
Uploads: 0
Default

Quote:
Originally Posted by Stiebler View Post
@Areo16:

The specific intercept that I use is in the code beginning at SH3Collisions.act+02e70. Register ebx points to the active unit.

This is particularly useful, in that:
a) only scripted units (including the player's unit) pass through this code. Randomly-generated units and land units have their own code. This saves a lot of computation.
b) The SH3Collisions.act code is mostly activated only when other units are sufficiently close to the U-boat that a collision (eg with a bomb or shell) might occur.

Thus scripted aircraft can only make my new code active when they are close to the U-boat, but before the U-boat is seen, and before a radar-warning given. Then, in poor visibility, the hit-points at float[ebx+00B8] are set to zero and [ebx+00D0] is also set to zero, which kills further movement of the aircraft.

But note how useful this is: if there are many scripted aircraft flying nearby, only those sufficiently close to the U-boat will be eliminated. The others will continue to fly their scripted routes even in bad weather, so they remain still a threat to the U-boat when visibility becomes better.

I have also revised my plan stated above to provide multiple scripts at 7-day intervals for periods of months in area north-west of Spain. As just stated, most of the scripted aircraft will survive poor visibility anyway, because the U-boat is not near. Moreover - I forgot earlier - most U-boat patrols will be of at least six weeks' duration. Therefore it is only necessary to provide scripts, not for every seven days, but for every six weeks - and at 2-3 month intervals when the air cover was present, but weaker, in the same area.

Stiebler.

Thank you for this offset. This will help for many things.
areo16 is offline   Reply With Quote
Old 02-22-17, 03:38 AM   #7
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default

@Hitman:
Quote:
Here's an alternative for you: Make an invisible unarmed ship that is linked to an airbase (Aircraft carrier) that spaws the period appropiate aircraft. Then you have it patrol the Bay of Biscay or whatever area you want.
Hi Hitman, nice to see you're still around and active.

If your intention is: place an airbase on the aircraft-carrier, then NYGM has already a very similar solution for the Bay of Biscay. Specifically, it has an air-base placed 800m in the air above the western Bay of Biscay (completely invisible!) stocked with bombers of deliberately short (500km) range. This creates frequent air attacks on a U-boat trying to get in or out of the Atlantic. It is very effective, and forces all U-boats to hug the north coast of Spain to get to/from the Atlantic. There are constant air attacks.

The big problem is that it is impossible to move through the middle of the Bay of Biscay without very, very frequent air attacks. If you are returning from a patrol off Iceland, you have to return to base in a wide loop, finally coming up the west coast of Spain from the south in order to crawl along the north coast back to base.

Likewise, schnorchel patrols close to Britain in 1944-5 are hindered by constant attacks by aircraft spawned from land bases. The central problem is that the closer you are to an air-base, the more frequently aircraft from it attack (probably an inverse square-rule by the devs).

@Areo16:
Acknowledged with thanks.

Stiebler.
Stiebler is offline   Reply With Quote
Old 02-22-17, 08:05 AM   #8
Hitman
Pacific Aces Dev Team
 
Hitman's Avatar
 
Join Date: Sep 2002
Location: Spain
Posts: 6,099
Downloads: 109
Uploads: 2


Default

Like you say, the problem with the fixed airbase is that you can't transit through the centre of the Biscay Bay without too frequent air attacks because the closer to it, the more air attacks. The solution of the moving airbase solves that by randomizing the location of the base itself, which moves over a zone.
__________________
One day I will return to sea ...
Hitman is offline   Reply With Quote
Old 02-22-17, 09:12 AM   #9
Anvar1061
Ocean Warrior
 
Join Date: May 2012
Location: In the sea, on land and above
Posts: 3,340
Downloads: 843
Uploads: 0
Default

Will work this new SH3Collisions.act with my campaign_RND.mis, campaign_LND.mis & campaign_SCR.mis files?
Anvar1061 is offline   Reply With Quote
Old 02-23-17, 07:10 AM   #10
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default

@Hitman:
Quote:
Like you say, the problem with the fixed airbase is that you can't transit through the centre of the Biscay Bay without too frequent air attacks because the closer to it, the more air attacks. The solution of the moving airbase solves that by randomizing the location of the base itself, which moves over a zone.
Yes, that is an interesting idea. The airborne air-base could probably be made to move in a scripted circle with random path at 800m above the Bay of Biscay. Also use aircraft with very short radius.

At the moment, I'm trying to raise the alertness level of the scripted aircraft that I mentioned previously.

@Anvar1061:
Quote:
Will work this new SH3Collisions.act with my campaign_RND.mis, campaign_LND.mis & campaign_SCR.mis files?
Yes. Should work with any campaign files.

Stiebler.
Stiebler is offline   Reply With Quote
Old 03-04-17, 07:53 AM   #11
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default Scripted aircraft in SH3, new information

I've now tested fully Hitman's idea of using a moving land-base for aircraft around the Bay of Biscay, using a moving special airbase floating at around 1200m in the air, and fitted with aircraft of limited range. The movement of the airbases can be seen clearly, if they are allowed to transmit their position every six hours.

This idea works very well, with a selection of two special aircraft. The aircraft require ranges of 300km, chosen by experiment, and the speed of the moving airbases is set at 50km/hr. The aircraft will not attack in medium or thick fog.

However, I have persevered with my original idea of using scripted bombers, as an addition to the moving airbases. The modified file SH3Collisions.act, mentioned earlier, prevents the scripted aircraft from appearing during fog.

Two observations are of interest:
1. When the stealth-meter turns red, it does not mean that the aircraft has detected you. You are detected when the time-compression drops to 8.
2. All the aircraft (scripted or spawned from a land-base) seem to be blind to the U-boat if it is not directly in their line of vision ahead as they fly close. As mentioned previously, the spawned aircraft are given a direct line of flight to the U-boat by the code before they are visible from the U-boat. This makes them deadly. The scripted aircraft can fly in a straight line past your U-boat without seeing it, even if it is close, unless the U-boat is by chance almost directly ahead of the flight of the aircraft.

I'm still trying to find out how to switch on the 'U-boat sighted' flag for scripted aircraft. But in the meantime the combination of moving airbase and scripted aircraft in the Bay of Biscay seems to give just the right level of air attack in late 1943.

Stiebler.
Stiebler is offline   Reply With Quote
Old 03-06-17, 04:13 PM   #12
LGN1
Ace of the Deep
 
Join Date: Mar 2006
Posts: 1,138
Downloads: 147
Uploads: 12
Default

Hi Stiebler & Hitman,

great idea and great news!

Please share your airbase and your Bay of Biscay air-patrol route with us!

Best, LGN1
LGN1 is offline   Reply With Quote
Old 03-07-17, 05:08 PM   #13
Hitman
Pacific Aces Dev Team
 
Hitman's Avatar
 
Join Date: Sep 2002
Location: Spain
Posts: 6,099
Downloads: 109
Uploads: 2


Default

Glad it worked, looking forward to seeing it released as final

Only sad thing is, after all this years the TC bug has not been solved and you have to stay below 256x to get realistic air attacks.
__________________
One day I will return to sea ...
Hitman is offline   Reply With Quote
Old 03-07-17, 05:26 PM   #14
Kendras
Stowaway
 
Posts: n/a
Downloads:
Uploads:
Default

Quote:
Originally Posted by LGN1 View Post
Hi Stiebler & Hitman,

great idea and great news!

Please share your airbase and your Bay of Biscay air-patrol route with us!

Best, LGN1
But now, there will be a conflict with your own mod, right ?

http://www.subsim.com/radioroom/showthread.php?t=218280
  Reply With Quote
Old 03-18-17, 05:30 AM   #15
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default Results now in NYGM_2017

For those who wished to see the results of this work in action:

I have just released the NYGM_2017 patch on the main, sticky, NYGM web-page here at SubSim ( http://www.subsim.com/radioroom/show...postcount=1291 ).

If you download NYGM_2017 (by itself, if necessary, for purposes of examination, although this single mod will not function by itself), you can see what I have done by examining the campaign _LND and _SCR.mis files in SH3 Mission Editor. Also examine the Data\Air\ files in this small mod, to discover the changes made to the cfg and (some) zon files.

Stiebler.
Stiebler 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 11:09 AM.


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.