Jump to content
  • Advertisement
Sign in to follow this  

AI movement in space

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

If you intended to correct an error in the post then please contact us.

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?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!