Animated Particles, Books, and Code – It’s a New Year

2014

It doesn’t even sound real. Like an unreachable year in an 80’s sci-fi b movie. And yet, for better or worse, here we are. Seems my last post was quite some time ago (I think WordPress has had 16 releases since then) and a bit negative (bug report), so it’s time to start the new year off right.

Animated Particles

First on the agenda is something I’ve been meaning to do for awhile, but just never got the time until this Christmas/New Year’s holiday. Now, I really love the Starling particle extension. I mean, hell, who doesn’t love particles? But I always thought it would be nice if the particles could be animated (think flocks of flying birds or schools of swimming fish), so I sat down and added the possibility. First, the downside. I was hoping I could simply extend the current Starling particle extension and tweak it a bit. In theory this would be possible. Unfortunately, in practice, the properties and methods that needed tweaking were private class members. So, unfortunately, I had to basically duplicate a good deal of the code. First I just copied ParticleSystem.as into a new class named OpenParticleSystem and set the private members to protected. Then, I duplicated PDParticleSystem.as as AnimatedPDParticleSystem, had it extend OpenParticleSystem and did my tweaking there. With a little luck, in a future release, the authors of the original Starling particle extension will set the properties to protected and I can delete 90% of the code I’ve ‘written’ (only thing better than writing code is deleting code).

In any case, here is an example of what can be done with the Animated Particle System: 500 Starling birds flapping across the screen at 60 fps in a single draw call. If interested, you can find the source on Github here (the bird example is included in the source). One final drawback/word of warning: at the moment, when creating your sprite sheets for animated particles, you should keep all rectangles the same size. Adding clipping may introduce some really bad or unexpected results. I’m working on that (though of course you’re welcome to fork the repo and fix it yourself).

A Book

Here’s something to check out for the new year. Recently I had the pleasure of working as Technical Reviewer for the new book Starling Game Development Essentials by Juwal Bose. While it’s a fairly short read and a bulk of its pages is dedicated to explaining a single game, any Flash game developer out there working with Starling is bound to find some useful info and helpful tidbits. I highly recommend picking up a copy or two.

Some Code

Finally, just wanted to point out Wonderfl.net again. For those unfamiliar, this is a great place to post and browse compiled actionscript code snippets. And for those familiar, well, not much to say. You probably already know what a great joint it is. Here’s a simple Starling game I wrote and posted recently. Or, for something a little more exciting, here’s a bit of a demo made from a slew of fragment shaders and set to some Meat Beat Manifesto tune. Actually, here’s a link to everything I’ve put on Wonderfl, but I wouldn’t stop with my stuff. Have a good long browse. You’ll find some amazing stuff there.