Forum Index
SUBSIM Forum Search

The Web's #1 BBS for all submarine and naval simulations!
[ SUBSIM Review ] [ SUBSIM STORE ]
Current Forum | Archives 2002-2003 |

Angle On The Bow (AOB) Tutorial Please? (w/o printout)
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> Silent Hunter III
View previous topic :: View next topic  
Author Message
Liszt_



Joined: 18 Apr 2005
Posts: 2

PostPosted: Mon Apr 18, 2005 7:41 pm    Post subject: Angle On The Bow (AOB) Tutorial Please? (w/o printout) Reply with quote

Could someone please post a print out explaining how to properly calculating AOB w/o having to use that print out modification? Smile

It must be possible.....Heavy Maths is OK Wink

Thanks to Wazoo and his TDC tutorial. My only problem right now is calculating AOB partly cause I refuse to print out that little tool and put it together...

Much appreciated if anyone can post how they go about calculating AOB w/ the tools in-game.

Thanks!
Back to top
View user's profile Send private message
Squidget



Joined: 14 Sep 2002
Posts: 120

PostPosted: Wed Apr 20, 2005 5:24 am    Post subject: Reply with quote

IIRC, you can do it like this:

1) Subtract target course from your course.

2) If the result is 180 or 0, AoB is 0 or 180, respectively. Stop.

3) If the total is greater than 180, write down PORT. If less, write down STARBOARD.

4a) If starboard, AoB is 180 - (result of step #1) - relative bearing. Stop.

4b) If port, some extra steps are required:

5) Subtract your course from target course, you'll get a negative number.

6) Add 360.

7) AoB is 180 - (result of step #6) - relative bearing. Stop.

The complications come from going around the 360 compass, where values such as 40 degrees must sometimes be converted to 400 (40+360) degrees to make the math work.

Alternately, to visualize this, draw a picture like this:

Draw your ship, draw target. Draw both ship courses so they intersect, then draw a line directly between the ships.

You'll end up with a triangle. Geometry states that the interior angles of ANY triangle must add up to 180 degrees.

You already know one angle, the one where your ship is: relative bearing to target. You want the angle next to the target, that's AoB. To get it, you need to calculate the remaining angle (I'll call it the mystery angle).

Step 1 gets the mystery angle for starboard AoB, steps 5-6 get it for port AoB.

Once you've got that, steps 4a and 7 are the same:

AoB = 180 (sum of interior angles of triangle) - relative bearing and mystery angle (2 of the angles of the triangle)

It's a LOT more complicated to explain than it is to understand. Sketch it out on a notepad and it will make sense.
Back to top
View user's profile Send private message
microdiver



Joined: 18 Mar 2005
Posts: 276

PostPosted: Wed Apr 20, 2005 10:17 am    Post subject: Reply with quote

If you're using 1.2 and can see contacts on the map, it's easy.
Draw a course line out in front of the target ship. (you should have already done that to set up an intercept)

Select the protractor tool.
First click on your sub.
Then click on the target.
Then click on the target's course line.

The angle displayed by the protractor is the Angle On Bow.

If you're using totally manual targeting and not asking the watch officer, You can get his speed using the 3 minute rule. (a ship goes 100m for every knot of it's speed in 3 minutes)

If the god's eye map is off and ships near you don't show up on the map, you're going to have trouble working out distances and speed.
Sad
Back to top
View user's profile Send private message
bizpro



Joined: 12 Apr 2005
Posts: 34
Location: Langley, BC, Canada

PostPosted: Wed Apr 20, 2005 10:35 am    Post subject: Reply with quote

Sorry, but that is incorrect. A nautical mile has 1,852 m, not 2,000 so in 3 minutes it will go 92.6m. If you are targettingf vessels at a long distance it does mak a difference.
My preferred approach is to calculate when the target is directly in front of me and shot the torpedo at 0 angle at the right time.

