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 08-26-11, 01:45 PM   #16
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default WIP Impact Angle

I have managed to find a dial in SH3 that does not appear to be used in the TDC operation to my knowledge (Please let me know if this is not the case).

I'm using this dial

Code:
[Dial44]
Name=Impact_Angle
Type=42; DIAL_TGT_ANG_ON_BOW
Cmd=Set_tgt_sel_value
Dial=0x3BBF0002 
CrtVal=0x3BBF0001
NewVal=0x0
DialVal=0,360
RealVal=0,360; degrees
Circular=Yes
I have not noticed any ill effect on using this dial type - but I've not done any real in-dept testing as of yet.

Ok so what have I done:
Basically I have external code that is hijacking that particular dial that is setting it to the position that I've coded.
At the moment It is basically taking the Gyroangle from the game and subtracting 180 from it (In essence mirroring the gyroangle).
I need to work out what the actual code for the Impact Angle needs to be and replace my current code with that maths.

Here you can see it in action:





What calculation will be needed to do this. Is it just the AOB plus the gyro subtracted from 360?


Last edited by reaper7; 08-26-11 at 02:38 PM.
reaper7 is offline   Reply With Quote
Old 08-26-11, 02:43 PM   #17
Wolfstriked
Grey Wolf
 
Join Date: Apr 2011
Posts: 756
Downloads: 230
Uploads: 0
Default

Looks kool Reaper.I do not know how accurate it is modeled in Sh3 the angle on impact.Since we are gonna now have this tool to calculate will there be changes to make off angle hits dud out even more?
Wolfstriked is offline   Reply With Quote
Old 08-26-11, 03:23 PM   #18
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

Quote:
Originally Posted by Wolfstriked View Post
Looks kool Reaper.I do not know how accurate it is modeled in Sh3 the angle on impact.Since we are gonna now have this tool to calculate will there be changes to make off angle hits dud out even more?
Its not modeled at all in Sh3, hence this mod attempt .
What this will do is show a visual indication of the Impact Angle the torp will hit the target. This will be useful for attacks which are not set up for fast 90.
Once I get the formula worked out that is (Maths not being my strong point)

LGN1 has a great tutorial on making more realistic Torpedo duds using SH3 Commander here:
http://www.subsim.com/radioroom/showthread.php?t=158642
reaper7 is offline   Reply With Quote
Old 08-26-11, 04:44 PM   #19
Wolfstriked
Grey Wolf
 
Join Date: Apr 2011
Posts: 756
Downloads: 230
Uploads: 0
Default

Quote:
Originally Posted by reaper7 View Post
Its not modeled at all in Sh3, hence this mod attempt .
What this will do is show a visual indication of the Impact Angle the torp will hit the target. This will be useful for attacks which are not set up for fast 90.
Once I get the formula worked out that is (Maths not being my strong point)

LGN1 has a great tutorial on making more realistic Torpedo duds using SH3 Commander here:
http://www.subsim.com/radioroom/showthread.php?t=158642
Great Reaper and I know its not modeled...yet What I was asking is the angle of impact of a torpedo on the ship....how accurate does SH3 model this in regards to if the torpedo explodes or not.Is it simplified so that a torpedo impacting at an angle of say 30deg will still explode.Which then begs the question....what are the WW2 torpedoes max angle for the pistol to work and did it get better as the war progressed?
Wolfstriked is offline   Reply With Quote
Old 08-27-11, 02:07 AM   #20
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

Quote:
Originally Posted by Wolfstriked View Post
Great Reaper and I know its not modeled...yet What I was asking is the angle of impact of a torpedo on the ship....how accurate does SH3 model this in regards to if the torpedo explodes or not.Is it simplified so that a torpedo impacting at an angle of say 30deg will still explode.Which then begs the question....what are the WW2 torpedoes max angle for the pistol to work and did it get better as the war progressed?
Hi Wolf not sure how this is modeled in SH3, most likely just done as a percentage rate of failure if within a certain angle range.
reaper7 is offline   Reply With Quote
Old 08-27-11, 05:05 AM   #21
makman94
Hellas
 
Join Date: Jul 2008
Posts: 2,325
Downloads: 182
Uploads: 7


Default

Quote:
Originally Posted by reaper7 View Post
......

