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

I would love for N-body physics to be an option. That the pricipia mod does it in KSP gives me hope for KSP2.

On 8/19/2019 at 9:31 PM, SlinkyMcman said:

If they have N-body physics you would also need to have a way for crafts to maintain their orbits when not focused. Juggling relays could get real tedious real fast.

One thing I really want is thrusting when on rails/not the active vessel... like low power ion engines, or fusion engines doing a brachistochrone trajectory.

Also, I relatively high relays like KSO shouldn't be too affected by N body physics.

Link to comment
Share on other sites

On 8/19/2019 at 9:02 PM, goncaloeaguiar said:

So with the awesome announcement of the sequel of our favorite game a question has to be asked... Will N-body physics à-là Principia be implemented?

I doubt it. Most everyday missions play out exactly the same with or without N-body. Lagrange points and the interplanetary network are pretty special use cases, and you buy them at the cost of a lot of CPU cycles. Not sure how many people will appreciate the former... as developer I'd be more afraid of people complaining about the game being slow.

I sure do hope they anticipate "realism" mods and have the game ready for them. (side note: axial tilt, anyone?) In the case of N-body, being prepared means that the planetary system should be up to it. I've never used Principia in stock, but heard the Joolian moons reorganize themselves real quick.

Link to comment
Share on other sites

It'll be great if the game had modding support that makes n-body physics possible to implement well, but I'm not sure it would add to the gameplay.  Orbital mechanics is hard enough as it is, adding the requirement for constant station keeping (either manually, or if automated the AI needs to be able to do it) would, I think put a lot of players off the game.

If there was a way to simulate lagrange points that would be fantastic, and make 3 body physics could add some complexity without the overhead of n-body.

Link to comment
Share on other sites

On the topic of stationkeeping, despite its heavy realism focus Children of a Dead Earth lets you do it for no cost and I would go the same route with N-body physics in a KSP game. In CDE you basically toggle freefall trajectories on when you want to move, and can leave them on for cool orbits or switch back to stationkeeping to retain a patched conics orbit. Best of both worlds without any added tedium.

It has to be said though, the performance drops can get insane. If you want to pinball around the Jupiter/Jool system you PC will just die from rendering the orbit; and nevermind trying to compute the orbits of multiple ships. This can be mitigated with a configurable limit on the trajectory rendering distance like Principia has, but the game still demands background tracking calculations for all freefalling vessels currently in existence.

 

51 minutes ago, KerikBalm said:

This seems like it needs N body physics to work well, the SOI system is a bit funky in stock KSP with Duna and Ike already, making the bodies even closer in mass and space makes it real funky real fast:

To be fair, those two bodies look like they're within each other's roche limits and are tearing each other apart; it looks intended in that case.

I hope, at least, in the other cases the planets were moved closer just for the trailer cinematics and/or testing convenience, and won't be like that in the release. Given the stuff like nuclear pulse and fusion propulsion in KSP2 it would be extra weird since those systems allow one to visit planets very far away very quickly, and would be kinda pointless if everything were twice as close as Duna and Ike.

Edited by Guest
Link to comment
Share on other sites

Honestly, I think the biggest argument against N-Body physics is that while Principia is a well-known mod, it's not exactly a widely used mod.  (Not that it isn't used - just that it doesn't get the same amount of 'I use this' as a lot of other mods.)  So, given the choice most KSP players aren't using N-Body physics.

I would like Larange points, I'll admit.  I'm sure there's a good way to fake them in a modified patched conics model.  (Maybe make the most common their own SOI?)

Link to comment
Share on other sites

1 hour ago, DStaal said:

Honestly, I think the biggest argument against N-Body physics is that while Principia is a well-known mod, it's not exactly a widely used mod.  (Not that it isn't used - just that it doesn't get the same amount of 'I use this' as a lot of other mods.)  So, given the choice most KSP players aren't using N-Body physics.

Principia also has a pretty janky interface though (no offense to the creators of the mod). Since the mod can't hook into the stock maneuver node interface, it has to use its own custom interface, which is way harder to use. Having used Principia, IMO the interface is *way* more annoying to deal with than the n-body effects ever are. Don't underestimate the value of a good interface.

Also, that's not necessarily an argument against implementing n-body. Players who don't want to deal with n-body effects can still do the same hohmann transfers as before, and, as has been mentioned multiple times in this thread, automated station-keeping deals with the biggest (& probably only) problem patched conics players would have with n-body.