Determine vessel's course and speed.
Put yourself at a perpendicular course.
Calculate how long the torpedo will take @ 30 knots to arrive at that point
Determine how far away from point of interception the target will be when you have to fire the torpedo.
Measure the angle at which the target will be off your bow when you have to fire.
Back to top
View user's profile Send private message
Lukio



Joined: 20 Apr 2005
Posts: 20

PostPosted: Wed Apr 20, 2005 11:46 am    Post subject: Reply with quote

I'll post an exe tomorrow ,prolly, that will enable you to ditch the calculator and the tdc and all mods plus everything else (a glorified calculator if you like)and allow you to set gyros manually for a 90deg abeam hit from 4-5 k away..
I'll post the source too with descriptive var names so you can hopefully work out whats going on.
As far as aob go's you will just have to compare your view with your perilock on 100% afaik.

Everyone should play on 100% but they need a custom calc imo else it just becomes tedious trig.
Back to top
View user's profile Send private message
Lukio



Joined: 20 Apr 2005
Posts: 20

PostPosted: Wed Apr 20, 2005 11:59 am    Post subject: Reply with quote

Ok you just to take one reading with this for a 90 degree to beam hit on the hydrophone or the periscope (junk the tdc and use trig). Argh
Code:
//Quickie by Lukio...don't touch, suggest please.
#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>



using namespace std;


bool IsNumeric(char *str)
{
   char c;
   bool bNumeric = true;

   while(c = *str++)
   {
      if(c < '0' || c > '9')
      {
         bNumeric = false;
         break;
      }
   }
   return bNumeric;
}

int getBear(void)
{
   bool bValid = false;
   char strAngle[10];
   int iResult = 0;

   while(!bValid)
   {
      cout << "Valid bearing between 0 and 359 (0 to

179 for aob) -> ";
      cin >> strAngle;
                clrscr();
   
      if(IsNumeric(strAngle))
      {
         iResult = atoi(strAngle);
         bValid = ((iResult >= 0) && (iResult <

360));
      }
   }
   return iResult;
}
int getNumber(void)
{
   bool bValid = false;
   char strAngle[10];
   int iResult = 0;

   while(!bValid)
   {
      cout << "value greater than 0 -> ";
      cin >> strAngle;
                clrscr();
   

      if(IsNumeric(strAngle))
      {
         iResult = atoi(strAngle);
         bValid = ((iResult > -1) && (iResult <=

50000));
      }
   }
   return iResult;
}
float SternBear(float stern)
{
stern = stern + 180;

if (stern > 359)
{
stern = stern - 360;
}

if (stern < 0)
{
stern = stern + 360;
}

return stern;
}


