Programming Question

 Posts: 139
 Joined: Tue Oct 11, 2005 1:37 pm
 Location: NY
 Contact:
in case you couldn't find this from the program, i have found that in a perfectly circular arc the distance traveled will be r * 2θ * sin(90  θ) / sin(2θ) or 2θ * (r/2) / cos(90  θ) where r is the distance between mouse and ship and θ is in radians. these values are radius of curvature times angle in radians. you will just have to cap this value or something so they cannot accelerate more than the ship is capable of.
reverse as in flying backwards? that's negative velocity, but basically the same calculations but done on the other side of the ship. this is when the θ i'm talking about is greater than 90, and the ship's acceleration is great enough to bring its current velocity below zero. otherwise, i'm not quite sure what you mean.
reverse as in flying backwards? that's negative velocity, but basically the same calculations but done on the other side of the ship. this is when the θ i'm talking about is greater than 90, and the ship's acceleration is great enough to bring its current velocity below zero. otherwise, i'm not quite sure what you mean.
(\ /)
(O.o)
(> <)
(O.o)
(> <)
Sorry, but I'm really confused now.
You're saying I don't even need to know P1 or worry about B?ziers any more?
Distance Travelled = 2θ * (r/2) / cos(90  (θ * 57.2958))
* r = distance from ship to mouse
* θ = what is this angle?
I multiplied by 57 because I need everything in degrees (my software doesn't do radians, and nor do I really).
So to get Speed, I just divide that by the number of frames per turn.
What about turning though? I still need to know how many degrees to rotate per frame.
You're saying I don't even need to know P1 or worry about B?ziers any more?
Distance Travelled = 2θ * (r/2) / cos(90  (θ * 57.2958))
* r = distance from ship to mouse
* θ = what is this angle?
I multiplied by 57 because I need everything in degrees (my software doesn't do radians, and nor do I really).
So to get Speed, I just divide that by the number of frames per turn.
What about turning though? I still need to know how many degrees to rotate per frame.

 Posts: 139
 Joined: Tue Oct 11, 2005 1:37 pm
 Location: NY
 Contact:
well, don't you need B?ziers for the arc approximations? the distance i gave is the exact total distance the ship would travel in a circular arc, and the total rotation is 2θ. θ is the angle between the line the ship travels in if there is no turn and the line between mouse and ship. for example, if your ship is moving upwards and your mouse is directly to the right. θ=90 degrees, and this corresponds with a 180 degree turn, which makes sense, as you will travel in a half circle.
i am by no means experienced in programming games and have almost no knowledge on graphical stuff, but i can tell you that you can divide this 2θ by the number of frames to get the amount the ship will rotate each frame.
i am by no means experienced in programming games and have almost no knowledge on graphical stuff, but i can tell you that you can divide this 2θ by the number of frames to get the amount the ship will rotate each frame.
(\ /)
(O.o)
(> <)
(O.o)
(> <)
Something's definitely not right  it's coming up with a curve length much, much too high at the moment  even without multiplying the angles by 57.
Now you've pointed out that there's no acceleration, and that the arc is infact just part of a circle, I think I should be able to figure it out though.
I have something that works for one quadrant now (forwards, while turning left). It looks like the other 3 quadrants will need to be catered for separately, which is a bit annoying, but hopefully not too problematic  just need to change a few signs around, I expect.
Thanks again for the help.
And yes, it probably should have been in the programming section, but noone reads that section, and who really cares anyway
Incase anyone's curious, I'm intending to make a multiplayeronly game, somewhat similar to Critical Mass. Actually, it'll probably be more like FlightCommander2 or OverTheReich in most respects, but using CriticalMass's more intuitive movement system.
Now you've pointed out that there's no acceleration, and that the arc is infact just part of a circle, I think I should be able to figure it out though.
I have something that works for one quadrant now (forwards, while turning left). It looks like the other 3 quadrants will need to be catered for separately, which is a bit annoying, but hopefully not too problematic  just need to change a few signs around, I expect.
Thanks again for the help.
And yes, it probably should have been in the programming section, but noone reads that section, and who really cares anyway
Incase anyone's curious, I'm intending to make a multiplayeronly game, somewhat similar to Critical Mass. Actually, it'll probably be more like FlightCommander2 or OverTheReich in most respects, but using CriticalMass's more intuitive movement system.

 Posts: 139
 Joined: Tue Oct 11, 2005 1:37 pm
 Location: NY
 Contact:
The system I've got now is almost working  it's perfect when you want to move forward, but I haven't got reverse working yet (sure I will though).
You pointing out that the acceleration is instant, and that the curve is constant radius, was a *huge* help
Basically, it's like this:
* Find difference in angle between original heading and angle to mouse.
* Take this away from 90 (the centre of the circle is at a 90 degree angle from the original heading). This gives one of the interior angles of triangle: StartPoint>Mouse>CenterOfCircle
* One of the other interior angles is the same as this, and since all angles of a triangle must add up to 180 degrees, we can find the other. This gives the total rotation during the turn.
* Use triangulation to find the shortest side of a right angle triangle (our previous triangle split in two).
* One of the other sides is known as half the distance from start point to mouse, so use pythagoras' theorum to find longest side, which = radius of circle.
* Calculate circumference of circle from radius. Divide this by 360, and multiply by the total angle rotated = length of arc travelled.
Is that the way you did it too?
Thanks again for your help
You pointing out that the acceleration is instant, and that the curve is constant radius, was a *huge* help
Basically, it's like this:
* Find difference in angle between original heading and angle to mouse.
* Take this away from 90 (the centre of the circle is at a 90 degree angle from the original heading). This gives one of the interior angles of triangle: StartPoint>Mouse>CenterOfCircle
* One of the other interior angles is the same as this, and since all angles of a triangle must add up to 180 degrees, we can find the other. This gives the total rotation during the turn.
* Use triangulation to find the shortest side of a right angle triangle (our previous triangle split in two).
* One of the other sides is known as half the distance from start point to mouse, so use pythagoras' theorum to find longest side, which = radius of circle.
* Calculate circumference of circle from radius. Divide this by 360, and multiply by the total angle rotated = length of arc travelled.
Is that the way you did it too?
Thanks again for your help

 Posts: 139
 Joined: Tue Oct 11, 2005 1:37 pm
 Location: NY
 Contact:
yeah, that's pretty much what i did, except it's not the pythagorean theorem but basic trigonometry (or alternatively law of sines), and i was half thinking in radians and half in degrees, as if you use radians you don't have to calculate circumference, divide by 360 and multiply by that angle, just angle in radians times radius, but since you're using degrees talking about radians will just make things more complicated for you.
one possible method to making the ship reverse is that whenever the angle the mouse makes with the line of movement of the ship is over 90 degrees and the ship can accelerate its velocity to below 0, treat the ship (i.e. the movement calculations) as if it is facing and moving backwards.
one possible method to making the ship reverse is that whenever the angle the mouse makes with the line of movement of the ship is over 90 degrees and the ship can accelerate its velocity to below 0, treat the ship (i.e. the movement calculations) as if it is facing and moving backwards.
(\ /)
(O.o)
(> <)
(O.o)
(> <)

 Posts: 7
 Joined: Thu Nov 25, 2010 4:56 am
It does need to and it can. Rule of thumb, to hit something you need three times its acceleration. So if the F16 can pull, say, 8 g then the missile wants 25 g.Sketchy wrote:Sorare31:
I'm pretty sure a modern AAM couldn't outturn something like an F16, but it can fly at Mach4+ so it doesn't need to.
Missiles can pull more acceleration when they are moving quickly. So at the edge of their range they become easier to dodge.
The first AAMs didn't lead their targets, just like Critical Mass missiles, that changed in the late 1950s. You may find this interesting:
http://en.wikipedia.org/wiki/AIM9_Side ... troduction
I think you're getting confused...
Pulling higher G is totally different from outturning something.
The actual turning circle of a missile is *much* greater than that of an aircraft.
Here's the maths, done by someone on another forum:
AIM9X maxes at 50 G (which is probably in the boost phase with thrust vectoring). Let's assume that at the critical moment the missile is doing 40 G and 680 m/s (M2 sea level).
Aircraft is doing say, 2 G and 55 m/s (200 km/h).
r = v^2/a so the ratio of Raircraft to Rmissile is (55^2/2)/(680^2/40) or 1512.5/11560 or 13%. So the aircraft is capable of generating a turning circle 13% the radius of the missile. In space the aircraft is much more maneuverable.
Pulling higher G is totally different from outturning something.
The actual turning circle of a missile is *much* greater than that of an aircraft.
Here's the maths, done by someone on another forum:
AIM9X maxes at 50 G (which is probably in the boost phase with thrust vectoring). Let's assume that at the critical moment the missile is doing 40 G and 680 m/s (M2 sea level).
Aircraft is doing say, 2 G and 55 m/s (200 km/h).
r = v^2/a so the ratio of Raircraft to Rmissile is (55^2/2)/(680^2/40) or 1512.5/11560 or 13%. So the aircraft is capable of generating a turning circle 13% the radius of the missile. In space the aircraft is much more maneuverable.

 Posts: 492
 Joined: Wed Jul 27, 2005 11:07 pm
 Location: Hamburg, Germany