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 05-22-12, 07:00 AM   #451
Trevally.
Navy Seal
 
Join Date: Apr 2007
Location: AN1536 (Orkney)
Posts: 5,448
Downloads: 166
Uploads: 28


Default

Quote:
Originally Posted by sober View Post
You can call me the doctor . I jumped ahead in time , its 11:45 AM here .
Doctor who
__________________
Trevally Mods for SH5
Trevally. is offline   Reply With Quote
Old 05-22-12, 07:07 AM   #452
volodya61
Ocean Warrior
 
volodya61's Avatar
 
Join Date: Feb 2012
Location: Rostov-on-Don, local time GMT+4
Posts: 3,292
Downloads: 374
Uploads: 0


Default

Quote:
Originally Posted by Trevally. View Post
Doctor who
Dr. Hannibal Lecter?
__________________
.
Where does human stupidity end?

.


El sueño de la razón produce monstruos © - and for some people awakening will be cruel
volodya61 is offline   Reply With Quote
Old 05-22-12, 07:27 AM   #453
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
I see why the dud probability is a 'strange one'. They load in the % chance for dud as read from .sim file, then they multiply it by some float value, then they multiply it by another float value, then they finally multiply it by another float value (looks to be related to some kind of skill). After all that multiplication it's no longer near it's original value (it's much less)
There had to be a rationale making devs to implement such a convoluted method. I wonder wich one...

Quote:
Originally Posted by TheDarkWraith View Post
That's why I'm changing it! When I'm done with it:
- it will read in % chance for dud as read from sim file (value is between 0 and 100)
- it will get a random number
- it will scale that random number to be between 0 and 100
- it will compare % chance for dud to scaled random number to determine if dud or not

That is how it should've been done in the first place
That's the most obvious method, indeed!

By the way, I've found a quite comprehensive essay on the torpedo crisis. Here's the link, just in case some willing person wants to dig in it, looking for facts and figures:

http://eaglescholar.georgiasouthern...._201005_MA.pdf
gap is offline   Reply With Quote
Old 05-22-12, 08:02 AM   #454
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by Trevally. View Post
Doctor who
Herr Dkt. Zober, the most controversial scientist of the Third Reich. Several years after the German defeat, his time machine was found abandoned in the parking of a supermarket in Fremantle, Australia. From then on, no other proof of his existence was found, at least until yesterday at 11:45 AM, local time of Adelaide.
gap is offline   Reply With Quote
Old 05-22-12, 09:06 AM   #455
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by col_Kurtz View Post
Maybe I`m wrong.
Open by old SH5patcher and set these values (True) to False = Not patched?
After this try to patch with newest one, again from False to True?
Quote:
Originally Posted by sober View Post
double click on the sh5patcher\file\open\TDW_SH5_Patches.s5p
select path to sh5exe ending with silent hunter 5
click ok
make all False
do the same for all the patches

Extract the new patcher to your sh5 main game folder overwriting the old patcher . Repeat the process to enable true on all the patches . Copy the blue exe icon (4.17mb) to your desktop and launch from that .
Correct
TheDarkWraith is offline   Reply With Quote
Old 05-22-12, 09:11 AM   #456
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by gap View Post
There had to be a rationale making devs to implement such a convoluted method. I wonder wich one...
That's kind of the fun part when using RE methods on software. Many times you see some code and you try to think what were the programmers thinking? It's just like a giant jig-saw puzzle. Every little piece you discover adds to your understanding of the whole
TheDarkWraith is offline   Reply With Quote
Old 05-22-12, 12:14 PM   #457
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

v1.0.26.0 released. See post #1

This version correctly computes the impact dud random number to compare against the dud % chance specified in torpedoes .sim file. There is no reason to use high values for the dud % chance in the torpedoes .sim file anymore - only need values in range of 0 to 100

Even if you set the dud % chance to 100 (or higher) in the torpedoes .sim file you could still have impact detonations The reason is because the game sometimes 'jumps over' the impact dud check I haven't narrowed down exactly what the trigger is that causes this 'jumping over' of the dud check yet. When I do you can bet I'll release a patch to fix it

Magnetic torpedoes duds I'm still working on

Heed the warning in yellow under the download link at post #1 or the patcher app will tell you the file has problems.

TheDarkWraith is offline   Reply With Quote
Old 05-22-12, 02:24 PM   #458
elanaiba
Ace of the Deep
 
Join Date: Mar 2005
Location: Bucharest, Romania
Posts: 1,056
Downloads: 3
Uploads: 3
Default

I think there's supposed to be some accounting for angle of impact for dud chance?
__________________
With strength I burn...

elanaiba is offline   Reply With Quote
Old 05-22-12, 03:20 PM   #459
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by elanaiba View Post
I think there's supposed to be some accounting for angle of impact for dud chance?
Well Hello! You think that the angle of impact is a factor in the dud chance? That might explain one of the multiplications

For an impact (non-magnetic) the game says torpedo impacted something, then it checks the impact angle to those defined in the torpedoes .sim file. If the impact angle falls within a max_angle, min_angle combo defined in .sim file then it jumps to do a dud % check. In the dud % check the game loads the % dud chance defined in .sim file into XMM register. The game then retrieves a random number and stores it into another XMM register. Now here's where stock code does 3 multiplications on that random value. Two of them are fractional values, the third is always 1.0 (I believe this one is related to a skill?). Any idea what these 2 fractional values are for? I haven't been able to track them down yet. From what you're saying one of those fractional values could be related to impact angle? So game gets random number, reduces the random number by some fractional % based on impact angle, multiplies that by another fractional number, then finally multiplies that by 1.0...the final 'random' number is so small you never get any duds! I'll have to think this one over more

Any idea as to why the game skips the impact angle check (and thus the dud % chance check) sometimes on impact detonations?
TheDarkWraith is offline   Reply With Quote
Old 05-22-12, 03:31 PM   #460
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

ok magnetic detonator duds...here's my idea:
- have a set % chance that every torpedo with magnetic detonator can be a dud (let's say we set it at 10% failure rate)
- when game says magnetic impact happened get a random number. If this random number falls within the % chance of magnetic failure then get another random number. Scale this random number to fall within 0.0 to 1.0 value. Multiply this scaled random number by the magnetic detonator range defined in torpedoes .sim file. Let's say scaled magnetic detonator random value is 0.63, magnetic detonator range is 2m. 2 * 0.63 = 1.26m. Recheck for magnetic detonator collision with new magnetic detonator range. If check fails to show collision do not detonate. If check says collision still happened:
- do an impact angle check like impact torpedoes do. If the angle is 90 to x degrees (torpedo passing at right angle to ship's course) get a random number. If this random number is greater than some preset value then torpedo is allowed to detonate. If not, torpedo continue on it's merry way. We could define many ranges for this magnetic impact angle check.

What do you think?
TheDarkWraith is offline   Reply With Quote
Old 05-22-12, 04:20 PM   #461
THE_MASK
Ace of the deep .
 
THE_MASK's Avatar
 
Join Date: Jan 2006
Posts: 9,153
Downloads: 901
Uploads: 73


Default

Do you have dud torpedoes checked in the ingame options ?
THE_MASK is offline   Reply With Quote
Old 05-22-12, 04:25 PM   #462
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by sober View Post
Do you have dud torpedoes checked in the ingame options ?
You asking me? If so, yes I do
TheDarkWraith is offline   Reply With Quote
Old 05-22-12, 05:59 PM   #463
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
ok magnetic detonator duds...here's my idea:
- have a set % chance that every torpedo with magnetic detonator can be a dud (let's say we set it at 10% failure rate)
- when game says magnetic impact happened get a random number. If this random number falls within the % chance of magnetic failure then get another random number. Scale this random number to fall within 0.0 to 1.0 value. Multiply this scaled random number by the magnetic detonator range defined in torpedoes .sim file. Let's say scaled magnetic detonator random value is 0.63, magnetic detonator range is 2m. 2 * 0.63 = 1.26m. Recheck for magnetic detonator collision with new magnetic detonator range. If check fails to show collision do not detonate. If check says collision still happened:
- do an impact angle check like impact torpedoes do. If the angle is 90 to x degrees (torpedo passing at right angle to ship's course) get a random number. If this random number is greater than some preset value then torpedo is allowed to detonate. If not, torpedo continue on it's merry way. We could define many ranges for this magnetic impact angle check.

What do you think?
according to the information I've read so far, detonation chance for magnetic torpedoes was affected by the change of magnetic field over time. This factor, on turn, should depend on:
  • target mass;
  • torpedo depth, i.e. distance of the torpedo from the targets' keel;
  • relative speed of the torpedo compared to the speed of the target*.
Quote:
*here comes into the picture the angle of impact.
By assuming that:

S = relative speed
S(tp) = torpedo speed
S(tg) = target speed
A = angle of impact, where 0° = impact from stern

then:

S = S(tp) - S(tg) * (|A-180|-90)/90

for A = 0, i.e. torpedo aimed to stern, S = S(tp) - S(tg); reduced relative speed of torpedoes fired astearn of the target ship was a well documented cause of missed detonation.
for A = 180, i.e. torpedo aimed to stern S = S(tp) + S(tg); increased relative speed could lead to higher chance of premature explosion, but this is just my deduction.
for A = 90 or 270, i.e. 90 deg shot, S = S (tp); as for impact torpedoes, 90 deg shot had to be the best solution
In my opinion you should integrate these factors in a single variable, and compare it with the dud chance for deciding wether the detonation will happen or not.
gap is offline   Reply With Quote
Old 05-22-12, 06:13 PM   #464
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,959
Downloads: 147
Uploads: 5


Default

I have to 'find' all these variables first...that's the hardest part! I like the idea but whether can be implemented or not depends on whether I can find all the variables needed

In the meantime I have a magnetic detonator defect check coded in. When the player launches the torpedo I added a hook into the torpedo initialization routine that will check for magnetic detonator defect. The current defect rate is set at 10%. This defect is a failure of the magnetic detonator to detect at the range specified. So if the game determines that this torpedo has a defect it will get a random number, scale it to between 0.0 and 1.0, and multiply that scaled random number by the magnetic detonator range specified in the torpedo .sim. This new value will be the torpedo's new magnetic detonator range
TheDarkWraith is offline   Reply With Quote
Old 05-22-12, 06:42 PM   #465
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,160
Downloads: 793
Uploads: 10
Default

Quote:
Originally Posted by TheDarkWraith View Post
I have to 'find' all these variables first...that's the hardest part! I like the idea but whether can be implemented or not depends on whether I can find all the variables needed
some of those variables can be read directly from ships cfg, others are stored in torpedo.sim, still others are user defined or context dependent. I hope (or better I trust) one day you will find their memory addresses, or whatever you need for giving the last touches to your excellent work.

Quote:
Originally Posted by TheDarkWraith View Post
In the meantime I have a magnetic detonator defect check coded in. When the player launches the torpedo I added a hook into the torpedo initialization routine that will check for magnetic detonator defect. The current defect rate is set at 10%. This defect is a failure of the magnetic detonator to detect at the range specified. So if the game determines that this torpedo has a defect it will get a random number, scale it to between 0.0 and 1.0, and multiply that scaled random number by the magnetic detonator range specified in the torpedo .sim. This new value will be the torpedo's new magnetic detonator range
yeah, this is the method you described in your previous post. Brilliant!

EDIT:

I've tested your sailboat test mission. Soon I will post my report in the relevant thread
gap is offline   Reply With Quote
Reply


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