Sign in to follow this  
Maxwell Fern

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

Recommended Posts

Hi there,

although I don't mind at all how KSP works with bodies and their spheres of influence, it's bugging me to read the exact same answer everytime someone asks about lagrange points or any n-body related problems.

Let's just get it out: n-body physics can be calculated by all modern PCs. Even old ones.

Orbiter does it, Universe Sandbox does it, heck, even this flash animation does it, in smooth 3D. Load the solar system, change Earth's mass and watch everything go bananas.

And as far as I know, my computer is not on fire.

So what's the deal ? What is the real reason why n-body physics aren't implemented in KSP ?

I personnaly think it's much easier and less frustrating this way: orbits will never change unless you do something to them.

Otherwise, all your probes, orbiters, network relays, space station would have to be regularly checked and their orbits corrected. People would complain their first Mun space station crashed into the sun because thousands of pass-bys of minmus dislodged it from its orbit while they were warping for that transfer to Eelo. Actually everytime you would wrap at 10000x, you'd come back to your nicely setup orbits and discover everything has gone crazy. You'd have to chose between long travels and local orbits, or go through the pain of correcting everything every now and then during a long transfer.

Maintenance is boring.

So I'm fine with SoIs and single body physics. It's close enough to reality, it's easy to comprehend, and it keeps the game fun. But please, stop saying computers can't handle n-body physics.

tl;dr: KSP could have n-body physics, but it would ruin gameplay and make everything a pain in the ass.

Edited by Maxwell Fern
  • Like 2

Share this post


Link to post
Share on other sites

Universe Sandbox doesn't have drag models, or mass physics calculations.

n-body by itself isn't too bad (I've collided galaxies together in Universe Sandbox), but is so much more physics calculations on top of n-body if KSP had n-body that the lag would get horrible, especially as your 300 part station is now 300 n-body parts (floating point errors will always cause orbits to change).

  • Like 1

Share this post


Link to post
Share on other sites

Dunno why we can't have both. Have n-body physics, put everything on rails when you time warp.

Share this post


Link to post
Share on other sites

I'm perfectly happy with the current solution, it approximates reality well enough for most purposes and makes mission planning so much easier. The only realy loss are lagrange points but I can live with that.

Share this post


Link to post
Share on other sites

But Orbiter dosent do other things like KSP does like proper collision detection. Orbiter also dosent have to compute up to thousands of parts all interacting with each other at the same time while also maybe computing also a nearby ship/station.

You just cannot compare it like that.

Share this post


Link to post
Share on other sites
but is so much more physics calculations on top of n-body if KSP had n-body that the lag would get horrible, especially as your 300 part station is now 300 n-body parts (floating point errors will always cause orbits to change).

I have to disagree with that. N-body calculations could stop as soon as you enter an atmosphere, since it becomes totally irrelevant. And these calculations don't have to be for every single part of your ship, only for its global position.

I'm fairly convinced this is not a performance issue. It's a gameplay choice.

Share this post


Link to post
Share on other sites
But Orbiter dosent do other things like KSP does like proper collision detection. Orbiter also dosent have to compute up to thousands of parts all interacting with each other at the same time while also maybe computing also a nearby ship/station.

You just cannot compare it like that.

I knew mentionning Orbiter would make some forks and torches rise, but come on it was just to point out that technically, this is perfectly doable.

I'm not saying KSP is not as good as Orbiter or whatever, I'm just saying we don't have n-body physics because it wouldn't be fun. Not because we can't handle it.

Share this post


Link to post
Share on other sites

