Mike Chambers

code = joy

Archive for June, 2009

Relative performance for collision detection techniques in ActionScript 3

with 20 comments

If you have read my blog any this week, you have probably noticed that I have been doing some basic research on collision detection within the Flash Player. As part of this, I have put together a simple test suite, showing the performance of a couple of different techniques for checking for collision. This is by no means meant to be exhaustive (and currently tilts towards boundary collision). However, I wanted to post the results as the current information is useful (if nothing more than to confirm existing assumptions), and perhaps generate more tests an ideas around collision detection.
Read the rest of this entry »

Written by mikechambers

June 26th, 2009 at 3:28 pm

Posted in General

Tagged with ,

Strategies for optimizing collision detection with BitmapData.hitTest

with 7 comments

Yesterday I blogged about how you can use the BitmapData.hitTest API to do collision detection between the visible parts of multiple DisplayObject instances. This works very well, but as some of the BitmapData apis can be cpu intensive (particularly new BitmapData and BitmapData.draw) you have to take care to make sure that performance does not get out of hand.

This post will discuss a number of approaches for optimizing collision detection when using BitmapData.hitTest.
Read the rest of this entry »

Written by mikechambers

June 25th, 2009 at 11:40 am

Posted in General

Tagged with

Using BitmapData.hitTest for Collision Detection

with 23 comments

The Flash Player contains a number of APIs for handling collision detection within Flash content. The DisplayObject class contains hitTest and hitTestPoint which can be useful if you need to detect bounding box collisions, or detect collisions between an individual point and bounding boxes or shapes.

However, BitmapData also contains a hitTest API, which can check collisions on BitmapData. Where the API really shines, is when you need to detect collisions between the visible areas of DisplayObjects (and not just of their bounding boxes). The API contains functionality for testing collisions between BitmapData and a Point, BitmapData and a Rectangle, and BitmapData and another BitmapData. It is the last item that I will focus on in this post.
Read the rest of this entry »

Written by mikechambers

June 24th, 2009 at 4:56 pm

Posted in General

Tagged with

What new game APIs do you want in the Flash Player?

with 92 comments

I have been learning some game development lately, and building my first game (well, at least my first game since Flash 4). I think game development and deployment are some of the real strengths of the Flash player, but ones which we haven’t specifically focused on in a while.

While working on my game, there were a couple of things I needed to do where additional player APIs could have made the development easier (as well as likely speeding up execution). This got me to thinking about other APIs that would be useful for game development. So, what new Flash Player APIs would you like to see that would make game development easier?

Here are a couple from me:
Read the rest of this entry »

Written by mikechambers

June 16th, 2009 at 12:03 pm

Posted in ActionScript

Tagged with , ,