Sign in to follow this  
Maxwell Fern

"KSP doesn't do n-body physics because it would crush your computers"

Recommended Posts

Honestly the no-man's-land suggestion is one of the better ones I've heard for this topic as a compromise between orbital stability and n-body physics.

But I agree with the OP, it's perfectly possible to calculate the nbp in KSP, but I'm not convinced that n-body physics would be a meaningful and positive ('fun') change to the game. It adds little depth to the actual gameplay, just something that would be fun to mess around with for an hour or so and then would be forgotten (at the expense of a massive and time-consuming restructuring of the code) except for the occasional anger caused by an unanticipated destabilization of an orbit.

Maybe in the future a mod will make this possible or Squad could do it, but there is so much left to be done since the game is still in ALPHA. I would much rather we get a better aerodynamics model, personally.

Yeah, my arguments are mostly that it wouldn't really be worse, which is not exactly a strong argument for changing to a different system. The only thing it would enable that we don't have now is, I think, the Lagrange points. And I'm sure Squad could come up with an easier way to implement those if they really wanted to do so. It would be fun to try something different like that, but I doubt there's any way to get into the physics engine part of the game through mods.

Share this post


Link to post
Share on other sites

Doesn't anyone realize that the reason we have patched conics is so that we can have orbital projections? At least, that's the officially stated reason

Share this post


Link to post
Share on other sites
Doesn't anyone realize that the reason we have patched conics is so that we can have orbital projections? At least, that's the officially stated reason

Yes, that was one of the motivations for my suggestion above. By restricting the use of n-body physics to regions where gravity and the gradient of the gravitational force are small, it should be possible to use relatively large time-steps when integrating a vessel's trajectory so that the paths in map view can be drawn without too much computational effort. I think the real reason for using patched conics is that they're good enough and they're much easier. Squad is wisely expending their efforts improving other parts of the game that need much more urgent attention.

Share this post


Link to post
Share on other sites

It does sound like having Lagrange points (thank you wiki!) in the game would be very cool.

Share this post


Link to post
Share on other sites
Doesn't anyone realize that the reason we have patched conics is so that we can have orbital projections? At least, that's the officially stated reason

Could you please provide a source for this? There are hundreds of threads on the internet about this topic, and somebody inevitably mentions that Squad said it's so they could have conic orbital predictions and / or time warp. Nobody ever provides a link, though.

Share this post


Link to post
Share on other sites
Could you please provide a source for this? There are hundreds of threads on the internet about this topic, and somebody inevitably mentions that Squad said it's so they could have conic orbital predictions and / or time warp. Nobody ever provides a link, though.

I haven't been able to find the post I remember discussing "why patched conics?" but I have found a couple links:

What patched conics are: http://en.wikipedia.org/wiki/Patched_Conic_Approximation

the Harv article regarding updating patched conics prior to the manuever system being added: http://forum.kerbalspaceprogram.com/entry.php/138-Mid-Updates-Update-Patched-Conics-cursor-finding!

This is a good example where you can see the entire program is based upon functions designed to use patched conics, including our ability to predict where we will be (which was key for manuever nodes). These would have to be rewritten (and who knows how much time involved) in order to update this all to use 2-body math.

Useful link for all of Harv's blogs: http://forum.kerbalspaceprogram.com/blog.php/4-HarvesteR

edit: Do a search for "Patched Conics" in the search bar and you can see all the threads on the subject and search for yourself. I'm reading 3-4 right now but I'm at work.

Edited by air805ronin

Share this post


Link to post
Share on other sites

Having Lagrangian points would not be hard, they could just add imperceptible bodies in all the Lagrangian points so that a ship can remain stationary there as if it had fallen into a planet, they would need odd shape areas of influence though, like the L1/L2 area of influence would be nearly flat in one dimension and the L4/L5 would have a weird shape indeed.

Share this post


Link to post
Share on other sites
Having Lagrangian points would not be hard, they could just add imperceptible bodies in all the Lagrangian points so that a ship can remain stationary there as if it had fallen into a planet, they would need odd shape areas of influence though, like the L1/L2 area of influence would be nearly flat in one dimension and the L4/L5 would have a weird shape indeed.