Edited by chaos_forge
Link to comment
Share on other sites

I have a feeling that regardless of what comes stock; n-body and multiple star systems will be far easier to implement in KSP 2. The latter because if the trailer is to be believed KSP 2 is being built from the ground up with it in mind; the former because of the statement " giving modders access to things they haven't before" which implies much closer access to the game. Ofc it could all be lies and n- body physics will be in a l00tbox.

Link to comment
Share on other sites

Question for people familiar with the Principia mod: Does it update your trajectory immediately and smoothly as you burn, or adjust a maneuver node, the way stock does?

That seems like the biggest number crunch to me, I'm curious how Principia handles it.

Link to comment
Share on other sites

34 minutes ago, Opus_723 said:

Question for people familiar with the Principia mod: Does it update your trajectory immediately and smoothly as you burn, or adjust a maneuver node, the way stock does?

That seems like the biggest number crunch to me, I'm curious how Principia handles it.

Yes, it does. Generally, the performance depends on how far into the future you're trying to predict your trajectories. If you try to predict too much, things can slow down because the system is essentially having to calculate months'  or years' worth of trajectory every second. But generally, you can predict far enough along to execute any reasonable maneuver without taking a noticeable performance hit.

Also, solar system bodies in Principia aren't on rails, so in order to make a prediction the system doesn't just have to integrate your ship's trajectory, but that of every massive body in the solar system. Having the planets be "on rails" as they are in stock KSP would, for example,  be an easy way to dramatically increase performance (taking the calculation from O(n2) to O(n)) without (at least IMO) having a huge impact on realism, if performance is still something you're worried about.

Link to comment
Share on other sites

9 hours ago, chaos_forge said:

Yes, it does. Generally, the performance depends on how far into the future you're trying to predict your trajectories. If you try to predict too much, things can slow down because the system is essentially having to calculate months'  or years' worth of trajectory every second. But generally, you can predict far enough along to execute any reasonable maneuver without taking a noticeable performance hit.

Also, solar system bodies in Principia aren't on rails, so in order to make a prediction the system doesn't just have to integrate your ship's trajectory, but that of every massive body in the solar system. Having the planets be "on rails" as they are in stock KSP would, for example,  be an easy way to dramatically increase performance (taking the calculation from O(n2) to O(n)) without (at least IMO) having a huge impact on realism, if performance is still something you're worried about.

That's encouraging! I would have guessed that integrating out the ship's trahectory would be too prohibitive for the smooth flight planning we're used to.

In that case, I completely agree that putting the planets on rails but integrating out proper ship trajectories in the resultant time-dependent n-body field would be a wonderful compromise. The effect of n-body dynamics on the ship is, I think, where all the cool *rocket* science lies, not so much the effect on the planets.

Edited by Opus_723
Link to comment
Share on other sites

I hope not. It would just add a ton of busywork. Same reason I don’t want life support.

Lagrange points would be nice but those can be simulated on-rails.

Edited by Guest
Link to comment
Share on other sites

16 hours ago, DStaal said:

Honestly, I think the biggest argument against N-Body physics is that while Principia is a well-known mod, it's not exactly a widely used mod.  (Not that it isn't used - just that it doesn't get the same amount of 'I use this' as a lot of other mods.)  So, given the choice most KSP players aren't using N-Body physics.

I would like Larange points, I'll admit.  I'm sure there's a good way to fake them in a modified patched conics model.  (Maybe make the most common their own SOI?)

Well, I think its a bit intimidating, and people wouldn't normally get into it unless they first get past RSS.

That said, I'm highly interested in in, but I'm worried about the performance aspect.

15 hours ago, chaos_forge said:

Principia also has a pretty janky interface though (no offense to the creators of the mod). Since the mod can't hook into the stock maneuver node interface, it has to use its own custom interface, which is way harder to use. Having used Principia, IMO the interface is *way* more annoying to deal with than the n-body effects ever are. Don't underestimate the value of a good interface.

Also, that's not necessarily an argument against implementing n-body. Players who don't want to deal with n-body effects can still do the same hohmann transfers as before, and, as has been mentioned multiple times in this thread, automated station-keeping deals with the biggest (& probably only) problem patched conics players would have with n-body.

I was thinking of trying principia today with my modded system, but this makes me think again.. I'll give it a go, I am really interested in how N-body changes things, and trying out positioning craft at lagrange points too.

13 hours ago, chaos_forge said:

Yes, it does. Generally, the performance depends on how far into the future you're trying to predict your trajectories. If you try to predict too much, things can slow down because the system is essentially having to calculate months'  or years' worth of trajectory every second. But generally, you can predict far enough along to execute any reasonable maneuver without taking a noticeable performance hit.

Also, solar system bodies in Principia aren't on rails, so in order to make a prediction the system doesn't just have to integrate your ship's trajectory, but that of every massive body in the solar system. Having the planets be "on rails" as they are in stock KSP would, for example,  be an easy way to dramatically increase performance (taking the calculation from O(n2) to O(n)) without (at least IMO) having a huge impact on realism, if performance is still something you're worried about.

I think a reasonable compromise for KSP2 would be on rails planets, but N-body physics for craft. I'm guessing that craft don't bog it down nearly as much as additional planets, since craft wouldn't be modelled for gravitational influence.

I would want them to run N body simulations on the system to ensure its stable... in fact that's a major reason I do want to try principia... just to see if the way I've modded my system is stable.

2 hours ago, Brikoleur said:

Lagrange points would be nice but those can be simulated on-rails.

how? Any solution with a naked singularity is a big no-go.

Link to comment
Share on other sites

16 hours ago, DStaal said:

I would like Larange points, I'll admit.  I'm sure there's a good way to fake them in a modified patched conics model. 

Yeah, this, and faking a few other things would be good. Adding some special behaviour as you get close to the zone would be nice. 

Link to comment
Share on other sites

31 minutes ago, KerikBalm said:

how? Any solution with a naked singularity is a big no-go.

Let p = the Langrange point.

Let d = your distance from it.

Let r = Lagrange point's SoI radius.

Let g( d ) = gravitational acceleration exerted by a singularity at point p on a body at distance d. 

Let f( d ) = fudge factor.

Compute f( d ) so that f( 0 ) = -g( 0 ), and f( r ) = 0, approaching both limits asymptotically so that g( 0 ) + f( 0 ) >= 0 always.

With this fudge, as you enter the Lagrange point's SoI, it'll behave exactly like any other body with a gravity field. However as you get closer, its gravitational pull will fall off from that expected for a singularity, until you reach p, where it will be zero. Tune the curve of f to taste, adding cutoffs towards r and 0 if it helps.

No, it's not accurate, but it's simple and good enough that you can do fun stuff with it -- place a station there, park craft there, and so on. You'd need to do some extra maths to accurate represent the orbits in this fudged gravity field, but I don't think that would be too hard.

Edited by Guest
Link to comment
Share on other sites

8 minutes ago, Brikoleur said:

 

With this fudge, as you enter the Lagrange point's SoI, it'll behave exactly like any other body with a gravity field. However as you get closer, its gravitational pull will decrease, until you reach p, where it will be zero. Tune the curve of f to taste, adding cutoffs towards r and 0 if it helps.

 

Wouldn't it be better to fudge it the other way around? When you enter the zone, it starts simulating the forces of the other bodies? Knowing kerbal players, people will find a way to unrealistically orbit this.

Link to comment
Share on other sites

1 minute ago, Tw1 said:

Wouldn't it be better to fudge it the other way around? When you enter the zone, it starts simulating the forces of the other bodies? Knowing kerbal players, people will find a way to unrealistically orbit this.

Maybe? It would be somewhat more complicated for sure. This was just the simplest solution that sprung to mind.

I also don't see what the big problem would be with kerbal players unrealistically orbiting Lagrange points... :P

Link to comment
Share on other sites

Well, you can't do that in KSP as it currently is. If I understand what you're saying, you essentially hide a singularity with a region of zero gravity?

Also your notation makes no sense. f (0) is written as if f is a function ( like f(x) ), but a function of what? what variable has the value 0 in this case? And the factor does what, at some point its equal to -g? is f added to g so that when f = -g there is no gravitational acceleration? ie g+ -g = 0? When the distance is greater than the fudge factor cutoff radius, the gravity is unaltered, and the lagrange point acts as a point mass?

Well.... NOPE! lagrange points don't work that way either. L4 and L5 would work a little like that in some cases, but not L1, L2, and L3.

For Rald and Rusk, if you were to want to park a station between them, you'd need to model an L1 point.

704px-Lagrange_points2.svg.png

