View Single Post
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