Pathfinding in Space game

BlitzMax Forums/BlitzMax Beginners Area/Pathfinding in Space game

Rico(Posted 2009) [#1]
Hello I have written a nice little versus space game - a bit like Space War - but viewed side on. There are some platforms and dynamic objects and my enemy spaceship needs to pathfind round them to get to the player.

I am going to extend the game later on - so it is essential I have a proper pathfinding routine. (platforms will be destroyed or have holes in them)

What I would like is a routine which could come up with 5 different routes and then I would randomly choose one. I would want one of these routes to be the fastest/shortest route and the others to be quite varied and going in different directions so the enemy has some variety in tracking the player.

I have managed to convert my game area and dynamic objects into a grid array.

Can someone point me in a direction of a pathfinding routine, that can find routes like I require - ie not just the shortest route. Thank you very much


Retimer(Posted 2009) [#2]
What kind of pathfinding exactly? There's many that will and will not match your needs, it would be nice to filter that.


WolRon(Posted 2009) [#3]
A search for A* pathfinding will bring up tons of information.


Htbaa(Posted 2009) [#4]
A* is useful if you know the position of an object on the grid. If you don't know where it is, which I assume since it's about dynamic objects I'd say use Dijkstra's algorithm.

Read Programming Game AI by Example by Mat Buckland. He has that topic covered.


Rico(Posted 2009) [#5]
Thank you :)

I have both the start and end positions on the grid - I don't think I need to worry too much about dynamic objects in my particular case.

I want to get more paths than just the shortest one though.


Htbaa(Posted 2009) [#6]
Then you need Dijkstra's.


Rico(Posted 2009) [#7]
Ok Thank you - I will look it up :)