L1,2, and 3 would have gravity pull them towards a line going through the two bodies, but it would always pull them away from the lagrange point along the line.

Now some behavior would be somewhat similar:

https://en.wikipedia.org/wiki/Lagrangian_point#Stability

Quote

Although the L1, L2, and L3 points are nominally unstable, there are (unstable) periodic orbits called "halo" orbits around these points in a three-body system. A full n-body dynamical system such as the Solar System does not contain these periodic orbits, but does contain quasi-periodic (i.e. bounded but not precisely repeating) orbits following Lissajous-curve trajectories. These quasi-periodic Lissajous orbits are what most of Lagrangian-point space missions have used until now. Although they are not perfectly stable, a modest effort of station keeping keeps a spacecraft in a desired Lissajous orbit for a long time. Also, for Sun–Earth-L1 missions, it is preferable for the spacecraft to be in a large-amplitude (100,000–200,000 km or 62,000–124,000 mi) Lissajous orbit around L1 than to stay at L1, because the line between Sun and Earth has increased solar interference on Earth–spacecraft communications. Similarly, a large-amplitude Lissajous orbit around L2 keeps a probe out of Earth's shadow and therefore ensures continuous illumination of its solar panels.

The L4 and L5 points are stable provided that the mass of the primary body (e.g. the Earth) is at least 25[note 1] times the mass of the secondary body (e.g. the Moon).[17][18] The Earth is over 81 times the mass of the Moon (the Moon is 1.23% of the mass of the Earth[19]). Although the L4 and L5 points are found at the top of a "hill", as in the effective potential contour plot above, they are nonetheless stable. The reason for the stability is a second-order effect: as a body moves away from the exact Lagrange position, Coriolis acceleration (which depends on the velocity of an orbiting object and cannot be modeled as a contour map)[18] curves the trajectory into a path around (rather than away from) the point.

For L1-3, this floating around inside the fudge factor radius would be somewhat like the halo orbits around the lagrange points, but the lack of stability would not be modelled. The worse part of all this is that your lagrange point would "suck" your craft towards it, and this is NOT what happens.

At least the L4 and L5 points are stable, but they wouldn't be stable in a Rask-Rusk system (judging by the pics and estimating relative mass to be closer to 1:1 than 25:1). And again, its not going to be like falling into a gravity well (quite the opposite for L4 and L5).

L1-3 is like a marble rolling into the middle of a saddle, but then its unstable and it will roll off to the side of the saddle unless placed perfectly in the middle.

Link to comment
Share on other sites

5 minutes ago, Brikoleur said:

Let p = the Langrange point.

Let d = your distance from it.

Let g = gravitational force experienced by your craft. 

Let f = fudge factor.

Let r = fudge factor cutoff radius.

Compute g as if p was a singularity.

Compute f as a function of d and r, so that f( 0 ) = -g, f( d > r ) = 0.

With this fudge, as you enter the Lagrange point's SoI, it'll behave exactly like any other body with a gravity field. However after you cross r, your gravitational pull will decrease, until you reach p, where it will be zero.

No, it's not accurate, but it's simple and good enough that you can do fun stuff with it -- place a station there, park craft there, and so on. I'd make f approach 0 at f( r ) and -g at f( 0 ) asymptotically, with a cutoff at both ends once the value is close enough to either to be negligible.

That might be ok as a rough approximation of the L4 and L5 (leading and trailing trojan) points, which are stable, but not for the others.

Wiki on Lagrange points

Quote

In contrast to L4 and L5, where stable equilibrium exists, the points L1, L2, and L3 are positions of unstable equilibrium. Any object orbiting at L1, L2, or L3 will tend to fall out of orbit; it is therefore rare to find natural objects there, and spacecraft inhabiting these areas must employ station keeping in order to maintain their position.

 

 

Link to comment
Share on other sites

7 minutes ago, Brikoleur said:

I also don't see what the big problem would be with kerbal players unrealistically orbiting Lagrange points... :P

Why bother to have them? I can park something at L4 or L5 of the Duna- Ike system as it is already, and have it sit there thanks to the patched concis system. I just need to get the same SMA as Ike has. Lower it by 1 meter if I want to move prograde relative to ike, raise it by 1 meter if I want to move retrograde... station keeping like that is only needed on the order of several years... and I don't even need to find a special point, it works at any point along an orbit with the SMA of Duna.