int main()
{

 using std::cout;
    using std::endl;

Restart:

float DesiredHeading;
char choic = '0';
char PortOrStar = 0;
char BowOrSter = 0;
float PassingDist;
float NewLock;
float TestNeg;
float Turn;
float ClosestDist;
float pi = 3.1415927;
int Gyro;
int GetShipHeading = 0;
int Aob = -1;

float MetricShipSpeed;
float MetricBombSpeed;
float TorpedoTravTime;
float DistanceShipCanTravel;
float AngleAtWhichIHaveToFire;
float AngleAtWhichIHaveToFireDeg;
float ShipSpeed;
float BombSpeed;   
   

    cout << "\n\nFor compass enter a ";
    int SubHeading = getBear();

       
while (Aob < 0 || Aob > 179)
{
    cout << "For aob enter a " ;
     Aob = getBear();
}
    if (Aob > 90)
   {
    while (choic != '1' && choic != '2')
                {
         cout << "No 90 Abeam shot possible from here." << endl
         << "You must overtake the target. "   << endl <<

endl
              << "If you require a compass bearing to do this on

a parallel course," << endl
              <<  "and then a compass bearing to come to once

well ahead of target  press (1), " << endl << endl
         << "or if you just wish to re-input target data

from a better position, press (2)."<< endl;
    cin  >> choic;
      clrscr();
                }
        }
 if (choic == '2')
         
      {
       goto Restart;
      }

         
             
       
    while (PortOrStar != 'p' && PortOrStar != 'P' && PortOrStar

!= 's' && PortOrStar != 'S')
   {
    cout << "Are you port or starboard of target p/s -> ";
    cin  >> PortOrStar;
   }


    cout << "For range enter a ";
    int Range = getNumber();

    cout << "For periscope lock enter a " ;
    int PeriLock = getBear();
  //Course and correction from behind target for 90 degree impact
    if (choic == '1')
      

       {while (BowOrSter != 'b' && BowOrSter != 'B' &&

BowOrSter != 's' && BowOrSter != 'S')
   {
    cout << "Do you want a bow or stern solution at the end

of this overtake course b/s -> ";
    cin  >> BowOrSter;
   }   
   

                 
                     
if (PortOrStar == 's' || PortOrStar == 'S')
{
NewLock = 270 + Aob;
}

if (PortOrStar == 'p' || PortOrStar == 'P')
{
NewLock = 90 - Aob;
}

ClosestDist = sin(Aob * pi / 180) * Range;

Turn = PeriLock - NewLock;

DesiredHeading = SubHeading + Turn;
if (DesiredHeading < 0)
{
DesiredHeading = DesiredHeading + 360;
}
else
if (DesiredHeading > 360)
{
DesiredHeading = DesiredHeading - 360;
}
 
                  if (PortOrStar == 'p' || PortOrStar == 'P')
                    {GetShipHeading = DesiredHeading - 90;}
                  if (PortOrStar == 's' || PortOrStar == 'S')
                    {GetShipHeading = DesiredHeading + 90;}


                    if (GetShipHeading < 0)
           {
            GetShipHeading = GetShipHeading + 360;
           }
            else
           if (GetShipHeading > 360)
           {
            GetShipHeading = GetShipHeading - 360;
           }


                   
                     if ((BowOrSter == 'b' || BowOrSter == 'B')

&& (PortOrStar == 'p' || PortOrStar == 'P')) 
                                       
                      {
                       DesiredHeading = GetShipHeading + 90;
                      }

                     
                      if ((BowOrSter == 'b' || BowOrSter == 'B')

&& (PortOrStar == 's' || PortOrStar == 'S'))
                      {DesiredHeading = GetShipHeading - 90;
                      }



                     
                      if ((BowOrSter == 's' || BowOrSter == 'S')

&& (PortOrStar == 'p' || PortOrStar == 'P'))
                                       
                      {
                       DesiredHeading = GetShipHeading - 90;
                      }

                     
                     if ((BowOrSter == 's' || BowOrSter == 'S')

&& (PortOrStar == 's' || PortOrStar == 'S'))
                      { DesiredHeading = GetShipHeading + 90;
                      }

                    if (DesiredHeading > 359)
                     {
                      DesiredHeading = DesiredHeading - 360;
                     }
                    if (DesiredHeading < 0)
                     {
                      DesiredHeading = DesiredHeading + 360;
                     }
                     
                   
                cout << "Parallel overtake course: " <<

GetShipHeading << endl
                     << "When well ahead of target turn to " <<

DesiredHeading << endl
                     << " and come to Zero knots" << endl;
                cout << "Then re input target data." << endl
                     << "Passing target at closest distance of: "

<<  ClosestDist;
                goto Restart;


                         
                         
                 } 


       
//Course and angular targeting from in front of target
if (PortOrStar == 's' || PortOrStar == 'S')
{
NewLock = 270 + Aob;
}

if (PortOrStar == 'p' || PortOrStar == 'P')
{
NewLock = 90 - Aob;
}

ClosestDist = sin(Aob * pi / 180) * Range;

Turn = PeriLock - NewLock;

DesiredHeading = SubHeading + Turn;
if (DesiredHeading < 0)
{
DesiredHeading = DesiredHeading + 360;
}
else
if (DesiredHeading > 360)
{
DesiredHeading = DesiredHeading - 360;
}



cout << "COME ROUND TO HEADING: " << DesiredHeading << endl <<

endl;

if (PortOrStar == 'p' || PortOrStar == 'P')

{cout << "New Periscope Lock : " << NewLock << endl << endl;} 

if (PortOrStar == 's' || PortOrStar == 'S')

{cout << "New Periscope Lock : " << 360 - NewLock << endl <<

endl;}


cout << "Closest Distance: "   << ClosestDist      << endl <<

endl;

if (PortOrStar == 'p' || PortOrStar == 'P')

{GetShipHeading = DesiredHeading - 90;
}
if (PortOrStar == 's' || PortOrStar == 'S')
{
GetShipHeading = DesiredHeading + 90;
}
if (GetShipHeading < 0)

{GetShipHeading = GetShipHeading + 360;}

if (GetShipHeading > 360)

{GetShipHeading = GetShipHeading - 360;}


cout << "Shipheading is "<< GetShipHeading << endl << endl;

Gyro = Turn;
if (Gyro < 0)

{Gyro = Gyro + 360;}

if (Gyro > 360)

{Gyro = Gyro - 360;}

if (Gyro < 90 || Gyro > 270)
{cout << "Enter target ship speed(in knots > 0) -> ";
      ShipSpeed = getNumber();

                  cout << "Enter torpedo speed(in knots > 0) -> 

";
      BombSpeed = getNumber();

                 

                 
                  MetricShipSpeed = ShipSpeed * 0.515;
                  MetricBombSpeed = BombSpeed * 0.515;
                  TorpedoTravTime = ClosestDist /

MetricBombSpeed;
                  DistanceShipCanTravel = MetricShipSpeed *

TorpedoTravTime;
                  AngleAtWhichIHaveToFire = atan

(DistanceShipCanTravel / ClosestDist);
                  AngleAtWhichIHaveToFireDeg =

AngleAtWhichIHaveToFire * (180 / pi);


                  if (PortOrStar == 's' || PortOrStar == 'S')
                  {AngleAtWhichIHaveToFireDeg = Turn -

AngleAtWhichIHaveToFireDeg;}
                  if (PortOrStar == 'p' || PortOrStar == 'P')
                  {AngleAtWhichIHaveToFireDeg = Turn +

AngleAtWhichIHaveToFireDeg;}


                  if (AngleAtWhichIHaveToFireDeg < 0)
{
AngleAtWhichIHaveToFireDeg = AngleAtWhichIHaveToFireDeg + 360;
}
else
if (AngleAtWhichIHaveToFireDeg > 360)
{
AngleAtWhichIHaveToFireDeg = AngleAtWhichIHaveToFireDeg - 360;
}
                 

 cout << "If you wish to take this shot without moving from here

use bow tubes, " << endl << endl
      << "set gyros to: " << Gyro << endl << endl
      << "Fire when target reads on Hydro/Peri " <<

AngleAtWhichIHaveToFireDeg << endl << endl ;}

if (Gyro > 90 && Gyro < 270)
{cout << "No bow tube gyro shot,angle is too high, move or plot

stern tube solution" << endl <<endl;}

//boworstern

cout << "If you want a stern solution press (s) else any other

key for input new data from new position -> ";
    cin  >> BowOrSter;

if (BowOrSter != 's' && BowOrSter != 'S')

{goto Restart;}




 if (BowOrSter == 's' || BowOrSter == 'S')
   {cout << "COME ROUND TO HEADING: " << SternBear

(DesiredHeading) << endl << endl;

         cout << "New periscope lock: " << SternBear(NewLock) <<

endl << endl;

    cout << "Closest Distance: " << ClosestDist << endl <<

endl;

         cout << "Shipheading is " << GetShipHeading << endl <<

endl;

       


if (Gyro > 90 && Gyro < 270)
 {cout << "Enter target ship speed(in knots > 0) -> ";
      ShipSpeed = getNumber();

                  cout << "Enter torpedo speed(in knots > 0) -> 

";
      BombSpeed = getNumber();

                 

                 
                  MetricShipSpeed = ShipSpeed * 0.515;
                  MetricBombSpeed = BombSpeed * 0.515;
                  TorpedoTravTime = ClosestDist /

MetricBombSpeed;
                  DistanceShipCanTravel = MetricShipSpeed *

TorpedoTravTime;
                  AngleAtWhichIHaveToFire = atan

(DistanceShipCanTravel / ClosestDist);
                  AngleAtWhichIHaveToFireDeg =

AngleAtWhichIHaveToFire * (180 / pi);


                  if (PortOrStar == 's' || PortOrStar == 'S')
                  {AngleAtWhichIHaveToFireDeg = Turn -

AngleAtWhichIHaveToFireDeg;}
                  if (PortOrStar == 'p' || PortOrStar == 'P')
                  {AngleAtWhichIHaveToFireDeg = Turn +

AngleAtWhichIHaveToFireDeg;}


                  if (AngleAtWhichIHaveToFireDeg < 0)
{
AngleAtWhichIHaveToFireDeg = AngleAtWhichIHaveToFireDeg + 360;
}
else
if (AngleAtWhichIHaveToFireDeg > 360)
{
AngleAtWhichIHaveToFireDeg = AngleAtWhichIHaveToFireDeg - 360;
}
                 

 cout << "If you wish to take this shot without moving from here

use stern tubes, " << endl << endl
      << "set gyros to: " << SternBear(Gyro) << endl << endl
      << "Fire when target reads on Hydro/Peri " <<

AngleAtWhichIHaveToFireDeg << endl << endl ;}
 
if (Gyro < 90 || Gyro > 270)
     {cout << "No stern tube gyro shot, Angle is too high, move

or plot bow tube solution" << endl <<endl;
     }
     }


                 
                 

cout << "aob = " << Aob << endl
     << "port/star = " << PortOrStar << endl
     << "Your Sub is Heading = " <<  SubHeading << "." << endl;
cout << "Target ships heading is " << GetShipHeading << "." <<

endl   
     << "range = " << Range << "." << endl;                       

         
cout << "BowOrSter = " << BowOrSter << "." << endl
     << "PeriLock = " << PeriLock << "." << endl
     << "Your closest range will be " << ClosestDist << "." <<

endl;
cout << "ShipSpeed = " << ShipSpeed << "." << endl
     << "BombSpeed = " << BombSpeed << "." << endl
     << "Metricshipspeed = " << MetricShipSpeed << endl;
cout << "metricbombspeed = " << MetricBombSpeed << endl
     << "torpedo travel time to impact at 90 degrees = " <<

TorpedoTravTime << endl
     << "Distance ship can travel in this time = " <<

DistanceShipCanTravel << endl;
cout << "When you should fire angle in rads = " <<

AngleAtWhichIHaveToFire << endl   
     << "When you should fire angle in degs = " <<

AngleAtWhichIHaveToFireDeg << endl
     << "Gyro angle " << Gyro << endl
     << "turn = " << Turn << endl;
cout << "desired head = " << DesiredHeading
     << endl << endl;


getch();
goto Restart;
}


If something is wrong there, then please say what it is, besides crap coding Wink it works fine i think.
Feedback please and ill put pretty colours in and upload a trig calculator exe that should be a useful for any subsim.
If u haven't got a compiler i suppose i can upload an exe of this for feedback too.
Really im a c++ newb and would like suggestions on how to improve the code as i'm fairly sure the maths is right.

Cheers all..
Lukio. Joking

/edit.....
all the couts at the end are just there for internal var checking, so it can be seen where it all went wrong hehe.
Back to top
View user's profile Send private message
Squidget



Joined: 14 Sep 2002
Posts: 120

PostPosted: Wed Apr 20, 2005 2:34 pm    Post subject: Reply with quote

bizpro wrote:
Sorry, but that is incorrect. A nautical mile has 1,852 m, not 2,000 so in 3 minutes it will go 92.6m. If you are targettingf vessels at a long distance it does mak a difference.


That's true, but let's put that in context.

Say you are firing a 45kt torp at a ship moving 7kts, impact range is 1500m.

At 45kts, the torp takes 64.85 secs to cover that distance.

At a REAL 7.0kts, the ship travels 233m in that time, and this is the point at which your TDC will be aiming.

If you were using the 3 min approximation, you'd have recorded the ship's speed as 6.47kts. Your TDC will be aiming at a point 216m in front of the target.

So, the 3 min. estimation means you will be firing 17m behind the perfect spot, if I've done the math properly.

IIRC, a C2 tanker is roughly 140m long, so if you aim at the center you have a bit less than 70m of slop space to either side.

So, with a moderately long range shot vs. a high speed target, you should still connect easily, assuming everything else was accurate.

It's all a matter of how much time and precision you need. If you've got to set up a solution quickly (and that implies a moderate-to-short range shot), the 3min. rule works just fine.

If you ARE in the habit of firing at 1500m+, or using T2 torps (bleah), or otherwise have torpedo travel times of over 90secs, then you'd be well served by grabbing a calculator and doing it right.

In that case, the 3 min. rule would be: 100m in 3 minutes = 1.08kts.

To give you a rough idea of accuracy, that number will tell you a 7kt ship is making 6.995 kts. Accurate enough for the longest range shot, I'd say.
Back to top
View user's profile Send private message
Squidget



Joined: 14 Sep 2002
Posts: 120

PostPosted: Wed Apr 20, 2005 3:33 pm    Post subject: Reply with quote

uXs wrote:
Now, isn't it possible to modify the rule to something like the "3 minutes and 17 seconds" rule ? That would make taking readings just a tad more involved, but the readings and the calculation would be more correct.


A grand idea! A perfect 3 min rule would be: 3min, 14.552... seconds.

To be more precise: in 3 min, 15 secs, a ship moving 1kt will travel 100.23 meters. Close enough.

So, call it the "3 and a quarter" minute rule.

(Wow, the forum timestamps are sooooo hosed.)
Back to top
View user's profile Send private message
Lukio



Joined: 20 Apr 2005
Posts: 20

PostPosted: Wed Apr 20, 2005 9:10 pm    Post subject: Reply with quote

K above code as an exe to test.
http://www.gaming.eclipse.co.uk/test/HullCracker.exe
Cheers. Neutral\
Back to top
View user's profile Send private message
bizpro



Joined: 12 Apr 2005
Posts: 34
Location: Langley, BC, Canada

PostPosted: Wed Apr 20, 2005 9:37 pm    Post subject: Reply with quote

Unless you want to use the stopwatch for each plot just stick with it. The rpoblem is that the game mixes nautical miles with meteric distance. Could we please have an option to keep it all nautical. 3 minutes 1 kt = o.5 cables (10 cables = 1 NM)

Please excuse, but I have four strikes against me:
Born and raised in Germany
Born under the sign of Virgo
Veteran Mariner
20 years teaching mariners plotting, amongst other things, and running the bridge simulator.

I like things without "Kentucky windage & elevation". You should see my desk when I calculate an attack. Very Happy
Back to top
View user's profile Send private message
uXs



Joined: 30 Mar 2005
Posts: 103

PostPosted: Wed Apr 20, 2005 11:15 pm    Post subject: Reply with quote

The advantage of the 3 minute rule is that it's easy to convert to speed, because you just have to multiply by 10 or 20 or whatever. (I always forget the number... can someone remind me again ? Thanks.)

Now, isn't it possible to modify the rule to something like the "3 minutes and 17 seconds" rule ? That would make taking readings just a tad more involved, but the readings and the calculation would be more correct.
Back to top
View user's profile Send private message
Spin Doctor



Joined: 10 Jan 2002
Posts: 290

PostPosted: Thu Apr 21, 2005 8:53 pm    Post subject: Reply with quote

Why would anyone want to use that game hack? The "tedious trig" is part of the history of the technology. Interesting piece of code, though. Go use it for quake or something....
Back to top
View user's profile Send private message
jasonb885



Joined: 27 Mar 2002
Posts: 1749

PostPosted: Thu Apr 21, 2005 9:12 pm    Post subject: Reply with quote

Spin Doctor wrote:
Why would anyone want to use that game hack? The "tedious trig" is part of the history of the technology. Interesting piece of code, though. Go use it for quake or something....


Wow, calm down. You needn't use his creation then.
Back to top
View user's profile Send private message
OneTinSoldier



Joined: 19 Apr 2005
Posts: 279
Location: Denver, CO USA

PostPosted: Fri Apr 22, 2005 6:49 am    Post subject: Reply with quote

Hello,

I can say I want to use it. And it's always interesting to see the source code for handy little tools/utilities such as this although I'm not a programmer and I don't have a MS Windows Compiler, but I saved the source as HullCracker.c anyway. Thank You Lukio. Thumbs Up

Cheers,

One Tin Soldier
Back to top
View user's profile Send private message
Lukio



Joined: 20 Apr 2005
Posts: 20

PostPosted: Fri Apr 22, 2005 8:08 pm    Post subject: Reply with quote

Well if you find it tedious to use trig then why play the game, tbh its just a calculator.

If you want something simple..do this..
Get 90 degrees to target course (and in front) then do tan^-1 (shipknots/Torpedo knots).
Ie put ship knots in divide by torpedo speed and then inverse tangent it.
This will hit perfectly from any range iv'e tried on a none deviating target.

If you arent 90 deg to target course then u can manually set the gyros to make sure the torpedo is.

2 seconds to do and *perfectly* accurate results.

Course you could just guess i spose, but to call it a game hack is a bit odd.

Is what i suggested above a game hack because i use a calc for inverse tan or should i use paper tables:)
I think most here might appreciate it and adjust the code to their liking tho tbh.
But i find the tan^-1(shipspeed/torp speed) enough for me to shoot a fly on the fly, so to speak and is just as accurate.
The proggy was just for those who want 4k shots not to miss but don't know yet how.
/Edit
What that equation gives you is the angle to fire ahead of the target so it impacts at 0 degrees on your bow (when 90 degrees on ,denoted by aob and periscope lock adding up to 90).
The more astute will spot it is just a piece of the original code distilled right down and means whatever the distance or size of the triangle the same ratio of torpedo speed to ship speed will yield the same angular result to shoot at.
Test it yourself with this....


