A* 3D

Path finding is hardly a new topic for the Flash community. For me however, it’s an area unexplored. While I’ve always found the topic interesting and enjoyed the demonstrations out there in the wild my direction has just simply never really taken me there. Instead I was probably reading about some agile development process or something nice ‘n’ dry like that. Anyway, as I’m now delving deeper into 3D and game development topics I’ve started experimenting with path finding. It’s quite fun and not really all that complicated. At least at the elementary stage that I’m at.

I’ve been working with the A* algorithm which uses heuristics to find the most optimal path from a start node to a destination node within a node graph. The algorithm has many uses, especially in game programming.

In my exploration I’ve combined the A* algorithm with Away3D to illustrate how an object could travel through a 3D environment based on a found path.

A* 3D

It doesn’t always find the best path. Probably something simple I overlooked. I actually find that this could be used as an advantage however. For instance, if this was a character in a game the less optimal path can represent a poor choice by the character giving it a bit of added realism. A thought anyway.

13 Responses to “A* 3D”
  1. Timb0b Says:

    Nice work, thanks for that.

    But playing devil’s advocate:

    1. Yes, the A* implementation has some major issue, as it doesn’t find the best route. I’m not sure if the ‘realism’ point stands, as there are other 2d pathfinding algorithms that produce small errors that are much faster than A*; A* is supposed to be better because of its results.

    2. It’s not “A* 3d”, but rather a 3d-ish representation of A* done on a 2d grid. There’s a good difference and at first I thought it was really a 3d version of the A* algorithm.

    Anyhow, keep up the good work.

    Tim

  2. Paul Says:

    Hi Tim,

    thanks for the comment. You are right, this implementation of A* is only working in 2D, in the x and z. The scene is 3D however as can be seen when you rotate it using the arrow keys.

    I don’t think it would be difficult to extend into a 3rd dimension and have it really searching a 3d graph. Maybe that’s something I’ll work on next.

  3. xero / fontvir.us Says:

    this is amazing!
    great work! keep it up!

  4. h8ids Says:

    All I can do is drool. ;)
    WOOOOOW.

  5. [ draw.logic ] 3D Pathfinding in AS3 « Says:

    [...] At the actionscript architect’s blog check out the true 3d path finding in all three dimensions, and a 2d based pathfind using A* algorithm in 3d. [...]

  6. Giancarlo Says:

    Hey! good job man :D

  7. Crazy as hell | Start Says:

    [...] X and Z Example  [...]

  8. sprit3 » Blog Archive » A* search algorithm Says:

    [...] A nice Flash implementation of this can be found over at http://www.actionscriptarchitect.com/2007/07/02/a-3d/ [...]

  9. bob Says:

    source?

  10. plastik Says:

    I regularly hear people claim, incorrectly, that to use ActionScript 3.0, you have to know object-oriented programming, or every variable’s datatype must be declared, or everything has to be in packages and classes. In practice, none of those assertions are true. ActionScript 3.0 code can be placed on timelines, exactly as it was in ActionScript 2.0 and ActionScript 1.0. The code doesn’t have to reside in classes. Variable datatypes don’t have to be declared, even in the strict compilation mode. The language is designed to provide as much or as little structure and flexibility as the task at hand requires. If you prefer to program procedurally with functions and variables declared in frame scripts, you can continue to do so in ActionScript 3.0.

  11. Videographer Says:

    Very Sweet! I like.

  12. diede Says:

    I could realy realy use this to make my game , can you please contact me , we can give money for it. thanks !

  13. Circstar Says:

    Very well done, keep up the good work. I’ve been researching the A* algorithm and was happy to see it was done in AS3 (as that is the language I know best). Awesome stuff.

Leave a Comment