The same is true along solar orbit. Without N-body physics, there's nothing special about L3, L4, and L5

Link to comment
Share on other sites

13 minutes ago, KerikBalm said:

Well, you can't do that in KSP as it currently is. If I understand what you're saying, you essentially hide a singularity with a region of zero gravity?

Good thing then that we're discussing KSP 2, not KSP as it currently is. And yes, that is what I'm saying.

13 minutes ago, KerikBalm said:

Also your notation makes no sense. f (0) is written as if f is a function ( like f(x) ), but a function of what? what variable has the value 0 in this case? And the factor does what, at some point its equal to -g? is f added to g so that when f = -g there is no gravitational acceleration? ie g+ -g = 0? When the distance is greater than the fudge factor cutoff radius, the gravity is unaltered, and the lagrange point acts as a point mass?

Read my suggestion again, I updated it with clearer notation: f is a function of d, distance to the Lagrange point, so that f( 0 ) = -g( 0 ) and f( r ) = 0.

So yes, when f( d ) = -g( d ) net gravitational acceleration is zero. If there is a cutoff factor, then past that cutoff factor, it acts as a point mass.

Anyway, the point I'm making is that I am 100% sure it's possible to simulate Lagrange points accurately enough for gameplay purposes using fudge factors as opposed to real N-body physics. I already said my simple example wasn't realistic, just good enough for fun gameplay. If you want to make it more accurate, make f a function of distance and orbital angle instead of just distance, that way you get those different shaped fields. Also note that I didn't say much about what shape the curve f draws actually takes -- I'm sure that by tuning it you can simulate instability as well. (I for one would be happy with just L4 and L5, I don't have much user for the others. Do you?)

Edited by Guest
Link to comment
Share on other sites

2 minutes ago, Brikoleur said:

Read my suggestion again: f is a function of d, distance to the Lagrange point,

You never said that in your first post, just that f was a fudge factor. So the fudge factor cancels the force of gravity within a certain radius of the point, this is what you're saying, yes?

I still say this is bad for KSP. One thing KSP did was teach orbital mechanics reasonably well, but stuff like this was left out. It shouldn't be added if its going to teach it wrong. I am *strongly* against the idea of being pulled towards a lagrange point by a stronger and stronger force, and then having gravity go to zero (which will have the craft keep drifting radially outward until it gets smacked with the full strength gravity of the lagrange point again).

Also orbits passing within the SOI of the lagrange point will be VERY wonky, and then you'd have to paper that over with making the lagrange point SOI small, yet its gravity well will need to be significant to counteract the outward drift that all will experience when you set the local gravity to zero... so you'd have a very abrupt start to strong gravity pulling you towards the point, then an abrupt cutoff, and with such an aribtrary system, I'd rather stick with the old patched conics... but then the SOI transition from Rask to Rusk is going to be terrible too.

N-body physics for craft is a must, or that binary planet needs to be redesigned, IMO

Link to comment
Share on other sites

7 minutes ago, KerikBalm said:

You never said that in your first post, just that f was a fudge factor. So the fudge factor cancels the force of gravity within a certain radius of the point, this is what you're saying, yes?

Yes, my original post was unclear.

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, which means...

7 minutes ago, KerikBalm said:

I still say this is bad for KSP. One thing KSP did was teach orbital mechanics reasonably well, but stuff like this was left out. It shouldn't be added if its going to teach it wrong. I am *strongly* against the idea of being pulled towards a lagrange point by a stronger and stronger force, and then having gravity go to zero (which will have the craft keep drifting radially outward until it gets smacked with the full strength gravity of the lagrange point again).

...that this shouldn't be the case. I wouldn't want that either. 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.

7 minutes ago, KerikBalm said:

Also orbits passing within the SOI of the lagrange point will be VERY wonky, and then you'd have to paper that over with making the lagrange point SOI small, yet its gravity well will need to be significant to counteract the outward drift that all will experience when you set the local gravity to zero... so you'd have a very abrupt start to strong gravity pulling you towards the point, then an abrupt cutoff, and with such an aribtrary system, I'd rather stick with the old patched conics... but then the SOI transition from Rask to Rusk is going to be terrible too.

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

7 minutes ago, KerikBalm said:

N-body physics for craft is a must, or that binary planet needs to be redesigned, IMO

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.)

Edited by Guest
Link to comment
Share on other sites

×
×
  • Create New...