What calculation will be needed to do this. Is it just the AOB plus the gyro subtracted from 360?

hello Reaper ,

i told you at my previous message what angles are involving for calculating the impact angle.(read it again more...carefull).
at your figure ...you have drawn wrong the impact angle (it is not the 'x'and forget the Aob) .look at pic :




now, generally speaking the formula for getting the impact angle is :

(ImpactAngle) = (AoB at bearing 0) + (Gyroangle)

OR

(ImpactAngle) = (AoB at bearing 0) - (Gyroangle)

depending if you shoot right or left of your bearing 0 and depending if you are on a port or on a starboard attack.

the rule is this : when your gyroangle = 0 then the (ImpactAngle) is equal to (AoB at bearing 0).NOW, if you shoot with gyro NOT 0 degrees the needle of Impact angle dial will 'follow' the GYROANGLE dial and either will add or abstract the gyro angle .look at the following pics to understand how the impact angle dial works.

ps: your idea by using one of the existing types for dial and use it for the needle of impact angle will go nowhere . the only thing that you will manage is to make the needle just moving around but it will never show the impact angle .you need the code ,without the code it will be very complicated to show the impact angle (and this will not be directly shown).
LGN1 has managed to 'appear' the impact angle(without the code) but it is so complicated that only advanced player will be able to 'read'.

port attack :







starboard attack :








===============
__________________
Knowledge is the only thing that nobody can ever take from you...



Mediafire page:http://www.mediafire.com/folder/da50.../Makman94_Mods

Last edited by makman94; 08-27-11 at 05:15 AM.
makman94 is offline   Reply With Quote
Old 08-27-11, 11:38 AM   #22
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

Quote:
Originally Posted by makman94 View Post
hello Reaper ,

i told you at my previous message what angles are involving for calculating the impact angle.(read it again more...carefull).
at your figure ...you have drawn wrong the impact angle (it is not the 'x'and forget the Aob) .look at pic :


now, generally speaking the formula for getting the impact angle is :

(ImpactAngle) = (AoB at bearing 0) + (Gyroangle)

OR

(ImpactAngle) = (AoB at bearing 0) - (Gyroangle)

depending if you shoot right or left of your bearing 0 and depending if you are on a port or on a starboard attack.

the rule is this : when your gyroangle = 0 then the (ImpactAngle) is equal to (AoB at bearing 0).NOW, if you shoot with gyro NOT 0 degrees the needle of Impact angle dial will 'follow' the GYROANGLE dial and either will add or abstract the gyro angle .look at the following pics to understand how the impact angle dial works.

ps: your idea by using one of the existing types for dial and use it for the needle of impact angle will go nowhere . the only thing that you will manage is to make the needle just moving around but it will never show the impact angle .you need the code ,without the code it will be very complicated to show the impact angle (and this will not be directly shown).
LGN1 has managed to 'appear' the impact angle(without the code) but it is so complicated that only advanced player will be able to 'read'.

Hmmm, Ok need to study this to figure out how it works correctly.
Thanks for the more indepth explanation on how it works - afraid I don't play much spend more time modding than playing .
The reason for my diagram is due to I wish to figure out a calculation that calculates the ImpactAngle from your Scope bearing rather than just at 0 degrees. So what I need to know is how does the AOB change when moving from 0 to say 90deg in relation to AOB along the same target course line.
Using your examples above I will figure out the calculation for 0 degrees, than rotate to 45 degrees, 90 degrees a35 degrees etc and see what the change is to update the formula.
(Away for the weekend but have my laptop with me so may get some time to work on it.)

As for code, don't worry about that my example video is showing the Sims Dial being controlled by my code overwirting what ever the game wants to do with it.
So I have code in my app thats retriving the Gyroange and just subtracting it from 360 to mirror the gyro (But its my code thats moving the hijacked dial).
So it will do what I want it to do so once I program the formula above it will show the angle.



EDIT: Ok studied those diagrams and explanations and its finally clicked OK now I understand what the Impact Angle is doing.Thanks makman your a great Teacher - everything I've learnt about the Interface and its operation is due to you. Cheers.

Last edited by reaper7; 08-27-11 at 01:02 PM.
reaper7 is offline   Reply With Quote
Old 08-27-11, 03:48 PM   #23
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

