Jump to content

n-body Physics Discussion


CMDRennie

Recommended Posts

This quickly became a hot topic in another thread, so I’m creating this one for a dedicated discussion.

Keep in mind that most of this is hypothetical as the developers have already chosen not to implement such a system in KSP2. And are unlikely to retroactively change the core physics of the game.

Link to comment
Share on other sites

Indeed, there is nearly zero chance that N-body physics will be implemented in KSP2. It's a big overhaul of the fundamental systems of the game.

I have another idea that might, just might, be more feasible: three-body physics. Basically, instead of having just the vessel and the main body, the physics system might also include influence from the second most influential celestial body. It would be Kerbin when you are near Mun or Minmus, Sun when in a planetary orbit and so on. I think it could still be done using the existing patched conics approach and would be reasonably realistic while not too computationally difficult or unstable. It would allow you to have Lagrange points, for instance.

The SOIs would have to be much bigger (e.g. Mun's SOI would end at a point where the Mun's influence gets stronger than the Sun's), but crossing them would have a smoother effect on the trajectory.

Link to comment
Share on other sites

40 minutes ago, garwel said:

I have another idea that might, just might, be more feasible: three-body physics. Basically, instead of having just the vessel and the main body, the physics system might also include influence from the second most influential celestial body.

I like this approach. I feel like it would be a fairly accurate representation of full n-body physics without allot of the computational and stability problems. I’m not a coder though, so I’m only guessing.

Link to comment
Share on other sites

26 minutes ago, CMDRennie said:

I like this approach. I feel like it would be a fairly accurate representation of full n-body physics without allot of the computational and stability problems. I’m not a coder though, so I’m only guessing.

IT is equally hard to implement N-Body and  3 Body physics. Seriously  if you allow only  bodies above certain mass to  add their pull to the  n-Body loop (while all bodies are subject to it)   you   can have somethign  really  smooth. THat if you put some good developer doing it, not the way the  resources of this game were  used. A lot of people already implemented this type of  thing for fun. It is not hard. It can be problematic only if you want asteroids to  affect each other's paths,but I do not think that is what players expect.

Link to comment
Share on other sites

1 hour ago, garwel said:

I have another idea that might, just might, be more feasible: three-body physics. Basically, instead of having just the vessel and the main body, the physics system might also include influence from the second most influential celestial body. It would be Kerbin when you are near Mun or Minmus, Sun when in a planetary orbit and so on. I think it could still be done using the existing patched conics approach and would be reasonably realistic while not too computationally difficult or unstable. It would allow you to have Lagrange points, for instance.

Unfortunately, that won't work.   The entire point of patched conics is that, as long as you're only affected by one body at a time, the orbits are conic sections.   Therefore, they're easily calculable (by both the simulation  and the players) and long-term stable.  As soon as you add another gravitational body, you've given up both of those benefits (and gained others, like the Lagrange points you mentioned).  In terms of computational load and ease of gameplay, that three-body approach is much closer to a full n-body approach than to the patched conics system.

Edit: oops, ninja'd

Edited by HenryBlatbugIII
Link to comment
Share on other sites

We do not need n-body physics.
The patched conic approximation is not without interest considering that it is/was actually used for mission planning.
At least it makes the navigation calculations accessible to the player and the orbital parameters remain fixed in the absence of thrust.

I don't see the point of putting in an overly complicated model that requires extra computational resources, and then having to push a button on a mod that calculates the optimal trajectory automatically.
You can play with matlab, gmat or whatever for that.

What I would like to see is a fictitious oblatness with a J2 effect on the orbit drift that only works when the physic is on rail.
This would allow a Kerbol-synchronous orbit.

Link to comment
Share on other sites

6 minutes ago, Kermann Nolandung said:

We do not need n-body physics.
The patched conic approximation is not without interest considering that it is/was actually used for mission planning.
At least it makes the navigation calculations accessible to the player and the orbital parameters remain fixed in the absence of thrust.

I don't see the point of putting in an overly complicated model that requires extra computational resources, and then having to push a button on a mod that calculates the optimal trajectory automatically.
You can play with matlab, gmat or whatever for that.

What I would like to see is a fictitious oblatness with a J2 effect on the orbit drift that only works when the physic is on rail.
This would allow a Kerbol-synchronous orbit.

Lets put this way this game waste computational resources left and right for   useless stuff.  N-Body would   be a drop in the ocean   in this scenario (if implemented by a competent developer and in a language proper for  this like C++ or Rust).    N-Body physics still adds more to the game than    kerbal expressions or kerbals rendering inside capsule, or  even more than PAINTING the ship (that seems to be the only feature they really worked on). So let people dream.

Link to comment
Share on other sites

39 minutes ago, tstein said:

That is one view, but there are lots of things that N-Body allows besides lagrange points.  THis is a good example

 

I know, but n-body means iterated numerical calculations for positional coordinates. The game cannot perform well without analytic solutions.

Link to comment
Share on other sites

22 minutes ago, Vl3d said:

I know, but n-body means iterated numerical calculations for positional coordinates. The game cannot perform well without analytic solutions.

It can  as I posted here  more than once time.  In one afternoon  I made an implementation that can process 42 days ahead  per SECOND  on  a Rysen 1  in  our real solar system with all the planets  and  up to 8 moons each on each planet . It is  really feasible for a  good developer. That  without ANY time spent optimizing it. If I spent a couple of days  making some parts in intrinsics I am sure I could get to almost 3 times that.

 

The biggest change a n N-Body game need is programability of course adjustments. So we coudl program   the ship to automatically  try to compensate after deviations reach  certain X level. That would be needed  to avoid issues of people losing their ships. It is  very doable, but it woudl be a game very different from KSP.

Edited by tstein
Link to comment
Share on other sites

With patched conic, the motion is described in a locally inertial reference frame, this is quite practical.
If we go with n-body physics,  in addition to the other gravitational forces, we must take into account the forces of inertia if we are not in the kerbol frame and we can continue as well with J2, solar pressure and even satellite emissivity.

I can see some interest for few specific missions.

In this case, why not install on these specific probes or vessels a massless engine that simulates all the orbital disturbances encountered while still remaining within a keplerian motion.

Link to comment
Share on other sites

48 minutes ago, Kermann Nolandung said:

With patched conic, the motion is described in a locally inertial reference frame, this is quite practical.
If we go with n-body physics,  in addition to the other gravitational forces, we must take into account the forces of inertia if we are not in the kerbol frame and we can continue as well with J2, solar pressure and even satellite emissivity.

I can see some interest for few specific missions.

In this case, why not install on these specific probes or vessels a massless engine that simulates all the orbital disturbances encountered while still remaining within a keplerian motion.

The other forces are so small that  they can  be ignore in this scale unless you build ships meant to harvest them. I do not think it is useful for example to  compute the movement of Kerbol relative to other stars for example on the timeframe   of the game :P

Link to comment
Share on other sites

Whenever this comes up, I just point to the n-Body addon developed for KSP1, Principia 

If a bunch of people can mod this sort of thing into KSP1... It goes to show how this sort of thing is doable, even if we have to do it ourselves.

Of course, this does depend on them not somehow hobbling mod support so that such extensive mods are impossible... which given the goal includes multiplayer, I worry may happen... Multiplayer and Mods seems to be a bridge too far for many development teams.

The missing n-Body and the current wobbly unity joint physics makes me worried that very little effort has been put into the "rocket physics" in the vacuum of space as opposed to the apparently pretty good airplane physics (haven't made a plane yet, I like rockets more) which would obviously be a good fit for multiplayer dogfighting or just general flying contraptions with friends. This also makes sense when I hear about bugs like phantom sea level drag  stuff like this. Its hard to not notice this sort of thing if you put something into a close orbit to take cool screenshots while whipping over the surface of a moon close enough to feel like your flying over it.

 

 

Link to comment
Share on other sites

My only remark here is that I don't really want Lagrande points patched into the SOI model. It'll lead to weird situation at the boundary, and has most of the drawbacks of full n-body (for the player in terms of predictability, I can see it is easier to implement from a dev perspective) and little advantages.

Considering that currently even the SOI orbits aren't working without issues, n-body physics isn't something I want added at this stage either. Let's just fix the basics please.

Missing n-body has great advantages from the gameplay perspective, so it's not the same kind of issue as with the wobbly physics. 

Link to comment
Share on other sites

Having made a plane in the last half a day since my original post, yeah planes feel fantastic, I just chucked something together with big old wings and the afterburning fast jets, did a liftoff strait into a zoom climb and had an apogee around 37km, and it was a bit chaotic as i dropped back into the atmosphere, I definitely did some maneuvering where I feel KSP1 would have ripped my wings off, but I think (it was a black plane at night, so I'm not completely confident of this) the wings didn't even flex, it was like I was flying a solid object. The wobbliest bit of my plane was the wheels on the landing gear! I'm really tempted to make a space plane to see if launching from the runway makes rockets less wobbly, the physics just felt that different. 

Which puts me back to my concerns about what the focus of development efforts has been. I am while not convinced, pretty confident much more time has been spent polishing planes and flying, because flying is more conducive to a "dynamic" and "interactive" multiplayer experience in "real time together" as opposed to orbiting rockets, where orbital phasing takes a while, frequently requires a time-warp or two if you don't have all day, and then docking is slow and steady to the point quite a lot of people find it boring... Its a fun challenge to do by hand on a new craft which you've never flown before, but it does get tedious to repeatedly dock refueling flights or crew transfer flights. As a developer it feels very understandable to have prioritized things this way, but it does make me worried that were in for a long slog of space related bugs... I hope I'm wrong. 

Link to comment
Share on other sites

On 2/26/2023 at 5:14 AM, garwel said:

I think it could still be done using the existing patched conics approach and would be reasonably realistic while not too computationally difficult or unstable. It would allow you to have Lagrange points, for instance.

the ellipses that makeup orbits are conic sections, hence patched conics. 3 body gravity would not be made of ellipses, nor is it predictable in the way patched conics are

Link to comment
Share on other sites

2 hours ago, mcwaffles2003 said:

the ellipses that makeup orbits are conic sections, hence patched conics. 3 body gravity would not be made of ellipses, nor is it predictable in the way patched conics are

I probably used the wrong term. I meant that this could be done using the approach of dividing space into spheres of influence and drawing the trajectory in each SOI. Of course, the shapes will be different from the current simple keplerian ellipses. But if we assume that the second most influential body is the main body's parent (which will be the case in 99.9% situations), they shouldn't be too hard to compute or predict.

Link to comment
Share on other sites

42 minutes ago, garwel said:

But if we assume that the second most influential body is the main body's parent (which will be the case in 99.9% situations), they shouldn't be too hard to compute or predict.

That's called the circular restricted three-body problem and it is pretty hard to compute and predict, unfortunately – also unliked patched conics it doesn't have an analytical solution, you have to integrate over time, so you can't just jump to any arbitrary point in time.

If you're curious, here's a fairly detailed description: https://orbital-mechanics.space/the-n-body-problem/circular-restricted-three-body-problem.html 

Edited by Guest
Link to comment
Share on other sites

37 minutes ago, Periple said:

That's called the circular restricted three-body problem and it is pretty hard to compute and predict, unfortunately – also unliked patched conics it doesn't have an analytical solution, you have to integrate over time, so you can't just jump to any arbitrary point in time.

If you're curious, here's a fairly detailed description: https://orbital-mechanics.space/the-n-body-problem/circular-restricted-three-body-problem.html 

Interesting, thanks for the link,

Link to comment
Share on other sites

22 hours ago, MarcAbaddon said:

My only remark here is that I don't really want Lagrande points patched into the SOI model. It'll lead to weird situation at the boundary, and has most of the drawbacks of full n-body (for the player in terms of predictability, I can see it is easier to implement from a dev perspective) and little advantages.

Considering that currently even the SOI orbits aren't working without issues, n-body physics isn't something I want added at this stage either. Let's just fix the basics please.

Missing n-body has great advantages from the gameplay perspective, so it's not the same kind of issue as with the wobbly physics. 

Sure this discussion is not even that KSP centric, it is  more a daydreaming.  A game that employs  N-Body is likely a game that would would   want to play with data efficient interface (and not a 3D rendering  of the world). It woudl  be much more like a complex mission planner than  an exploration game like KSP. A different game. I would  love to play it (I have hundreds of hours playing SUB games were  you have nothing rendered except contact bearings in a crude map and  you hear reports  and give most commands  by voice :P ), but some people would not.

Link to comment
Share on other sites

My 'gut feeling' on the N body debate is that it would likely cause far more problems, and apparent 'bugs', that are actually a result of it working properly than it may seem.

If Patched Conics works well, and predicably and reliably, and is good enough for NASA to plan things, then I don't  see any real advantage of changing it.

Sure, Lagrange points etc would be a nice feature, but not at the expense of other potentially gameplay wrecking behaviour or increased computational load.

Link to comment
Share on other sites

On 2/26/2023 at 2:26 PM, Vl3d said:

n-body means iterated numerical calculations for positional coordinates. The game cannot perform well without analytic solutions.

Simple keplerian orbit ("patched conics") is analytic but it doesn't have a closed-form expression either, it's also an iterative algorithm.

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