Jump to content

N-body physics


N-body physics in KSP2  

244 members have voted

  1. 1. Will n-body physics be implemented in KSP2?

    • Yes
      39
    • Yes, as a hard mode setting
      72
    • No
      109
    • Don't care, just want more explosions
      24


Recommended Posts

46 minutes ago, Brikoleur said:

And no, that's not exactly what I'm saying, although yes, at d = 0 the fudge factor will cancel out gravity. Only thing I'm saying about f is that at d = 0 it's -g, and at r it's 0. This leaves the shape of the curve open,

Fine, the inner SOI transition wouldn't be so jarring, but it still wouldn't be accurate.

Quote

As I said in my second post, if you make f a function of d and r (where r is your orbital angle), then by shaping the curve of f you can simulate any kind of gravity field. And I agree that yes it would definitely be bad if it behaved as you describe it.

Not so. All you'd have to do is manually tune f( d, r ) to get the behaviour you want.

Also not true. You can simulate the gravity field as accurately as you want with the improved suggested method a = g( d ) + f( d, r ) (where g = gravitational acceleration exerted by a point mass at the Lagrange point and f( d, r ) is a fudge factor computed from distance and orbital angle.)

This seems a lot like adding epicycles on to the geocentric model to make it fit observations, instead of going with a heliocentric model, but in the end you're getting the same thing. It also ends up being more complicated trying to keep patching over the old model, than to accept the new model.

But more importantly, now if you have gravity that varies with angle, not just distance, you can no longer use a conic approximation, the on-rails physics calculations are now shot. The whole point of the SOIs in KSP as it currently is, is to use patched conics, but you can't use patched conics in this scenario, as conic sections wont work when the net force of gravity (gravity + your fudge force) varies with orbital angle. It should work when physics are active and its calculating gravitational force, velocity, etc, but now because you wanted to avoid n-body physics, you've thrown conic approximations out the window, and we can't put ships on rails. It won't be as bad as full physics being active, as we can treat the craft as a single part.

However, I think I may see an area we can maybe converge on. I don't see a need for N-body physics. 3 body physics should be enough: 2 celestial bodies and a craft.

I'd be happy ignoring the gravity of the Sun, Moho, Eve, Duna, Jool, Minmus, etc, and just computing the effects of Kerbin and Mun within a certain radius of Kerbin.

Then ignore all planets except Kerbin within a certain radius range around Kerbol to have Sun-Kerbin Lagrange points.

3-body instead of N-body is fine as long as we don't have some weird Trinary systems (3 bodies of signicant mass).

We could use an SOI system to define which bodies are relevant, and keep it limited to a 3-body system.

If we put planets on rails, lagrange points won't work for celestial bodies (you can put bodies at close to L3, 4, and 5 and have it work, but they won't really be at those points, just close by), and bodies like that could be interesting (like trojan asteroid clusters around L4-L5 of Sun-Jool).

We could put major planets on rails, and some minor moons and asteroids get a simplified 3-body system using defined SOIs.

Edited by KerikBalm
fixed a few mistakes to improve clarity
Link to comment
Share on other sites

Good points -- and yeah, a 3-body simulation would likely be the best compromise solution. I would still like to fudge it with some cutoffs so I could put Kerbin satellites in stable orbits, but overall it should work nicely.

Link to comment
Share on other sites

Well, in the end, I think they should use an SOI system. I interpret "on rails" as you initially said " those can be simulated on-rail " to mean "conic approximations", where the "rail" is the conic section. Your more detailed "fudge factor" system doesn't work with conics, but the limits and such you propose are essentially SOIs, and I can agree with that.

In the current KSP system, all the planets (except maybe Dres and Eeloo) might as well be put on rails. All the moons except those of Jool might as well be put on rails.

I see no need to simulate the tug of Jool when looking at an orbit near Kerbin/Mun -  I think principia does this. I don't care about the slight influence of Mun on Minmus. The Jool system should just be redesigned to be stable IMO. If all the systems are stable (at least over timescales of a few centuries), 3 body physics should be enough to be pretty accurate for every encounter.

If a system is stable, at first I thought we might as well put all the bodies on conic section "rails"... but this may result in funkyness when doing interplanetary transfers when the target body isn't obeying the same laws as your outbound craft.

So... yea, I'm going to say that I want to see not N-body physics, but an SOI system with 3-body physics

 

