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.
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.
July 3rd, 2007 at 8:58 am
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
July 3rd, 2007 at 9:22 am
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.
July 3rd, 2007 at 10:58 am
this is amazing!
great work! keep it up!
July 3rd, 2007 at 3:37 pm
All I can do is drool.
WOOOOOW.
July 4th, 2007 at 9:38 am
[...] 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. [...]
July 4th, 2007 at 3:46 pm
Hey! good job man
July 5th, 2007 at 11:31 am
[...] X and Z Example [...]
December 4th, 2007 at 5:52 am
[...] A nice Flash implementation of this can be found over at http://www.actionscriptarchitect.com/2007/07/02/a-3d/ [...]
February 3rd, 2008 at 8:01 pm
source?
February 6th, 2008 at 1:44 am
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.
February 13th, 2008 at 12:42 pm
Very Sweet! I like.
September 8th, 2008 at 11:59 am
I could realy realy use this to make my game , can you please contact me , we can give money for it. thanks !
January 26th, 2009 at 5:59 pm
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.