Computing planet orbit's

About the actual programming of the game.

Re: Computing planet orbit's

Postby Zardoz » Tue Aug 20, 2013 4:49 pm

r4d2 wrote:I like how the orbits are calculated/simulated in Kerbal. Does anybody have an Idea how they do it?

It' s definitely not n-body. I would guess they basically calculate a perfect elliptic orbit to the closest body (wrt. gravitational force), with some form of interpolation when the forces are almost identical.


I think that they define bounding spheres for each astronomical body, except the "sun". When a ship/probe gets inside of a bounding sphere, it is affectect by only these astronomical body, because defien qhere the gravititation ofrce of these body is enought stronger to make insignificant the forces of other bodies. If isn't in an bounding sphere, then only aply "sun" grav forces over it. It can be see when you get out of Kerbal and try to reach Mun, or any other planet.
Yep, I have a blog : http://zardoz.es
Emulator DCPU-16 VM
User avatar
Zardoz
 
Posts: 359
Joined: Mon Aug 12, 2013 8:54 pm
Location: Spain

Re: Computing planet orbit's

Postby The cLyde » Tue Aug 20, 2013 11:40 pm

How it could be done:
  • Generate galaxies;
  • Precalculate elliptic orbits of objects we want to have that orbit, whereby gravitational pull of a body will only affect bodies that are "close enough", and that are smaller or similar size (e.g. the Earth is not affecting the Sun);
  • Give the objects with precalculated orbits an initial impulse;
  • Other objects (like asteroids) would get random starting impulses;
  • Run the n-body simulation with proximity and size ratio limitations;
I could make a simulator to demonstrate my idea. If some are interested (or want to know more what I'm talking about) let me know (just so i don't put in work for nothing).
The cLyde
 
Posts: 3
Joined: Mon Aug 19, 2013 12:16 pm

Re: Computing planet orbit's

Postby mrout » Wed Aug 21, 2013 6:23 am

Zardoz wrote:
r4d2 wrote:I like how the orbits are calculated/simulated in Kerbal. Does anybody have an Idea how they do it?

It' s definitely not n-body. I would guess they basically calculate a perfect elliptic orbit to the closest body (wrt. gravitational force), with some form of interpolation when the forces are almost identical.


I think that they define bounding spheres for each astronomical body, except the "sun". When a ship/probe gets inside of a bounding sphere, it is affectect by only these astronomical body, because defien qhere the gravititation ofrce of these body is enought stronger to make insignificant the forces of other bodies. If isn't in an bounding sphere, then only aply "sun" grav forces over it. It can be see when you get out of Kerbal and try to reach Mun, or any other planet.


Yeah, it's actually quite amazing how popular the game has become despite its terrible gravity simulation.
mrout
 
Posts: 731
Joined: Mon Aug 12, 2013 10:49 pm

Re: Computing planet orbit's

Postby Zardoz » Wed Aug 21, 2013 9:46 am

It's fine for the 90% of time. Only gets weird when you change from bounding spheres. Actually I build space stations around Kerbal... :D
Yep, I have a blog : http://zardoz.es
Emulator DCPU-16 VM
User avatar
Zardoz
 
Posts: 359
Joined: Mon Aug 12, 2013 8:54 pm
Location: Spain

Re: Computing planet orbit's

Postby mrout » Wed Aug 21, 2013 3:38 pm

Zardoz wrote:It's fine for the 90% of time. Only gets weird when you change from bounding spheres. Actually I build space stations around Kerbal... :D


I have to disagree, sorry.
mrout
 
Posts: 731
Joined: Mon Aug 12, 2013 10:49 pm

Re: Computing planet orbit's

Postby croxis » Thu Aug 22, 2013 3:51 am

How would gameplay differ then mrout?
croxis
 
Posts: 282
Joined: Tue Aug 13, 2013 1:37 am

Re: Computing planet orbit's

Postby mrout » Thu Aug 22, 2013 3:01 pm

croxis wrote:How would gameplay differ then mrout?


Have you played around much with KSP? The physics is *way* off from what a real physics simulation would look like.
mrout
 
Posts: 731
Joined: Mon Aug 12, 2013 10:49 pm

Re: Computing planet orbit's

Postby croxis » Thu Aug 22, 2013 4:13 pm

I played with KSP alot. In what way is it way off -- L points aside?

*edit: what would personally convince me is seeing various 2d trajectory situations
croxis
 
Posts: 282
Joined: Tue Aug 13, 2013 1:37 am

Re: Computing planet orbit's

Postby mrout » Fri Aug 23, 2013 10:01 am

You can only be under the gravitational influence of one object at a time. That's how it's off.
mrout
 
Posts: 731
Joined: Mon Aug 12, 2013 10:49 pm

Re: Computing planet orbit's

Postby croxis » Sat Aug 24, 2013 2:13 am

That tells me nothing. I want data. Percent error.
croxis
 
Posts: 282
Joined: Tue Aug 13, 2013 1:37 am

PreviousNext

Return to Code

Who is online

Users browsing this forum: No registered users and 1 guest

cron