View Single Post
Old 06-06-11, 08:36 AM   #1428
Stiebler
Fuel Supplier
 
Stiebler's Avatar
 
Join Date: Oct 2005
Location: London, UK
Posts: 1,237
Downloads: 29
Uploads: 4


Default U-boat Surrender.

It is desirable to introduce the option of ‘surrender’ of the U-boat when conditions are sufficiently severe. This was a feature of the old Aces of the Deep, which gave a small chance of being rescued by U-boat and returned to active service. SH3 lacks this feature, and other players in the past have requested this option as a mod.

Currently, whenever the U-boat is sunk in SH3, all the crew is killed, and players who play ‘Dead is Dead’ might as well remained submerged and take their chances when a real crew would certainly surface in order to try to save their lives. So it would be desirable to introduce this feature, partly to encourage the ‘dead-is-dead’ players to surface in the hope of being ‘rescued by another U-boat’, and partly to save some or all of the crew.

So what actually is required from this mod?
1. The U-boat must have suffered sufficient hull damage to want to surrender.
2. The U-boat must be on the surface.
3. It is not necessary that the U-boat be under attack when it surrenders. For example, several commanders had to abandon their U-boats after an air attack caused serious damage, even though the aircraft had long departed.
4. There must be a way of communicating the surrender to the program code.
5. The program code must then compute a chance (say 20%) that you will be rescued and returned to active service. (I.e., you can legitimately start a new career a few months after your U-boat was sunk, with a new boat and a new crew.) Otherwise, the program will compute how many crew are killed and how many survive.

I tried the idea of intercepting the ‘Pressure’ message when the U-boat is sunk, in deep diving tests when U-boat is ‘destroyed by pressure’, but the code which calls the text ‘pressure’ is obviously a general purpose message handling piece of code centred around two consecutive subroutines, of which the first begins at 0x0050DCC0. This code is called very frequently, so not much hope for using it.

It seems to me, however, that most of what is needed in already in place for coding:
1. Must have sufficient hull damage to surrender. H.sie and I have already found a way of including hull-damage in our other code (eg, for the U-tanker repairs).
2. Must be on the surface. This is a tricky problem, and I haven’t been able to find the flag (there must be a simple flag, and it seems to be only one or two bytes judging by my trials to locate it.) But see (3) below.
3. Must be able to communicate the surrender to the program code. Now here there is a solution. Status messages sent to BdU from the U-boat can be intercepted, so the program just has to make one test: Is hull damage sufficiently severe? If so, set a ‘Surrender’ flag to true. And the great attraction of this method is that status messages can only be sent when you are on the surface, and it does not matter whether or not you are under attack! I have now implemented and tested this part of the code completely. Also this is realistic! The ocean is large! If you want to abandon ship and be rescued, you really had better send a message about it.
4. And now the tricky bit. When you finally sink, the code must intercept the message in the code around 0x0050DCC0 that ‘U-boat destroyed by ...’ and substitute the message ‘U-boat abandoned at sea with heavy damage’. At the same time it can calculate how many crew survived (a random figure related to degree of hull damage), and whether the 20% probability of being rescued applies. (If so, supply the message ‘U-boat abandoned at sea, crew rescued’.) This last part, I am attempting now.

In summary then, what I am proposing is this:
a) When your U-boat is severely damaged, then you can send a distress signal - but you must be on the surface to do it.
b) Then you sink your U-boat deliberately. It is called ‘scuttling your boat’ to prevent it from falling into enemy hands.
c) Finally you get a message saying that you and some/most of your crew have survived, and there is a 20% chance that you will be rescued by another U-boat. Otherwise you become a prisoner-of-war.

All OK? Does anyone have any problems with this as a working principle?

Stiebler.
Stiebler is offline   Reply With Quote