With patched conics you always have to be under the influence of a sphere of influence, so you'd be circling that imperceptable body in an orbit which would be very against the concept of Lagrange points.

Share this post


Link to post
Share on other sites
With patched conics you always have to be under the influence of a sphere of influence, so you'd be circling that imperceptable body in an orbit which would be very against the concept of Lagrange points.

Not really. Spaceships in language points often move about in Halo orbits about the points, in L4/L5 the Halo orbits are rather odd shaped though. And since these Lagrangian Approximating Bodies would have no surface to collide with a ship could just float stationary at the center of their gravity as if having fallen through a planet to its core, of course the velocity of the fall would need to be neutralized or else the ship would just bob back and forth like a pendulum... fun!

Share this post


Link to post
Share on other sites
Not really. Spaceships in language points often move about in Halo orbits about the points, in L4/L5 the Halo orbits are rather odd shaped though. And since these Lagrangian Approximating Bodies would have no surface to collide with a ship could just float stationary at the center of their gravity as if having fallen through a planet to its core, of course the velocity of the fall would need to be neutralized or else the ship would just bob back and forth like a pendulum... fun!

I personally don't see a point since orbits under patched conics don't decay Lagrange Points lose a bit of thier usefulness.

Share this post


Link to post
Share on other sites

That the next thing that needs to be added: orbital decay and random orbital drift. For something like the Mun in just a few days/weeks low orbits about it should go crazy and crash into it. After a certain altitude above certain bodies random numbers of specified ranges should start being plugged into the ships vector at consistent or inconsistent intervals approximating the effects of mascons and of course around atmosphere planets low orbits that are "out of the atmosphere" should still decay on year times scales. Orbits around the moons of Jool should also have the same effect of high altitude orbits to approximate the effects of the gravity of other moons.

Edited by RuBisCO

Share this post


Link to post
Share on other sites
I personally don't see a point since orbits under patched conics don't decay Lagrange Points lose a bit of thier usefulness.

I would be curious to hear more about their "usefulness." I just thought it sounded neat that there are spots in solar system where stuff winds up 'washing in' and then staying; sort of little interplanetary 'puddles.' The fact that some of these Lagrange areas in our own solar system have high densities of dust and asteroids and stuff seems like it could in the long run be turned into interesting additional content for the game.

Mascons: that is a cool thing that I hadn't actually heard of. Does Earth have those too? I didn't quite understand the reference to Hawaii in that wiki page.

Share this post


Link to post
Share on other sites
I would be curious to hear more about their "usefulness." I just thought it sounded neat that there are spots in solar system where stuff winds up 'washing in' and then staying; sort of little interplanetary 'puddles.' The fact that some of these Lagrange areas in our own solar system have high densities of dust and asteroids and stuff seems like it could in the long run be turned into interesting additional content for the game.

Mascons: that is a cool thing that I hadn't actually heard of. Does Earth have those too? I didn't quite understand the reference to Hawaii in that wiki page.

Although Earths gravity isn't uniform all over, it is large enough to smooth over mascons that would have a profound effect on orbits. The bigger the world, the smaller the mascons to the extent where you couldn't really consider them a mascon at all.

Share this post


Link to post
Share on other sites

Universe Sandbox is actually a pretty good example of why n-body simulation wouldn't work for KSP.

Try building the KSP system in it. At slow speeds, everything is OK. Turn up the time warp a bit, and all the planets lose their moons. Turn it up a bit more and all the planets go flying.

Time acceleration increases errors in simulations. That's why 4x physics warp in KSP makes everything start to behave all crazy-like. Patched conics works fine because your position in an orbit at any given time can be determined by a simple formula - no simulation is necessary. N-body calculations don't have simple formulas like that, everything has to be done as a time-stepped simulation. 100000x speed would almost immediately send all of your orbiting craft flying away due to inaccuracies in the huge time-steps.

