The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => General UQM Discussion => Topic started by: Angelfish on July 18, 2009, 04:10:37 pm



Title: The Leyland Maneuver, does it actually exist?
Post by: Angelfish on July 18, 2009, 04:10:37 pm
I'm no genius in physics, but when trying to implement gravity wells into my code, the resulting gravity well doesn't actually generate a Gravity Whip effect when I move the ship past it. When approaching the planet the ship accellerates towards the planet. (I increase the x and y velocities by a value based on the angle and distance to the planet, aswell as the mass of the planet itself.)
But when it moves away from the planet it decelerates in the same way so that the effect is neutralized.

So, either my physics coding is wrong, or gravity whips can't actually be performed in real life ;).
If the latter is the case, I'll decrease the gravity effect when the ship moves away from the planet by a certain factor.

Any advice is welcome :)


Title: Re: The Leyland Maneuver, does it actually exist?
Post by: jschmerge on July 18, 2009, 06:34:48 pm
Umm, your math is wrong. What you are mistaking for an increase in velocity should actually be a *change* in acceleration (acceleration is a vector, just like veloscity). I'm not going to get too much into the math here (any good calculus or physics text book will have several sections on modeling newtonian dynamics), but simply put you need two equations:

1.) Force of gravity exerted by the planet. This is proportional to the square of the distance from the planet, or F(d) = C/d^2 (where C is a constant, larger values for larger masses).

2.) An equation for the velocity of the ship. This is expressed as a sum of three terms: current velocity, current acceleration (i.e. caused by the ship's thrust), and acceleration base on gravity. All three of these terms are expressed as separate vectors, and when added together produce the resulting velocity.  So the equation for velocity, as expressed as an absolute function of time would look something like: V(t) = v'  + a * t + F(d) * t , where v' is the current velocity, and F(d) is the vector of acceleration *towards* the planetary mass.

That  equation doesn't work well for rendering graphics though... What you *really* want is an equation that can give you the current position and velocity based on (last position, last known velocity, current acceleration, and time delta). This works extremely well when running through an event loop that renders the graphics. I'll leave it up to you to figure out the math. If you like, I'll supply more information, but I think you need to figure this out for yourself :)


Title: Re: The Leyland Maneuver, does it actually exist?
Post by: SweetSassyMolassy on July 18, 2009, 06:50:38 pm
There's a little more to it then that, I think. In addition, moving inward toward the planet while traveling at a tangential velocity toward it will produce a Coriolis effect, which produces a force tangentially on the ship, thus adds to the slingshot effect.

You know, this might actually be easier with an energy equation. You have a velocity (or kinetic energy) and a potential GM/R. This article should explain the rest. Assuming that you're in a stationary frame with the planet maybe this will be easier, maybe not.

http://en.wikipedia.org/wiki/Gravitational_slingshot


Title: Re: The Leyland Maneuver, does it actually exist?
Post by: jschmerge on July 18, 2009, 06:59:41 pm
I'm not sure what a whether phenomenon has to do with modeling Newtonian bodies :)

You'll seriously get the gravity whip with just the math I presented.


Title: Re: The Leyland Maneuver, does it actually exist?
Post by: SweetSassyMolassy on July 18, 2009, 07:15:10 pm
It comes up a lot in weather, but it isn't a weather phenomenon. The clouds follow it as a property of rotating bodies. -2*omega X velocity gives a "fictional force" which moves tangential to the rotating body.

I'm sure it can be neglected when writing the code though, I was just being a smart-ass, especially since the planet isn't really rotating.

If the Newtonian kinematics prove hard though, there's always energy equations.


Title: Re: The Leyland Maneuver, does it actually exist?
Post by: Angelfish on July 18, 2009, 07:31:13 pm
Umm, your math is wrong. What you are mistaking for an increase in velocity should actually be a *change* in acceleration (acceleration is a vector, just like veloscity). I'm not going to get too much into the math here (any good calculus or physics text book will have several sections on modeling newtonian dynamics), but simply put you need two equations:

1.) Force of gravity exerted by the planet. This is proportional to the square of the distance from the planet, or F(d) = C/d^2 (where C is a constant, larger values for larger masses).

2.) An equation for the velocity of the ship. This is expressed as a sum of three terms: current velocity, current acceleration (i.e. caused by the ship's thrust), and acceleration base on gravity. All three of these terms are expressed as separate vectors, and when added together produce the resulting velocity.  So the equation for velocity, as expressed as an absolute function of time would look something like: V(t) = v'  + a * t + F(d) * t , where v' is the current velocity, and F(d) is the vector of acceleration *towards* the planetary mass.

That  equation doesn't work well for rendering graphics though... What you *really* want is an equation that can give you the current position and velocity based on (last position, last known velocity, current acceleration, and time delta). This works extremely well when running through an event loop that renders the graphics. I'll leave it up to you to figure out the math. If you like, I'll supply more information, but I think you need to figure this out for yourself :)

Actually, I think you misunderstood the way I did things. I do have gravity and acceleration vectors which result in the current velocity vector :).
When using not the distance, but the square of the distance in the force of gravity calculation, my gravity well is working perfectly. Although I have to say that it's more difficult to use it than it is in SC2 (it takes more precisio).


Title: Re: The Leyland Maneuver, does it actually exist?
Post by: Mormont on July 18, 2009, 09:46:51 pm
Yes something similar does exist, and NASA uses it sometimes (such as the Voyager missions). The SC2 version is a huge simplification of course.


Title: Re: The Leyland Maneuver, does it actually exist?
Post by: Novus on July 18, 2009, 09:55:26 pm
The physics of Star Control are a bit strange. While it's possible in real life to nab large amounts of momentum off a planet (http://en.wikipedia.org/wiki/Gravity_assist) (by the standards of a spaceship), this doesn't work in Star Control because the planet is fixed. Instead, the planet essentially removes the maximum speed limit (http://forum.uqm.stack.nl/index.php?topic=3603.0), changing how a ship's acceleration works (http://forum.uqm.stack.nl/index.php?topic=3628.0).

Hence, the Leyland manoeuvre is a way to get around one unrealistic aspect of Star Control physics (the speed limit) by introducing yet another strange rule.


Title: Re: The Leyland Maneuver, does it actually exist?
Post by: Angelfish on July 19, 2009, 02:43:48 am
Thanks for all the help, guys :). I'm still trying to figure out how to make my gravity wells behave the same way as in SC2 though, but I think that's just a matter of tweaking etc ;).


Title: Re: The Leyland Maneuver, does it actually exist?
Post by: Lukipela on July 19, 2009, 06:28:44 pm
What is it your actually doing? Another melee engine, working on old Timewarp stuff, or what?