background preloader

Docs & Tuts

Facebook Twitter

PureMVC and RobetLegs code comparison. Some time ago I wrote post in my blog there I compared PureMVC and RobotLegs framework code.

PureMVC and RobetLegs code comparison

I will re-post it here with improved code and added mvcExpress code examples. If you come from PureMVC or RobotLegs and want to try mvcExpress - it will help you learn the difference. Or if you are new to AS3 frameworks – it will give you nice comparison. Generally all frameworks are very similar! : mvcExpress and RobotLegs and PureMVC Pros: will help divide your code is small units and wire them;will help standardize your code;based on MVC;can be extended to your needs;helps you focus on your fun app instead of focusing on solving architectural nightmares; mvcExpress and RobotLegs and PureMVC Cons: hurts performance a bit;harder to debug “black box” framework code;couples implementation with framework; How those frameworks gets things done: Framework comparison: I created code examples that covers all framework features you will be using most of the time.

Base clases: Tracking memory leaks in AS3. If you're a super cool, handsome Flash dev like me, memory management is an important part of your daily coding routine.

Tracking memory leaks in AS3

While Flash has a garbage collector available so you never have to go to the same lengths as in C++, there's a lot of things we can do to make its life a lot easier and make sure everything, including our game, runs like gravy. When things do go arse over tit and our program is leaking memory faster than my ability to forget names the minute they're told to me, how can we make life easier for ourselves? [Sod this, I only want the code] Refresher time! What is s? In AS3, everything is passed as a reference (primitive objects like String, Number, int and their ilk have special operators in the background that make them act as if they were passed by value).

Pass by value example: Pass by reference example: What's this got to do with memory management? How does the garbage collector work? Magic. Reference counting. Isometric 3D math. Last year, Mike in Xpress sent me an fla.

Isometric 3D math

We needed to correct this swapdepths thing. From the movie above, we notice that, the player (represented by yelow block) does not show correct depths when he goes midway behind the west two green blocks. When the player moves, we need to swap the depths of the player correctly when he is hidden by a block or in front of the block. The most popular depths algorithm is y (row) dominant policy. The depth value of the tile depends on what row and col (y or x) it is at. tile_depth=((col_count)*y+x)*10; And the depth value of the player is just 1 higher than the tile he stands on. K*(y-1)+(x+1) > K*y+(x-1) K*y-K+x+1 > K*y+x-1 -K+1 > -1 2 > K; If we use the equation to assign the depths of tiles, to make the depths correct, K should be smaller than 2.

You might wonder, if we need K<2 why not use 1/row_count, so the equation will be depth_value=(y+row_count*x)*10 ? OK, this will make it correct when player stands midway between 2 y value. Wait ! Introduction to A* (A-Star) Pathfinding in ActionScript 3 (AS3) Introduction For Spellirium we had to develop a system that could determine the most efficient path between a series of nodes on a point.

Introduction to A* (A-Star) Pathfinding in ActionScript 3 (AS3)

After some diligent research and careful consideration it became clear that the A* search algorithm was the way to go. Now, I was familiar with the basics behind A* but had never actually implemented it. Thankfully though I had a copy of Keith Peter’s Advanced ActionScript 3.0 Animation which has a very nice chapter all about path finding and A*. Why read this post? Before we begin, some prerequisite knowledge is required. What is A* path finding? (A) computer algorithm that (finds an) efficiently traversable path between points, called nodes…. Sounds nice, but what does this mean? To implement the algorithm it is first important to understand a few concepts: Node: This is a point along a path. The Algorithm Now that is out of the way we can move on to the actual algorithm. The Implementation.