Using your example pics above I worked out the following:

AOB Gyro Bearing Impact Angle

-120 0 0 -120
-100 30 20 -90
-140 -30 -20 -150
120 0 0 120
140 20 20 140
105 -20 -15 100

So Using the above figures I was able to work out the Required formula to calculate the Impact Angle:

(AOB + (Gyro - Bearing)) = Impact Angle

Popping in the above shows they work out

(-120)+(0-(0))=-120
(-100)+(30-(20))=-90
(-140)+(-30-(-20))=-150
(120)+(0-(0))=120
140+(20-(20))=140
105+(-20-(-15))=100

Now to write the code and test
reaper7 is offline   Reply With Quote
Old 08-27-11, 04:40 PM   #24
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

It Works
The Impact Angle is working properly using the above formula and my code.

I'm going to pack this up for Makman94 to test and confirm that it works correctly.
And to make sure that by hijacking this dial-type that its not having any other unforeseen consequences on the sim.
If it works this will be Incorporated into our TDC in the U-Boot_HAHD project.





@Makman, File sent to your yahoo account.

Last edited by reaper7; 08-27-11 at 05:27 PM.
reaper7 is offline   Reply With Quote
Old 08-27-11, 07:34 PM   #25
Wolfstriked
Grey Wolf
 
Join Date: Apr 2011
Posts: 756
Downloads: 230
Uploads: 0
Default

Great stuff Reaper and you said you are not good at math.....
Wolfstriked is offline   Reply With Quote
Old 08-28-11, 04:30 AM   #26
makman94
Hellas
 
Join Date: Jul 2008
Posts: 2,325
Downloads: 182
Uploads: 7


Default

FANTASTIC work Reaper7 !!!!
yes ,the formula you found (many many congrats !! ) seems that covers all situations and works correct

[just a note : the values for the above examples are :

-120 0 0 -120
-99 30 21 -90
-141 -30 -21 -150
120 0 0 120
134 20 14 140
106 -20 -14 100 ]

the impact angle dial is working absolutely correct BUT
there are side effects to other areas which are not allowing to use it ingame yet !
i am almost sure that ,thanks to Reaper, we are very close to overcome these side effects and have ,at last, an ORIGINAL Impact Angle dial for SH3!
just hope to solve the issues !

Congratulations Reaper !
__________________
Knowledge is the only thing that nobody can ever take from you...



Mediafire page:http://www.mediafire.com/folder/da50.../Makman94_Mods
makman94 is offline   Reply With Quote
Old 08-28-11, 05:51 AM   #27
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

Quote:
Originally Posted by makman94 View Post
[just a note : the values for the above examples are :

-120 0 0 -120
-99 30 21 -90
-141 -30 -21 -150
120 0 0 120
134 20 14 140
106 -20 -14 100 ]

the impact angle dial is working absolutely correct BUT
there are side effects to other areas which are not allowing to use it ingame yet !
i am almost sure that ,thanks to Reaper, we are very close to overcome these side effects and have ,at last, an ORIGINAL Impact Angle dial for SH3!
just hope to solve the issues !

Congratulations Reaper !
I have a habbit of rounding thing up or down - thats my bad maths head

But as stated the formula works - so we are very close to a fully functional dial.

My next step using the Dial types you supplied me is to find one that will have no impact on the game (Current one effect other parts of the sim).
Then I can get rid of the Static Impact Angle in our TDC with a working Impact Angle.
Bur I'm sure we'll find one.
reaper7 is offline   Reply With Quote
Old 08-28-11, 03:39 PM   #28
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

Ok I believe I have a perfect working solution.

Its was a lot more complicated than I expected.

The problem with Hijacking dials is other function use them under the hood and so we get unwanted side effects.
My first attempt used the tgt_bearing dial which although was not being used visually by the TDC is being used by the Stadimeter and other areas.
This caused them to stop functioning correctly.

Solution find another dial that's not being used:

Well this proved impossible all dial types that are writable are being used.
There are 2 dial types:
  1. Ones writable by the user eg: Bearing
  2. Ones non-writable to the user eg clock seconds
So i need another workaround to use my code - after digging tru the command.cfg and the dial types available, I had an idea

