Experiment: Crystallization in AS2

I recently decided to see what would happen if I recreated my Flash 4 crystallization experiment using ActionScript 2.0. With the speed gains in Flash Player 7, and some pretty heavy algorithm optimizations, the results are pretty impressive, at least from a pure data handling perspective. Unfortunately, it still slows down on slower systems due to the heavy graphics requirements.


This first experiment (“bio foam”) was meant to be a close facsimile of the original F4 experiment, but I added in additional motion, and broke out of square grid a bit to make it feel a little more organic. This version has 3000 grid nodes over an area of 250×250 versus the original experiment’s 900 grid nodes over 96×96. The main limiting factor is the graphics compositing, which is minimized by dynamically adding movieclips to the grid only when they are visible, and removing them as soon as their animation has ended.

Simply click in the black area below to initiate the crystallization process. When it is complete, you can click again to restart the effect.

In this second experiment (“subatomic firecrackers”), I tried to reduce the impact of graphic compositing by utilizing quite simple shapes/animations, and minimizing the time each movieclip remains on stage (thereby decreasing the total number of clips on stage at any point in time). In this demo, there are over 15 thousand (!) grid nodes in the same 250×250 space. Again, this is attributable to a highly optimized algorithm, that deals only with “activated” nodes, and the speed gains in Flash player 7.

I’ll continue to play with this engine and post the more interesting results (these two were the results of an hour or two’s tinkering).

If you’re on a fast PC, let me know what these experiments look like… my poor powerbook can’t quite keep up with them (~25fps, instead of the 40fps they’re designed for).

If you’re interested in a bit of nostalgia (or are a bit masochistic), you can download the FLA for the original experiment. I might release the new AS2 CrystalFarm class at some time in the future when I’m done playing with it, but not quite yet. 😉

Grant Skinner

The "g" in gskinner. Also the "skinner".

@gskinner

7 Comments

  1. Pretty neat stuff.

    As for the speed, the “bio foam” one slows down a bit as its spreads its self out, but the “subatomic firecrackers” seems to run smoothly throughout.

    p4 2.5ghz, 1gb ram.

  2. the first slow down just when the circumference need 10pixels to touch the borders

    athlon64 3000

  3. Wow, really neat stuff. The first one’s more impressive – just a shame the Flash Player slows up so much.

  4. Yes bio foam slows slightly as it spreads then speeds up as it dissipates, but they can both run without subatomic firecrackers slowing at all.

    Dual @ Ghz PowerPC G5, 1.5 GB DDR SDRAM

  5. Yup the first one slows down big time.

    Dell Optiplex GX270 p4 2.8Ghz with 1 gig RAM

  6. Looks great, Grant.

    You should port this into Processing…

  7. Second one is fast but dropped few frames in the beginning, rest all is nice

    Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *