3 ms·
There may not be an analytic solution, but solving the n-body problem numerically with newtonian physics isn't a difficult thing to do...it's simple enough that
by mrfredward 6y ago
There may not be an analytic solution, but solving the n-body problem numerically with newtonian physics isn't a difficult thing to do...it's simple enough that it has been used as a benchmark for doing computations:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/nbody.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- ben-schaaf 6y agoI'm sure they know this. The problem is that n-body simulations don't scale well with simulation speed. In KSP you can speed up time by up to 100,000x, which is essential for gameplay. If you want the same accuracy for n-body at that speed, you'll also need to do 100,000x the calculations. Whereas with KSPs simplified model you can calculate the position in orbit at arbitrary points in time, making 100,000x just as computationally expensive as 10x.
- bkanber 6y agoI don't know which integrators they're using but an algorithm like RKF45 should handle time acceleration with adaptive step sizes no problem. As grandparent said, n-body is very well-known. Regardless, KSP's workaround of using SOIs is simple and quite effective.
- mrfredward 6y agoThe top entry in my link above simulates 50 million years in 6 seconds for an n=6 system. That's 11,000,000,000,000X running on a normal PC.
- e_y_ 6y agoFrom a gameplay perspective, there isn't much sense in a full N-body simulation. Players only care about their spacecraft, which is a restricted three-body problem (small spacecraft, massive gravitational bodies) outside of special cases like gravity tractors. And the simplified two-body SOI worked pretty well in practice. In any case, the bigger gameplay problem tends to be the vehicle physics simulation, where you have hundreds+ parts interacting and not in the most stable fashion especially above 2x time warp. That's the part that seemed amazing when KSP first came out, moreso than the orbital simulation (although the solar system exploration clinched the overall experience).
- philwelch 6y agoFrom a gameplay perspective, I would love to put some propellant depots at Lagrangian points.
- perl4ever 6y agoI haven't played the game, and I don't know if it matters, but I would think that considering the processing necessary for attractive graphics in today's world, doing the physics right would have a cost too small to practically measure. I don't understand how something that could easily be done on an 8 MHz computer in 1985 could strain a modern machine. Especially if you look up a decent algorithm and don't do the naive one. Maybe there is some misunderstanding. Like, "n-body" to me doesn't imply a detailed simulation of inhomogenities in the celestial objects, like in real life they talk about mascons and such when landing on the moon. I'm assuming it's just that you calculate the forces of each body on every other body. And while you can do better than a simple N^2 calculation, if you have less than a dozen what does it matter?
- outworlder 6y agoWhy are we all arguing about this if there is already a mod that implements N-body for KSP? It even positions celestial objects according to the calculations, with some changes because the stock system is unstable. https://github.com/mockingbirdnest/Principia https://github.com/mockingbirdnest/Principia
- ben-schaaf 6y agoPrincipia is great, but it also shows exactly why this wasn't done in the base game. It has a significant performance impact, especially at high time-warp and thus doesn't scale that well with many crafts. They're able to push those calculations across all cores, but that only helps so much.
- sq_ 6y agoKSP is already heavily CPU-bound, so I wonder if part of the reason they've avoided implementing n-body in the game is that it would crater framerates and simulation speed.