Flash & AS3 info, source, & experiments
ActionScript 3 Data Structures
I’ve been longing to re-create the Zelda Arena game I created a while back in AS 3 (under a different title so I don’t get sued by Nintendo), and actually finish the project (feature-complete) and post it online where multiple people could go up against each other on a single server. My dreams for the game might be larger than my spare time allows (it seems like I don’t even know what ‘spare time’ means lately), but I think I’ll take a shot at it and see what happens.
In order to do it properly and write some decent AI, I’ll need some good Graph and Tree data structures written in ActionScript 3. I was about to pull out all of my old C++ code for these structures that I wrote back in college and port ‘em over, until I noticed Michael Baczynski of Polygonal Labs did all the work for me! He called it AS3 Data Structures for Game Developers and, so far, has included the following structures:
- Multi-Dimensional Arrays (2d and 3d, native)
- Queue
- Stack
- Tree
- Binary Tree
- Binary Search Tree
- Hash Table
- Linked Lists
- Heap
- Priority Queue
- Graph
- Bit Vector
Although I haven’t begun to use them extensively yet, all of the features that I desire seem to be there. The code looks pretty good, both from an efficiency and a design pattern point of view. Everything has ASDoc supported comments. He even has a nice tutorial on using the Tree Class and it seems he might be adding more tutorials later. Nice work Michael!
You can download the structures here:
| Print article | This entry was posted by Nate Chatellier on May 18, 2007 at 3:35 pm, and is filed under ActionScript, Flash. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |

about 4 years ago
Thanks for writing this blog entry. You helped me find exactly what I was looking for! I was in the same boat and needed to create a tree in Flash. I was going to code one from scratch (or subclass the tree component and make one that renders the underlying data as a graph with nodes and lines and such) but I don’t code a lot of action script so I was having a hard time.
This is perfect alternative!