Jump to content

N-Body Physics in KSP


Sovnheim

Recommended Posts

Hi all,

I seen some threads discussing the implementation of n-body physics (rather the conics-thingy what the system currently uses) to KSP.

Out of curiosity, I have read part of the official thread for the N-Body Gravitation Mod for KSP, but I have a problem - it often looks like this :

The predictions are currently using the same integration method (McLachlan and Atela's 1992 optimal 5th order method), with the same splitting of the Hamiltonian (kinetic + potential energy), this is somewhat usable but unacceptably slow. I am currently implementing as many symplectic integrators as I can find in order to compare them, and I will also be comparing various splittings (as as nonsymplectic methods in use for computing ephemerides).

I have a degree in literature, not theoretical physics.

I would be curious to understand the actual benefits in terms of gameplay would such implementation have ?

Link to comment
Share on other sites

N-body physics would be bad for gaming enjoyment possibly because all of your vessels would be subject to orbital perturbation (http://en.wikipedia.org/wiki/Perturbation_%28astronomy%29). In short, you could timewarp ahead in what you thought was a stable orbit, only to find you've been ejected from the system, or crashed into something else, etc.

Not to mention Vall becomes a planet in short order:

Link to comment
Share on other sites

The benefits: orbits would be more like those in reality rather than the mathematically perfect ones we have in KSP. You could park things at L4/L5, or at L1/L2/L3 if you want to babysit them. Note however, that you can already fake L4 and L5 if you're precise enough. L1-L3 would mostly just get used to simulate real life missions where you want a satellite in earth's shadow (telescopes, usually) or never in earth's shadow (solar observatories, I think). Those Lagrange points aren't actually stable, so some station keeping would be required.

We would get some other interesting things that most players wouldn't notice, like a planet and moon would rotate around their barycenter rather than the center of the planet.

The cost would be a major overhaul of the map mode and maneuver node system, in addition to the work necessary to convert the game over to n-body. Orbits wouldn't be mathematically precise, so you couldn't draw an ellipse to represent the orbit you're currently in on the map, since that orbit wouldn't be a perfect ellipse and even if it were, would shift over time, something the current map just can't represent.

Basically, a lot of work, mostly for things that your average player wouldn't notice.

Which isn't to say that I'm opposed to it, just that I think there are other things with a better cost/reward ratio.

Link to comment
Share on other sites

I would love when the time comes when a regular CPU can calculate N-body physics to a degree resembling them as we understand them in real life, but it is just not today.

Of course, about the same time will come the AI capable of handling every vessel you have on mission to keep it in orbit. But, even with that, you will need to keep an eye on them to make sure they have the delta-V to allow for station-keeping. The ISS doesn't maintain its orbit with just the happy thoughts of the world, after all.

Link to comment
Share on other sites

Oh, and one more thing. There's no arguing that n-body physics would simulate reality better. However, patched conics approximations are good enough for quite a few things even in reality. In fact, the Apollo program was planned out using patched conics. Basically, unless you're spending much time away from the gravity wells, patched conics works fine.

Link to comment
Share on other sites

What your quote says is basically: we are making it very precise, but at the same time there's so many calculations that your pc might just spontaneously burst in flames. He wants to make it faster without sacrificing accuracy, but hasn't finished applying it.

Also floating point errors already suck in-game, going n-body would make it even more noticeable.

Link to comment
Share on other sites

I would love when the time comes when a regular CPU can calculate N-body physics to a degree resembling them as we understand them in real life, but it is just not today.

Of course, about the same time will come the AI capable of handling every vessel you have on mission to keep it in orbit. But, even with that, you will need to keep an eye on them to make sure they have the delta-V to allow for station-keeping. The ISS doesn't maintain its orbit with just the happy thoughts of the world, after all.

*Spewing nonsense that is somewhat true*

Well... CPUs are absolutely horrible when it comes to doing anything math related. 64-bit is a pointless "upgrade" as we do have the technology to go much higher... much much higher... and get crazy benefits from SSE code.

Of course, the CPU's main purpose is running small programs and keeping quiet. Number crunching? Nahh... just enough to keep the system running. Now it is the GPU that does that, and does it well...

radeon_city.jpg

http://arstechnica.com/security/2012/12/25-gpu-cluster-cracks-every-standard-windows-password-in-6-hours/

You can use a modern CPU, just streamline 25 GPU's and you can then calculate real time N-Body Physics (maybe) ;p

Link to comment
Share on other sites

*Spewing nonsense that is somewhat true*

Well... CPUs are absolutely horrible when it comes to doing anything math related. 64-bit is a pointless "upgrade" as we do have the technology to go much higher... much much higher... and get crazy benefits from SSE code.

Of course, the CPU's main purpose is running small programs and keeping quiet. Number crunching? Nahh... just enough to keep the system running. Now it is the GPU that does that, and does it well...

http://cdn.arstechnica.net/wp-content/uploads/2012/12/radeon_city.jpg

http://arstechnica.com/security/2012/12/25-gpu-cluster-cracks-every-standard-windows-password-in-6-hours/

You can use a modern CPU, just streamline 25 GPU's and you can then calculate real time N-Body Physics (maybe) ;p

Why does everyone think nbody is so intensive?!?!

Link to comment
Share on other sites

Why does everyone think nbody is so intensive?!?!

Because it is. Unless you do it improperly in which case you may as well do patched conics.

The total number of interactions is X*(X-1). In the Kerbolar system there are 17 bodies, so just to figure out how gravity affects the PLANETS (before you've even launched a single ship) it'd take 272 calculations. Right now, with the planets on rails using patched conics, the total number of calculations is 17.

But really for a modern computer that's not the problem. The problem is it'd be no fun and the planets would eventually pull each other out of their orbits.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...