Not that long ago I attended the Flash Gaming Summit (FGS) in San Fransisco where I met many new people and sat through some pretty interesting sessions. One of which was a presentation by Sean Cooper (Boxhead) where he discussed some of his development techniques on the Boxhead games. He showed us a few impressive demos, but one in particular had hundreds of AI characters on screen all at once using bit blitting, and it ran beautifully.
Now I’ve done bit blitting in flash before and I’ve seen it’s benefits first hand in particle engines, but I’ve never really thought about ways to use it outside of particle engines. But after seeing that demo, it got me thinking about a particular problem I seem to have. Most of my physics games use a lot of rigid bodies, and one of the bottle necks I always see is rendering each one to the screen. It just reaches a point where all of those bodies on the screen makes Flash cry, and when Flash is sad, I am sad. Bit blitting could very well be my answer to a happier Flash.
This is a demo of bit blitting each object to one bitmap. Click on the swf and press SPACE to start the demo. As you can see, the results are impressive. A good 3+ frames per second better than adding to the display list directly.
Now as impressive as this, it does have and Achilles heel. Memory usage is quite high when using different graphics for different rigid bodies. In fact, this might only benefit a game that uses a small number of graphics for each body. This is because for every body needs an image for each degree of rotation (360 total).
why 360 images?? why don’t you use matrix-transformation?
greetz,
pix
How to build the elastic effect like the sushi cat game? I’m trying with box2D, but dont works fine. You could teach me? Or send me a source code for help me? I would like to learn this effect.
Excuse me for my poor english
Thanks