Even if it could be accurate at high time warp, it would still be problematic. Most of your orbits would be slightly unstable, especially if you tried to actually use Lagrange points. Real spacecraft need stationkeeping maneuvers to maintain their orbits.

Switching to patched conics during time warp would defeat the whole point. Unless you plan on visiting Lagrange points or navigating the Jool system in real-time, and never warping while you have spacecraft there...

Share this post


Link to post
Share on other sites
That the next thing that needs to be added: orbital decay and random orbital drift.

To what purpose? It wouldn't affect short term missions, only the kind of long term missions that people tend to have running while they're off doing something else. Do you really think having to pop back to Kerbin to correct your communications and habitat satellites several times during a long mission to Eeloo would be adding anything at all fun to the game?

Share this post


Link to post
Share on other sites

Ah but a key point you're all missing here, although I admit this thread is about n-body, not pertubation.

n-body may not be all that feasible due to timewarp and error, but there is another option.

Pertubation is predictable and has plenty of defining equations, and imo has as much fun potential as n-body physics, since you can still make some really cool things happen, like sun sync orbits, gradual orbital decay, orbit eccentricity changes under sunlight influence, that sorta thing. And they're so small changes, you could easily have some kind of option you can leave on in a vessel to maintain orbit while you aren't on it and timewarping. Since the behaviors are predictable, it should be possible to have in the information display how long the life of the mission is expected to be before de-orbit, unless either automaintained or in a situation where it would not decay into a body. It'd also make what altitude you use actually mean something with regards to how long a mission can realistically last, and how hard it'd be to maintain.

Share this post


Link to post
Share on other sites
To what purpose? It wouldn't affect short term missions, only the kind of long term missions that people tend to have running while they're off doing something else. Do you really think having to pop back to Kerbin to correct your communications and habitat satellites several times during a long mission to Eeloo would be adding anything at all fun to the game?

Well Com Sats usually orbit really high so they would not likely suffer such effect, in Low Kerbin Orbit though perturbation would get rid of space debris at a realistic rate. For Long term missions the user should take orbital anomalies into account, such that no one should be able to leave something orbiting just 20 km above the mun for years on end for example, but instead would be forced to use high orbits or even the Lagrangian points. Of course in real life only L4/5 are dynamically stable, but I guess L1,2,3 could be stable in replacement of no station keeping system.

Of course station keeping would be nice especially with the com sat which are tricky as hell to get into perfect Geosyn orbits. Heck thrusting in non-physics time warp would be nice as well: make realistic ion and other low thrust engines. Right now the low thrust ion engines are generally useless because of the tens of minutes to hours needed to speed up (that and physic warps make the craft unstable and difficult to keep the solar panels lock on the sun), real life ion engines of course take weeks to months. That could only be realistically simulated by allowing for ion engines to thrust in non-physics time warp.

Of course the purpose is increased realism and increased difficulty, which is fun for some players. I advocate that when ever starting a new game players should be able to choose options on a menu like needing life support, communication links, n-body orbits (or the facsimiles I disciple) actual terrain scatter (not just holograms you can drive straight through), re-entry heating, etc, etc, so the player can choose their level of difficulty. Right now many players do basically this by installing mods (FAR, Deadly Re-entry, Life support mods, etc) the final game should have some of these installed and optional.

Edited by RuBisCO

Share this post


Link to post
Share on other sites

Of course the purpose is increased realism and increased difficulty, which is fun for some players. I advocate that when ever starting a new game players should be able to choose options on a menu like needing life support, communication links, n-body orbits (or the facsimiles I disciple) actual terrain scatter (not just holograms you can drive straight through), re-entry heating, etc, etc, so the player can choose their level of difficulty. Right now many players do basically this by installing mods (FAR, Deadly Re-entry, Life support mods, etc) the final game should have some of these installed and optional.

I'm cool with difficulty options almost like the survival difficulty you could bolt onto any difficulty level in Fallout: New Vegas. Not a huge issue with that. bring in life support, comm links, reentry heating... (2/3 of which are on the development roadmap).