*edit* and since an SOI system would be used, we could have a low Kerbin orbit SOI that over-rides the Kerbin-Mun SOI, to make LKO orbits stable, as I think we'd want them to be stable for beginners. We can't just have a Mun centered SOI (within which we'd do kerbin-mun 3 body cacculations) that wouldn't quite reach L4 or L5, and would be a long way from reaching L3... it would only enable L1 and L2.

I'm fine with an "Low orbit protection SOI" for beginners (ideally it could be turned off, as a difficulty option... something like "stabilize low orbits On/Off" )

Edited by KerikBalm
Link to comment
Share on other sites

What does n-body physics add to gameplay for the large majority of players?

Lagrange points, weird orbits, lots of complexity?

Lagrange points are good, weird orbits are bad. I've done games before, and folks on the forum forget that they represent the most dedicated, tiny sliver of the total player base. If you are on the forum, and actively discussing any of the mechanics in a reasonable degree of accuracy, you know more than 99% of the playerbase. 

This is something that you really need to consider as a developer - does the feature you are adding make the game more valuable or less valuable - players just want 'the best game evar' ; however they define it. So games have to choose the level & type of gamer they want to be delivering to - KSP hit a great sweet spot in terms of realistic-ish challenge (rocket building and orbital mechanics is hard) without being punishing (tiny planets = easy to get to orbit!). Adding N-body (or any other system) needs to keep that sweet spot, in order to maintain a player base. I don't see Kerbal picking up a ton of players from adding n-body, but I can easily see it turning people off, if it makes it harder to accomplish stuff. So it needs to be handled really, really well.

That extends out to opportunity cost as well - how much performance is n-body going to eat, that could be doing something else 'cool' (bigger ships? Better physics?) - and also dev opportunity cost. Conics on rails work 'pretty good' to build a really, really fun game. We have a pretty good idea how they need to work to be balanced, and I suspect that they could implement something similar without a massive dev lift. But N-body is going to have tons of edge cases, that we aren't even aware of being an issue. 

 

So - what are the benefits vs what are the costs. 

Link to comment
Share on other sites

You said it better than I could, @Doc.

Lagrange points would be nice, but so that I don't have to deal with unstable orbits for routine satellites. I'm pretty sure that it would be doable by fudging spheres of influence, either with a hard-coded field like I proposed or with 3-body physics with cutoffs like KerikBalm proposed. 

I also think @KerikBalm is right in that with the binary planet in KSP2 (I forget their names) this problem does need to be addressed somehow, otherwise things would get real freaky.

Link to comment
Share on other sites

6 hours ago, Doc said:

What does n-body physics add to gameplay for the large majority of players?

Lagrange points, weird orbits, lots of complexity?

Lagrange points are good, weird orbits are bad. I've done games before, and folks on the forum forget that they represent the most dedicated, tiny sliver of the total player base. If you are on the forum, and actively discussing any of the mechanics in a reasonable degree of accuracy, you know more than 99% of the playerbase. 

This is something that you really need to consider as a developer - does the feature you are adding make the game more valuable or less valuable - players just want 'the best game evar' ; however they define it. So games have to choose the level & type of gamer they want to be delivering to - KSP hit a great sweet spot in terms of realistic-ish challenge (rocket building and orbital mechanics is hard) without being punishing (tiny planets = easy to get to orbit!). Adding N-body (or any other system) needs to keep that sweet spot, in order to maintain a player base. I don't see Kerbal picking up a ton of players from adding n-body, but I can easily see it turning people off, if it makes it harder to accomplish stuff. So it needs to be handled really, really well.

That extends out to opportunity cost as well - how much performance is n-body going to eat, that could be doing something else 'cool' (bigger ships? Better physics?) - and also dev opportunity cost. Conics on rails work 'pretty good' to build a really, really fun game. We have a pretty good idea how they need to work to be balanced, and I suspect that they could implement something similar without a massive dev lift. But N-body is going to have tons of edge cases, that we aren't even aware of being an issue. 

 

So - what are the benefits vs what are the costs. 

Biggest thing for me would be better gravity assists. There a big part space travel, and how the SOI system works now makes them very strange to use. 

As for ships drifting over time, let controled/powerd craft use RCS for station keeping. Lagrange points would not need to use these. I'm guessing we will already have some sort of timewarp auto pilot?, since torch ships and interstellar ships fire there engines for the whole trip/months at a time. There has to be some way to control them why you work on other things.

I dont think it would add much to the performance, particularly if they keep planets on rails. Orbiter runs just fine with n-body and has since 2005? At the least it would be a nice difficulty setting, along with persistent rotation.

Link to comment
Share on other sites

An interesting thought experiment would be a hybrid system: Keep the planets on rails, and have say up to 2x(low-orbit) on patched conic, and put high-orbit and above into a modified N-Body, with just planetary and solar influences counted.  (No other ships.)

That would eliminate most of the stationkeeping, provide the Larage points and most gravity assists, while keeping computational cost fairly minimal.  It'd also provide a graduated learning curve for the players to adjust to - with most players really only being exposed to N-Body during transfers.

Link to comment
Share on other sites

8 minutes ago, sturmhauke said:

That's the 3-body method described earlier 

Not quite the same - the 3-body method would pick the two biggest influences, and just use those.  I was thinking more using all 'system objects' - that is, anything the player didn't launch.  Though I'll admit for many cases it would effectively be the same.

The main thrust of this idea however is the patched-conics for near the planetoids, and X-Body simulation for further away.

Link to comment
Share on other sites

2 hours ago, DStaal said:

An interesting thought experiment would be a hybrid system: Keep the planets on rails, and have say up to 2x(low-orbit) on patched conic, and put high-orbit and above into a N-Body

Low orbits in n-body are already extremely stable, on the order of thousands if not millions of years. There's really no need to mess about with patched conics, unless it's super important to you that a craft maintain an extremely specific orbit down to the exact meter (in which case I'd argue that automated station-keeping is a better solution to the problem than some sort of weird hybrid SOI system).

2 hours ago, DStaal said:

 a modified N-Body, with just planetary and solar influences counted.  (No other ships.)

That's already the standard proposal for n-body. Ships have infinitesimal mass compared to planets or moons. No sane person would propose trying to calculate the gravitational effect ships have on each other (or on planets)

9 hours ago, Doc said:

What does n-body physics add to gameplay for the large majority of players?

Lagrange points, weird orbits, lots of complexity?

Another thing is just the simple fact that (as hopefully has been established by now) the SOI approximation simply can't handle the case of two objects of similar size orbiting around their common barycenter. If you want to have that in your game (as it seems the devs do), then n-body is basically your only option.

Edited by chaos_forge
Link to comment
Share on other sites

11 hours ago, KerikBalm said:

If all the systems are stable (at least over timescales of a few centuries), 3 body physics should be enough to be pretty accurate for every encounter.

If a system is stable, at first I thought we might as well put all the bodies on conic section "rails"... but this may result in funkyness when doing interplanetary transfers when the target body isn't obeying the same laws as your outbound craft.

So... yea, I'm going to say that I want to see not N-body physics, but an SOI system with 3-body physics

3-body is not sufficient for plenty of situations. If you're transferring from Mun to Minmus for example, the gravity of Kerbin, Mun, and Minmus all matter quite a bit. Or if you're flying among the moons of the Jool system, it's quite easy to get into a situation where your orbit is resonant with both Laythe and Vall, or both Vall and Tylo, at the same time. If we go by SOIs, we should consider at least the parent body and every child body: If you're in orbit around Kerbin, you consider the influence of Kerbin and all its moons; if you're in orbit around Jool, you consider the influence of Jool and all its moons; if you're in orbit around the sun, you consider the influence of the sun and all its planets; and so on.

But even then, I'm not sure if I find that 100% convincing. The L1 and L2 points are both fairly close to the planet, so I could see a situation where you're in Kerbin's L1 and your orbit should be being affected by Mun, but isn't because of SOIs.

 

On a different note, I've found this page from the Principia Github page that claims that putting celestial bodies on rails wouldn't be that big of an improvement for performance, with the caveat that adding a larger number of celestial bodies or using a different Hamiltonian or numerical integrator might change that situation.

Link to comment
Share on other sites

12 hours ago, Zacho said:

Biggest thing for me would be better gravity assists. There a big part space travel, and how the SOI system works now makes them very strange to use. 

As for ships drifting over time, let controled/powerd craft use RCS for station keeping. Lagrange points would not need to use these. I'm guessing we will already have some sort of timewarp auto pilot?, since torch ships and interstellar ships fire there engines for the whole trip/months at a time. There has to be some way to control them why you work on other things.

I dont think it would add much to the performance, particularly if they keep planets on rails. Orbiter runs just fine with n-body and has since 2005? At the least it would be a nice difficulty setting, along with persistent rotation.

Gravity assists is a good point that is solidly in the 'plus' column, along with lagrange points. 

I can imagine 'casual+' players making use of those things.

Wouldn't automated stationkeeping effectively be placing non-piloted craft 'on rails' anyways? 

 

I am not going to make an official comment either way - since doing things 'the easy way' can often prevent you from doing other things 'the easy way' and then you need to make a complex system over there instead. 

 

N-body is neat, but the implementation needs to be handled in such a way that a 9 year old can effectively build a ship and reach orbit, without failing for complex reasons. 

Link to comment
Share on other sites

Having implemented the n-body physics they can just have a switch in settings:
"[x] Stay nice, take into account only current main reference body gravity" with a tip "By switching this off, you will make your orbits bad. Don't touch it."

By switching it off, you become an experienced space wolf.

Edited by kerbiloid
Link to comment
Share on other sites

14 hours ago, Zacho said:

As for ships drifting over time, let controled/powerd craft use RCS for station keeping.

This would consume fuel, which would require resupply missions, which would be tedious busywork.

Link to comment
Share on other sites

It would certainly give sandbox and career play a whole new dimension if we could set up automated supply routes and missions. 

That would be a pretty big departure however, and would introduce all kinds of complications especially for career mode. For example, every mission would necessarily cost funds. What happens if you do a multi-year timewarp on an interstellar mission? Without also automated income, you'll quickly run out and your space program will die. This means that you'd have to introduce mechanics for bringing in automated income during timewarp, which is... well, a whole set of new gameplay systems.

So yeah cool, but there are things I'd rather see the devs spend their precious hours on.

Link to comment
Share on other sites

13 hours ago, chaos_forge said:

 No sane person would propose trying to calculate the gravitational effect ships have on each other (or on planets)

Some people like Scott Manley WILL test the gravitational effects between ships, and some people like Danny2462 WILL use the gravity between ships for docking.

I do agree that Lagrange points make for excellent space stations.

Link to comment
Share on other sites

5 hours ago, Xd the great said:

Some people like Scott Manley WILL test the gravitational effects between ships, and some people like Danny2462 WILL use the gravity between ships for docking.

I do agree that Lagrange points make for excellent space stations.

I don't think the gravity from ships is significant enough to overcome any other forces acting on them. Maybe if they're both in deep space.

Link to comment
Share on other sites

20 minutes ago, Xd the great said:

Exactly, sounds fun.

AFAIK, the most massive part in stock KSP is the Kerbodyne S3-14400 tank, which masses 81 tons when full. If we had a ship made of 1,000 of these tanks, the gravitational acceleration it would exert on a ship only 100 meters away from it would be approximately  0.0000005  m/s^2, or 5*10^-8 g.

Simulating the gravitational effect that ships have on each other would not be fun, it would be incredibly boring.

Link to comment
Share on other sites

1 hour ago, chaos_forge said:

AFAIK, the most massive part in stock KSP is the Kerbodyne S3-14400 tank, which masses 81 tons when full. If we had a ship made of 1,000 of these tanks, the gravitational acceleration it would exert on a ship only 100 meters away from it would be approximately  0.0000005  m/s^2, or 5*10^-8 g.

Simulating the gravitational effect that ships have on each other would not be fun, it would be incredibly boring.

BUT, if we use mods to simulate a very heavy ship...

Or, simulate a black hole...

Link to comment
Share on other sites

2 hours ago, chaos_forge said:

AFAIK, the most massive part in stock KSP is the Kerbodyne S3-14400 tank, which masses 81 tons when full. If we had a ship made of 1,000 of these tanks, the gravitational acceleration it would exert on a ship only 100 meters away from it would be approximately  0.0000005  m/s^2, or 5*10^-8 g.

Since Gillilys gravity is 0.049m/s^2 this mean you only need about 98,000,000 to make an object of equal gravitational influence to Gilly. Something id be willing to try regardless of what cpu 0 has to say about it.

Edit: Dont foget about part welding.

Edit2: Dose it even matter their is no plausible way to put that many parts on a ship (or multiple ships in close proximity). I think I just talked myself out of calculating gravity of ships, unless we get some way of making large ships like in the 10m tonne department.

Edited by Optionalcoast
Sanity Check
Link to comment
Share on other sites

×
×
  • Create New...