Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a game situated in space, and I'd like to issue movement orders, which requires pathfinding. Now, it's my understanding that A* and such mostly apply to trees, and not empty space which does not have pathfinding nodes. I have some obstacles, which are currently expressed as fixed AABBs- that is, there is no unbounded "terrain" obstacle. In addition, I expect most obstacles to be reasonably approximable as cubes or spheres.

So I've been thinking of applying a much simpler pathfinding algorithm- that is, simply cast a ray from the current position to the target position, and then I can get a list of obstacles using spatial partitioning relatively quickly. What I'm not so sure about is how to determine the part where the ordered unit manoeuvres around the obstacles.

What I've been thinking so far is that I will simply use potential fields- that is, all units will feel a strong repulsive force away from each other and a moderate force towards the desired point. This also has the advantage that to issue group orders, I can simply order a mid-level force towards another entity. But this obviously won't achieve the optimal solution.

Will potential fields achieve a reasonable approximation given my parameters, or do I need another solution?

share|improve this question
up vote 6 down vote accepted

While potential fields may work, I imagine you'll have issues with sub-optimal paths and "local minimums" where your units will be trapped by surrounding obstructions. A* is suitable for 3D open space environments. It simply becomes an issue of generating a navigation mesh that fits your needs. You can even use structures like Octrees for navigational nodes. The smaller the maximum size of each octant, the smoother the path. Check out this article from Face to Face games (now defunct, added wayback link). A* combined with path optimization (like line of sight shortcuts) and steering behaviors and you'll be good to go! See the image below as an example of using an octree for path nodes:

share|improve this answer
How is this going to scale to larger maps? If I had a map that was twice as large in each dimension, I'd need eight times the number of nodes, which would be problematic. – DeadMG Apr 10 '12 at 0:14
Not necessarily. You can keep the node size large until your search gets near it. This allows you to keep the nodes you're not interested in rather large and few in number. – Byte56 Apr 10 '12 at 0:55
A nice property of empty space navigation meshes is journey cost equality; you may be able to use A*JPS – Will Apr 10 '12 at 8:11
@Will: I did a bit of Googling, but I didn't really understand the only pathfinding algorithm that came up. Care to post an answer on it? – DeadMG Apr 14 '12 at 21:49
@DeadMG this is definitive explanation: <br/> If you can implement A*, you can then retrofit JPS to it fairly straightforwardly. Do A* first, and add JPS as an optimisation. – Will Apr 16 '12 at 11:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.