1. Mar 5, 2007

### Taremos

Hi,

In the future I want to make a realistic game set in space. Part of the realism is physics and sizes/distances.

Thus, one of the things I want to have solved before I even begin on designing the game graphically is that of navigation.

Navigation will be done primarily through AI; i.e. the player will tell the ship where to go and it will go there.

Before I even get into 3D, I must solve the problem of navigation in the 2D.

I already pretty much have the equation for what the AI would do if there isn't any near solar masses to effect it gravity.

What I have so far is this:
If the ship is already pointing in the direction it wants to go:

a = acceleration
d = distance
ra = rotational acceleration

1: forward thrust for t = sqrt(2*d/a)/2 - sqrt(pi/ra)
2: rotational thrust for t = sqrt(pi/ra)
3: negative rotational thrust for t = sqrt(pi/ra)
4: forward thrust for t = sqrt(2*d/a)/2 - sqrt(pi/ra)

to explain:
1: accelerate toward target
2: half way there minus half the amount of time it'll take to turn around, start turning around faster
3: slow down the rotation to that the ship is facing the 180 degrees from original direction
4: slow down the ship to stop at the point you wanted.

Pretty simple.

But now comes the problem of gravity. How can I have a navigation AI account for the effects of gravity of nearby planets, moons, and the sun?

Since the effects are negligible, I won't worry about other ships or other masses.

If anyone can solve this for me, or even just point me in the right direction... feel free to post!

Thanks

Edit: PS, this is assuming ships with only rear primary thrusters and small side thrusters for rotation.

Last edited: Mar 5, 2007