I do have an issue with "n-body orbits" being a check mark in that it would require two phyics models being coded in. Thats been my whole thing so far, not wanting them to have to revamp all the base code for the physics. Its great for the people who really want a hard core simulation, but doesn't bring much to the crowd that are fine with the patched conics approximations and resulting 100% stable orbits and lack of n-body issues/anomalies.

I personally want a "good enough" simulation that allows for a lot of fun. They have that coded in already. it doesn't break with timewarp. No need to delay the eventual 1.0 release to change to N-body calculations, in my opinion.

Share this post


Link to post
Share on other sites
I do have an issue with "n-body orbits" being a check mark in that it would require two phyics models being coded in.

No it would not, it could be approximated as I describe with little change to the physics engine.

Share this post


Link to post
Share on other sites
No it would not, it could be approximated as I describe with little change to the physics engine.

I have my doubts on how little a change that would be. Both of us not being privvy to the code, neither of us can tell one way or the other how big or small the required changes would be. Or how well they'd work. Or the bugs that would be introduced.

Share this post


Link to post
Share on other sites
I have my doubts on how little a change that would be. Both of us not being privvy to the code, neither of us can tell one way or the other how big or small the required changes would be. Or how well they'd work. Or the bugs that would be introduced.

Considering all the other things they plan to add in, making Lagrangian points and orbital perturbation as I described would be quite minor

Share this post


Link to post
Share on other sites

- sorry wrong thread please delete -

Edited by eurybaric
wrong thread lol

Share this post


Link to post
Share on other sites

KSP doesn't need top do a full N-body simulation. The force any craft we can build exerts on the astronomical objects in the Kerbol system is insignificant. (Gilly, the smallest mass in the Kerbol system, has a mass of 1.2x10^17 kg, the largest craft i have made to date is only 7x10^5 kg) Furthermore one can make the approximation that the planets and moons have ideal Keplerian orbits without making the same assumption for any spacecraft. Once those assumptions are made its fairly easy to do a numerical simulation of the trajectory that allows more than the 1-body system that KSP uses currently, without the (17+x)^2 calculations that a full N-body simulator such as Universe Sandbox would have to do. Each time step would have to find force of each natural object on the space craft, but it would not have to find the force of each natural object on other natural objects, leaving only the vector sum of the 17 bodies in the Kerbol system. However the ability to see where your spacecraft's trajectory would be harder to figure out.

Share this post


Link to post
Share on other sites
However the ability to see where your spacecraft's trajectory would be harder to figure out.

And therein lies the problem. From what I understand about n-body simulations from what (admittedly limited) reading I've done, the only way to accurately predict an object's course is to run the sim in more-or-less real time. The longer the effective period between calculation cycles -- or, in KSP terms, the faster you timewarp -- the more inaccurate it gets.

By contrast, with the system we have now, we only have one body acting at a time on any given vessel, so we can easily and accurately predict where it will be simply using classical Keplerian equations.

Share this post


Link to post
Share on other sites
Because you can't reconcile n-body calculations with on-rails physics. "On rails' means that you are analytically predicting where the spacecraft will go, which you can't do while also accounting for the influence of other bodies.

EDIT: The OP is right though. It's a gameplay choice.

The Op is right, but not about the reasons. i can give you a hypothetical for you, and it actually would work. write an engine in x64 code. performance problem solved. add 32-bit support with on-rail physics and the current system, have it switch during warp, through a secondary release, compatibility problem solved. run a separate process for on-rail calculations, allow both to be used in tandem, other compatibility problem solved. the enitre reason i want N-body is the challenge. KSP is admittedly boring once you have craft in oort-like orbits around the sun, geosync satellite power relay & transmission net, on all capable planets, 3 different moon bases, multiple outposts on laythe, eve, duna, eeloo, etc. i also want realism, its my biggest enemy, is the main thing i notice is the slight inaccuracies. and i wanted to build a massive lagrange point station. besides that, your points about your computer melting the face of the sun just don't add up. i have a pc capable of 350+ craft building & flying, so i would take a performance hit for n-body. i just fail to see the idea behind the highly inaccurate physics, know what i mean?

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this