Hi all, (this is the same post as in the games programming forum)

I have a problem (isn't that obvious?)

I am making a game which involves surface ships (a.k.a boats) and am delving deeply into the entire basic engine right now.

Dealing with the steering AI is a real problem.

I guess there's much more to courses and speeds than you think!

I have one problem though...

supposed you have a vessel which gets an input of a destination (x and y). this vessel has:

a constant top speed,

acceleration/decelration rate (same value) and a

"turn per second" which is how much the ship can change it's heading right or left per each second.

now my problems arises when i give my vessel a destination which is too close and too far to the right or left... it begins spinning around in a circle and never reaches it's destination, this is due to the fact that according to the algorithm... while the destination has not been reached... the ship is set to accelarate to top speed and keep that speed... so the ship actualy turns as much as it can, but it turns to slowly and keeps overshooting the target... am i being clear?

basically... I need an algorithm, or mathematical function that would yield the correct speed that the ship's supposed to reach in order to get to the destination as fast as possible... i think it will have something to do with circles... but I don't know.

again, these are my ship's variables:

current x

current y

destination x

destination y

acceleration/deceleration (constant)

current speed

target speed

top speed (constant)

current heading

target heading

THANK YOU!