KSP alone brings some computers to a standstill (it once crashed my computer. It wasn't the program, but my computer itself.). I don't see how n-body calculations can make that any better.

Share this post


Link to post
Share on other sites

This has been discussed a lot of times now, and personally I find the notion that KSP would be incapable of having n-body simulation ridiculous (seriously, the only time it will actually put a strain - in time warp - is the only time when all the fancy 500-part mothership physics are shelved entirely as the ships are put on rails), but Squad has already stated that KSP will absolutely not have n-body physics. Alas, but true.

Share this post


Link to post
Share on other sites
I have to disagree with that. N-body calculations could stop as soon as you enter an atmosphere, since it becomes totally irrelevant. And these calculations don't have to be for every single part of your ship, only for its global position.

I'm fairly convinced this is not a performance issue. It's a gameplay choice.

So you are talking about a simplified n-body physics, whereby irrelevant changes are never calculated? Also, I do believe that floating point errors would still muck up orbits, since I have heard tales of them decaying orbits to the surface of bodies before, so if you take that problem, and put it in the scope of the whole system could mean that really long saves could have highly altered orbits. Not to mention interactions with Eeloo and Jool, or the moons in the Joolean system could also cause problems in n-body.

Share this post


Link to post
Share on other sites
Dunno why we can't have both. Have n-body physics, put everything on rails when you time warp.

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.

Edited by tntristan12

Share this post


Link to post
Share on other sites

I edited the first post since I don't think you people read it.

I'm not complaining that we don't have n-body physics, I'm saying this is a good thing because it would make the game frustrating, boring and overly difficult.

I DON'T WANT N-BODY PHYSICS.

Share this post


Link to post
Share on other sites
I edited the first post since I don't think you people read it.

I'm not complaining that we don't have n-body physics, I'm saying this is a good thing because it would make the game frustrating, boring and overly difficult.

I DON'T WANT N-BODY PHYSICS.

You mean bad? I'm confused.

Share this post


Link to post
Share on other sites

I'm pretty sure the joolian system would rip itself apart if the moons exerted any force between them.

Share this post


Link to post
Share on other sites
So you are talking about a simplified n-body physics, whereby irrelevant changes are never calculated?

Personally I'd like to see that kind of thing, though it would imply changes to the game engine being neccesary to make pertubation playable. When higher levels of automation are available, adding pertubation would actually improve the gameplay quite a bit, if unfocused objects had their orbit control system simulated at a lower level, so they are slowly bleeding off RCS / Fuel / Power while their missions procede.

indeed it'd need more processing power at higher warp, than as things are now, but they have said automation is coming eventually. If thats true, and things are going to happen in the background, some degree of pertubation and management for this might as well be added in my opinion.

Share this post


Link to post
Share on other sites
You mean bad? I'm confused.

"This" is referencing the lack of n-body physics. So he's saying it is a good thing that KSP doesn't have n-body physics as it would negatively impact gameplay.

Share this post


Link to post
Share on other sites

I remember reading someone say KSP physics engine is 32-bit and single threading, is that true? If so I would say there is room for more physics calculations if it was upgraded to multiple threading and 64 bit.

Also can't certain n-body effects be simulated in the "on rail" system with a minimal of extract calculations, like Language points and orbital perturbation?

Share this post


Link to post
Share on other sites

actually i dont believe in the " it will crush your computer argument"

if in the 60s NASA's computer could do it...i dont believe my 2013 computer cant.

see... the whole idea of "there's a long way down below" started in the 70s...

and newer CPUs are of 20nm fabrication

there's no way 60s NASA computer can beat my 45nm AMD Phenom II or a 42nm Intel i7

all you need is good programing with no or few redundant codes

Edited by lammatt

Share this post


Link to post
Share on other sites

Yeah but that 60s NASA computer had all of the variables fed to it by hand. It didn't have to work well in any number of general arbitrary cases. It only had to work well enough for the moon missions. That said, you're right that the decision to not implement nbp was not because of calculation intensity. I personally haven't missed lagrange points since it became important.

Share this post


Link to post
Share on other sites

An idea that's been bouncing around in my head to add n-body physics without too much pain (for the player and his or her computer, at least) is to introduce "no-man's land" in the space between bodies in the Kerbol system. Right now, every bit of space in the game is included in one body or another's SOI. My idea is to shrink each SOI drastically and leave the area outside of the SOIs as no-man's land. Inside a body's SOI, each craft follows a Keplerian trajectory ("on rails" as it is now), and in no-man's land each craft's trajectory follows n-body physics or some approximation of it. (The game might want to account for only the influence of the two or three bodies with the strongest gravitation at any given point, rather than account for every body in the system every time.)

With this approach, craft in reasonably low orbits around a body still have stable orbits because they're on Keplerian rails, just as you'd expect. For craft in no-man's land, errors that creep into their trajectory due to rounding don't matter so much because their trajectories are expected to be perturbed anyway. It's relatively easy on the computer to integrate a craft's trajectory in no-man's land (for plotting in map view or for traveling at high time-warp) because the integration is only done in areas with relatively low gravitational acceleration. That allows large time-steps to be used while maintaining reasonable accuracy. The SOIs can be set up to ensure that each body's Lagrange points are in no-man's land, so L-points will work as expected.

A couple folks mentioned the number of parts in a typical craft as a problem. But the acceleration can be calculated based just on the craft's center of mass (COM), just as currently the craft's COM moves on Keplerian rails. But it wouldn't be so hard to include tidal effects on a craft, by calculating the gradient of the gravitational field at the craft's COM. That first-order approximation can be used to calculate the gravitational force on each part based on the part's COM relative to the craft's COM. It would be neat to see, although it might not make much difference since each craft's rotation is cancelled out when going to time-warp anyway.

  • Like 1

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
But Orbiter dosent do other things like KSP does like proper collision detection. Orbiter also dosent have to compute up to thousands of parts all interacting with each other at the same time while also maybe computing also a nearby ship/station.

You just cannot compare it like that.

Calculating thousands of colliding solid bodys is no problem unless you happen to use a completely broken physics engine which was initially developed for a broken piece of dedicated hardware (Ageia PPU) and later duct-tape ported into GPU land where it was primarily used as marketing tool, with the physics engine being treated an afterthough. "Hey we spent a huge chunk of money on this, why sould we fix it" - and "Software Implementation??! - well a x87 should be good enough".

KSP alone brings some computers to a standstill (it once crashed my computer. It wasn't the program, but my computer itself.). I don't see how n-body calculations can make that any better.

It won't make your computer any better. It will still suck, sorry.

Share this post


Link to post
Share on other sites

I just want Lagrange points... >.>

Share this post


Link to post
Share on other sites

edit: I pretty much agree with Arq.

How long do you think it would take to recode KSP to change it from relying on Patched Conic mathematics and instead do 2 body mathematics? I would imagine the change and ensuing bugs are an excellent reason to stick with patched conics. Because it works well enough for the game to simulate the illusion.

Would we prefer that time be spent adding new content to the game or rehashing something that is working fairly well now? I know I would prefer new content.

Edited by air805ronin

Share this post


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