First AI project - asteroids
Hi guys. So I've decided to take a first stab at AI with an enemy ship in asteroids, and wondered if you guys could give me some advice. Basically I want the enemy ship to fly towards the player, avoiding asteroids on the way.
Should I go down the path finding route, with some sort of object prediction / collision avoidance, or have a really simple method that just moves the enemy ship in the right general direction, adjusting the trajectory if necessary?
I guess it depends on how expensive dynamic path finding is, and whether it'd be better to completely simplify it.
This:
Asteroids are all convex (or can at east be easily estimated as such). Just do simple "bump & steer" around them trying to move towards the player until within a certain range.
-me
Quote: Original post by Kraizax
have a really simple method that just moves the enemy ship in the right general direction, adjusting the trajectory if necessary?
Asteroids are all convex (or can at east be easily estimated as such). Just do simple "bump & steer" around them trying to move towards the player until within a certain range.
-me
For Asteroids your second suggestion is probably more suitable and matches the seek/flee and Obstacle Avoidance Steering Behaviours
Cheers guys I'll take a look. I should really get a book or something on game AI at some point. Looks interesting.
[edit] Great link btw!
[Edited by - Kraizax on February 11, 2009 6:33:46 AM]
[edit] Great link btw!
[Edited by - Kraizax on February 11, 2009 6:33:46 AM]
You're welcome.
There's a lot of information online to get started BUT if you're looking for books which cover the basics for most of the AI 'areas' then you can't go too far wrong with either :
Programming Game AI by Example or Artificial Intelligence for Games .
There's a lot of information online to get started BUT if you're looking for books which cover the basics for most of the AI 'areas' then you can't go too far wrong with either :
Programming Game AI by Example or Artificial Intelligence for Games .
You can also look at Potential fields. The idea is to put a charge at an interesting position in the game world(that fades to 0 with distance) and let the charge generate a field that can be either attracting (positive) or repelling (negative).
Let the obstacles generate small repelling fields and the ship a attracting field. Sum the fields to get a total field at each square which can be used for navigation.
Let the obstacles generate small repelling fields and the ship a attracting field. Sum the fields to get a total field at each square which can be used for navigation.
Quote: Original post by SpeedRun
You can also look at Potential fields. The idea is to put a charge at an interesting position in the game world(that fades to 0 with distance) and let the charge generate a field that can be either attracting (positive) or repelling (negative).
Let the obstacles generate small repelling fields and the ship a attracting field. Sum the fields to get a total field at each square which can be used for navigation.
While I'm a big fan of influence maps and potential fields, I have to wonder if it isn't overkill for this situation. I agree with the local obstacle avoidance approach as illustrated by Craig Reynolds in the link above. Throw out feelers in front of the ship and adjust accordingly. To make is slightly smarter, project the path of the asteroids out in front of their actual location. That will bias the steering to go behind the actual asteroid as it is moving.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
Quote: Original post by InnocuousFoxQuote: Original post by SpeedRun
You can also look at Potential fields. The idea is to put a charge at an interesting position in the game world(that fades to 0 with distance) and let the charge generate a field that can be either attracting (positive) or repelling (negative).
Let the obstacles generate small repelling fields and the ship a attracting field. Sum the fields to get a total field at each square which can be used for navigation.
While I'm a big fan of influence maps and potential fields, I have to wonder if it isn't overkill for this situation. I agree with the local obstacle avoidance approach as illustrated by Craig Reynolds in the link above. Throw out feelers in front of the ship and adjust accordingly. To make is slightly smarter, project the path of the asteroids out in front of their actual location. That will bias the steering to go behind the actual asteroid as it is moving.
If the asteroids are convex in shape then steering behaviors is a much faster approach and potential fields wont have a higher advantage. However, if we can have asteroids that are concave in shape, the ship might get stuck. For this case, I think potential fields might be a much better option. But, there might be a way by which the problem can be avoided using steering behaviors .
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement