Jump to content

Lagrange points without 3-body solvers


Recommended Posts

I know this question has been asked before, and that the usual reply is "you need N-body solvers for having Lagrange points, Principia does that".  However, that's not necessarily true. Here's the argument:

I'm assuming that the average player interested in Lagrange points etc cares about a better description of the gravitational field felt by spacecrafts and possibly of asteroids (in case you want to capture one and park it at e.g. L4 for mining). This can be used to simplify the problem. One can keep objects above a certain mass M* on patched conics (basically planets and moons) whose orbits will be known analytically at all times and solve for the other objects in the background field of such objects. Furthermore one can perform a gradient expansion  (and possibly overall force magnitude expansion) for the relative forces among these objects. This way we neglects gravitational forces between spacecrafts (ok assumptions unless one builds really gigantic stations) and from far away asteroids.  Assuming one has k of those objects and N-k planets/moons, the problem reduces most of the times in k 1-body equations in the field of N-k analytically known objects. In some cases (e.g. for spacecraft landing on asteroid), it will be 2-body "triangular" system (the spacecraft feels the asteroid gravity, but one neglects the feedback, which is again a 1+1-body system), or full 2-body for e.g. two nearby asteroids and only rarely one has to fall back on a N-body solver, basically when there are multiple asteroids sufficiently close to each other.

I have not looked inside the Principia code and it could be that what is done there already (I doubt since there are patches for avoiding instabilities for the Joolian moons). Also I do not know if having such if statement on the mass is problematic with the way the code is structured. But if it is not the case it would be really nice to see something like that (together with the Principia plotting frames and a better flight plan UI) in KSP2 or in a mod.

Anyways, here were my $0.02. 

(And of course if you keep asteroids not generating gravity then the problem is always a set of 1-body equations in an analytically known external field) 

Link to comment
Share on other sites

29 minutes ago, yamanofudo said:

One can keep objects above a certain mass M* on patched conics (basically planets and moons) whose orbits will be known analytically at all times and solve for the other objects in the background field of such objects.

Big problem:  Things not on rails means "no more timewarp".

Link to comment
Share on other sites

  • 3 weeks later...

I feel like this should be implemented on the most BASIC level, also, you can use the points ahead, and behind the planet, and remain there for MONTHS, for planets, it's pretty much indefinite, however the L1 point should be added(maybe just make the object behave if it was at the orbit of the planet/moon

Link to comment
Share on other sites

  • 2 weeks later...
On 12/19/2020 at 5:57 AM, yamanofudo said:

I'm assuming that the average player interested in Lagrange points etc cares about a better description of the gravitational field felt by spacecrafts and possibly of asteroids (in case you want to capture one and park it at e.g. L4 for mining). This can be used to simplify the problem.

Bodies are on rails. These points are not stable in such case. Game keep ilusion of reasonable interaction by tracks, but it is only ilusion for our game experience.

To solve this You have to add another Lpoints invisible bodies on rails to keep vessels there. Like exclusive sphere of influence.

And it is already in game - Every orbit is stable. Always. It is not how it works in reality.

 

 

Edited by vv3k70r
Link to comment
Share on other sites

On 12/19/2020 at 10:14 PM, Corona688 said:
On 12/19/2020 at 6:03 AM, yamanofudo said:

Seems that Principia already solved the time warping issue...

It didn't "solve" it, it "re-implemented a large chunk of the game".  It's not exactly a feature.

And it seems KSP 2 can do that on-the-fly so it can switch to 3-body when around Rask and Rusk.

Link to comment
Share on other sites

3 minutes ago, Bej Kerman said:

Why are only Principia and KSP 2 allowed to rewrite huge chunks of code?

So, there's a mod for it, and it's coming to stock KSP2.  What, exactly, is your remaining need?

Edited by Corona688
Link to comment
Share on other sites

2 hours ago, Corona688 said:
2 hours ago, Bej Kerman said:

Why are only Principia and KSP 2 allowed to rewrite huge chunks of code?

So, there's a mod for it, and it's coming to stock KSP2.  What, exactly, is your remaining need?

Well, care to explain why "no more timewarp"?

Link to comment
Share on other sites

2 minutes ago, Bej Kerman said:

Well, care to explain why "no more timewarp"?

Parts "on rails" follow a perfect ellipse.  Their position 5 years from now is just 1 calculation.

True N-body physics are calculated the hard way, incrementally, 18-millisecond tick by 18-millisecond tick.

So the answer is not N-body, but some sort of kludge to specially handle a lagrange point.

Link to comment
Share on other sites

1 hour ago, Corona688 said:
2 hours ago, Bej Kerman said:

Well, care to explain why "no more timewarp"?

Parts "on rails" follow a perfect ellipse.  Their position 5 years from now is just 1 calculation.

True N-body physics are calculated the hard way, incrementally, 18-millisecond tick by 18-millisecond tick.

So the answer is not N-body, but some sort of kludge to specially handle a lagrange point.

Right, but that doesn't explain why there can't be timewarp.

Link to comment
Share on other sites

8 hours ago, Bej Kerman said:

Why are only Principia and KSP 2 allowed to rewrite huge chunks of code?

Because no one else has bothered.

For software to be written, you need someone who has both:

  1. The ability to do it.
  2. The desire to do it.

For Principia, the people who were able to do it wanted it. For KSP2, the people who are able to do it are being paid.

Link to comment
Share on other sites

12 hours ago, Bej Kerman said:

Right, but that doesn't explain why there can't be timewarp.

To be even more specific...N-body is what is known as "Chaotic".

Every element affects every other element, and there is never, ever a single final solution. So you cannot just say "Oh this ship is at this point on the curve, it'll be at this point in the allotted time"

Because let's say you did, because we have a Chaotic system you've now just completely bungled the calculations from that point onward. In the best case, the system in question will begin to behave erroneously. Worst case? Completely destabilizes. You have to do every single calculation, for every single interval, or it all unravels rather quickly. You can reduce the precision of these calculations, but that will eventually cause issues with enough objects.

17 hours ago, Bej Kerman said:

Why are only Principia and KSP 2 allowed to rewrite huge chunks of code?

 KSP isn't even designed to allow anything but the Kerbol System to exist. This is so deeply ingrained that it causes issues for the few mods that actually manage to get other systems in it (Kopernicus basically), and then those mods end up having to override significant portions of KSP just to get some of the most mundane things to work as expected.

So if you want to have other solar systems in KSP, you now need a stock Kopernicus (Which would be awesome tbh). And to get something like Rask and Rusk...you now need to switch how the game handles physics on the fly.  Which might not even be possible. Also Principia uses a external C++ plugin to achieve acceptable performance, which while there's nothing that technically prevents SQUAD from doing the same....

We're now in "Basically rewriting the game" territory, and that's assuming SQUAD has staff who know how to do it. 

KSP2 exists because in a nutshell; you're going to make a new game anyway if you want the original to be even close. And that might not even be possible in the end, so why waste the time and resources trying to make what you have do something it wasn't ever intended to do when you can just make what you wanted in the first place.

 

Link to comment
Share on other sites

On 1/14/2021 at 4:12 PM, Bej Kerman said:

Right, but that doesn't explain why there can't be timewarp.

Do you know how timewarp works?  It puts parts on rails.

No rails -- no timewarp.

We have now come full circle.

 

Edited by Corona688
Link to comment
Share on other sites

On 12/19/2020 at 4:57 AM, yamanofudo said:

One can keep objects above a certain mass M* on patched conics (basically planets and moons) whose orbits will be known analytically at all times and solve for the other objects in the background field of such objects.

The hints we have about KSP2 are consistent with them taking exactly this approach. 

They plan to implement enough to simulate Lagrange points around a pair of planets (halfway down this dev diary) -- although the near-equal masses won't give stable L4 and L5 around those particular bodies

They plan to compute acceleration of craft while running the simulation faster than real time (what KSP1's 'time-warp' does, but I think KSP2 calls it 'time compression' which is a better name anyway).  So almost certainly they have a mechanism for integrating the effects of forces on craft on over time, and that mechanism can run 10000× faster than real-time.  (And that is easily believable; they could use variable time-step integration, with a bigger time-step when craft are further from planets.)

Putting this mechanism in KSP1 would be a smaller change than the Principia mod, but larger than the addition of "core heat" that was, I think, the last addition to the 'on-rails' simulation in KSP1.  So I would guess it is not likely ever to be added to KSP1, even though everyone seems to like the idea.

Link to comment
Share on other sites

  • 3 weeks later...

I feel like a good way to deal with lagrange points is just not bother, anything on the orbital period of the body is already stable, also, you get that transfers would not work anymore, even if planets were still on rails, If I want to go to duna, eve will screw it up, I want to go anywhere in the jool system, laythe and tylo screw it up, Even in the kerbin system, the mun screws up anything not going to it, and minmus still is close enough to affect your orbit enough to make you collide with/miss the mun.

Link to comment
Share on other sites

17 minutes ago, kspnerd122 said:

I feel like a good way to deal with lagrange points is just not bother, anything on the orbital period of the body is already stable, also, you get that transfers would not work anymore, even if planets were still on rails, If I want to go to duna, eve will screw it up, I want to go anywhere in the jool system, laythe and tylo screw it up, Even in the kerbin system, the mun screws up anything not going to it, and minmus still is close enough to affect your orbit enough to make you collide with/miss the mun.

That's not how Lagrange points work, I'm afraid. Having the same orbital period of the body isn't the same as being in a Lagrange point.

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