Maybe its possible to use the Bearing dials after all there are 2 used for it.
  • Dial_Bearing
  • Dial_Bearing_10ths

So I converted my Dial over to the Dial_Bearing_10ths but my code didn't work, the dial_bearing10ths is non-writable or so it seemed
After digging about in Sh3's code I traced whats happening.
The Sim writes the Value of the Bearing to the Dial_Bearing and the using more code writes the bearings 1units to the Dial_Bearing_10ths. As the sim is constantly updating this value it will overwrite anything written to that location by my code (so appearing Read Only).

So loading the assembly I found the part of code that writes the value to the Dial_Bearing_10ths and, well basically blanked it .
So now nothing gets written to that area, leaving my code free to do so.
Thereby converting the Dial_Bearing_10ths needle into my Impact Angle Needle

Now as the games Bearing 10ths dial is no longer correctly bisplaying the bearings 1units (As its now an Impact Angle) that dial needs another trick to get it to work.
This I think can be done by turning that dial type back to a Dial_Bearing and converting the dials.cfg for that dial.

Code:
[Dial11]
Name=Sol_Bearing
Type=24; DIAL_SOL_BEARING
Cmd=Set_TDC_bearing
Dial=0x3B0D00FF
CrtVal=0x3B0D0001
NewVal=0x0
DialVal=0,360
RealVal=0,360; degrees
Circular=Yes
CmdOnDrag=Yes
SndStep=5
SndList=1,Menu.TDC.Bearing,360


[Dial12]
Name=Sol_Bearing10ths
Type=24; DIAL_SOL_BEARING; Converted Dial
Dial=0x0
CrtVal=0x3B0D0077
NewVal=0x0
DialVal=0,360
RealVal=0,360; degrees
Circular=Yes
Just need to work out the values needed for the lines above


EDIT:

Well it all works so far - need to test fully and send to Makman for indepth Testing - but its looking good.

Bearing_10ths dial is working using this fix:

Code:
[Dial11]
Name=Sol_Bearing
Type=24; DIAL_SOL_BEARING
Cmd=Set_TDC_bearing
Dial=0x3B0D00FF
CrtVal=0x3B0D0001
NewVal=0x0
DialVal=0,360
RealVal=0,360; degrees
Circular=Yes
CmdOnDrag=Yes
SndStep=5
SndList=1,Menu.TDC.Bearing,360


[Dial12]
Name=Sol_Bearing10ths
Type=24; DIAL_SOL_BEARING
Dial=0x0
CrtVal=0x3B0D0077
NewVal=0x0
DialVal=0,12960; Simulates the 1units
RealVal=0,360; degrees
Circular=Yes


Screenshot showing it in action using the same values in Makman pic above to show the Impact angle is displaying correctly.

AOB Gyro Bearing Impact Angle
106 -20 -14 100




As this will require editing the SH3 code, I'll have to do like H.Sie and Stiebler and release it as a Patcher - Once I figure out how to do that.

But this will allow a fully working Impact Angle without Interfering with any of the other dials or solution calculations used by Sh3's code.

Last edited by reaper7; 08-28-11 at 05:10 PM.
reaper7 is offline   Reply With Quote
Old 08-29-11, 07:46 AM   #29
makman94
Hellas
 
Join Date: Jul 2008
Posts: 2,325
Downloads: 182
Uploads: 7


Default

PERFECT JOHN !!!!!
Brilliant and very clever solution !! this will work for sure !

Impact angle dial will become true for sh3 () and as for the patch i believe that H.Sie will be able to take care of it and also to make it compatible with his great tweaked sh3.exe !

fantastic work and thought

bravo John !
__________________
Knowledge is the only thing that nobody can ever take from you...



Mediafire page:http://www.mediafire.com/folder/da50.../Makman94_Mods
makman94 is offline   Reply With Quote
Old 08-30-11, 05:03 PM   #30
reaper7
sim2reality
 
Join Date: Jun 2007
Location: AM 82
Posts: 2,280
Downloads: 258
Uploads: 30
Default

Hi Makman, I've mailed you a bugfix - Impact Angle now works 100% (same as Sh4's)
Required a little more maths coding on my part to fix
reaper7 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 06:45 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.