# AI movement in space

This topic is 2490 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 a in order to change from current velocity v to desired velocity v[sub]d[/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?

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
633710
• Total Posts
3013486
×