Sign in to follow this  
amirabiri

AI movement in space

Recommended Posts

I have a simple questions that I think I know the answer for but I thought I'd ask it anyway to verify + maybe get some more useful information.

Basically I have a spaceship in space (...) controlled by an artificial intelligence algorithm. This is classic space movement - i.e the ship's facing and velocity are detached. When the engines are activated on the other hand, the force that is applied on the ship is in the direction of the ship's facing. This sort of setup is relatively easy for a human to operate in (well, for gamers anyway...). A human being intuitively compensates between a desired velocity and current velocity.

Now I'd like to teach my AI to do something similar. When the AI decides it wants to go to point A, simply facing in that direction gives unsatisfactory results. Due to the current velocity and depending on distance and movement of the target point, the AI might miss, and it often enters an orbit around the target point. What I need instead is to find the right formula or algorithm that determines the ideal acceleration vector [b]a[/b] in order to change from current velocity [b]v[/b] to desired velocity [b]v[/b][sub][b]d[/b][/sub]. I have attached the following diagram to illustrate what I mean:

[attachment=7346:AI velocity.png]

Looking at the problem and assuming I correctly understand the effect of acceleration on velocity, it seems to me that the ideal acceleration direction is the direction between the tips of the current and desired velocities. i.e:

[attachment=7347:AI velocity 2.png]

This will of course be affected by the ship's maximum velocity and maximum acceleration which the ship's AI will have available.

However, this feels somewhat counter-intuitive. So my questions is: Is this correct? and if not what is the better approach?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this