Code:
//Quickie by Lukio...don't touch, suggest please.
#include <iostream.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>



using namespace std;




int main()
{

 using std::cout;
    using std::endl;



float ClosestDist;
float pi = 3.1415927;


float MetricShipSpeed;
float MetricBombSpeed;
float TorpedoTravTime;
float DistanceShipCanTravel;
float AngleAtWhichIHaveToFire;
float AngleAtWhichIHaveToFireDeg;
float ShipSpeed;
float BombSpeed;   
   
Restart:
cout << "Enter target ship speed(in knots > 0) -> ";
      cin >> ShipSpeed;

                  cout << "Enter torpedo speed(in knots > 0) ->  ";
      cin >> BombSpeed;

                 

                 ClosestDist = 1000;
                  MetricShipSpeed = ShipSpeed * 0.515;
                  MetricBombSpeed = BombSpeed * 0.515;
                  TorpedoTravTime = ClosestDist / MetricBombSpeed;
                  DistanceShipCanTravel = MetricShipSpeed * TorpedoTravTime;
                  AngleAtWhichIHaveToFire = atan(DistanceShipCanTravel / ClosestDist);
                  AngleAtWhichIHaveToFireDeg = AngleAtWhichIHaveToFire * (180 / pi);


                 


                 
                 

 
   cout << "Fire when target reads on Hydro/Peri " << AngleAtWhichIHaveToFireDeg << endl << endl ;




goto Restart;
}

Try changing the the size of the right handed triangles (closestdist);
Makes no diff for the same speed ratios, hope it helps some anyhow, and remember theres no error checking on input in that little snippet there.

Quake 3?
Why..... i'm a fkn legend at that:) (and q2) Yep


Last edited by Lukio on Fri Apr 22, 2005 8:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> Silent Hunter III All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group