Thursday, September 24, 2009

Star Fish - A Game That Uses Stardust

Play this game

Stardust project homepage

Richard Davey created this fantastic game. The gameplay is very smooth, and the graphics is very appealing. The game rule is rather simple: get all the starfishes without hitting other fishes.

The bubbles in the background is created with Stardust Particle Engine. The bubble's motion is controlled by a Gravity action and a RandomDrift action. When the bubbles hit the stage boundary, they're killed by the DeathZone action with a RectZone as the death zone. Richard also added a little details to the bubbles in the menu scene: the bubbles bounce off the fish upon collision. This is probably achieved by using a CircleDeflector that follows the position of the fish.

Cute as the fishes may seem, the game is actually kind of hard to play as it gets to later levels, or it's just because I suck at playing games :p

Wednesday, September 23, 2009

Brilliant Fireworks

View SWF and source

Stardust project homepage

This is my entry for the 3rd WonderFL Checkmate Contest.

What could be better than a fireworks effect to show the power of Stardust?

I've subclassed an initializer (or spawn action) and an action for each of the four particles: Seed, Streak, Fireworks, and Spark. I've also extended the Renderer class to create a LineRenderer class, taking charge of drawing particle trails.

I think this is a good example to demonstrate the flexibility and extensibility of Stardust.

Wednesday, September 9, 2009

Stardust Now Available on WonderFL

WonderFL homepage
Stardust project homepage

Yep, you're right. Stardust is now available on WonderFL!!
I've created a couple of easy examples. You can check them out here.

Being in a rush, I only created 2D examples.
I'll be working on some 3D examples when I have enough time :p

Monday, September 7, 2009

Particle Snapshot Restoration

View example

Stardust project homepage

Click anywhere in the demo to explode particles, and click the "Restore Image" button to see the magic of snapshot restoration!

I mentioned this "snapshot" restoration stuff on my previous blog post.
This feature is now complete. You can grab it from the SVN repository.

The logics behind are pretty simple: the Snapshot class stores particle states (i.e. "snapshots") using an internal VO (value object) class, SnapshotData, and the SnapshotRestore class simply uses the easing equations to tween particles back to the previous taken snapshots.

I've also provided a ParticleRestoreFlag class for you to specify whether you want to restore the positions, rotations, scales, or more than one of these properties of the particles.

Friday, September 4, 2009

Left Out Stardust Template: Random

Get Stardust templates for FlashDevelop

Stardust project homepage

Oopsy. I just found out that I've left out a template for the Stardust template pack for FlashDevelop: the Random template. I've added the template and committed it to the SVN repository.

And for some info on the Stardust current development, I'm now working on a "snapshot" functionality for Stardust, which allows you to take "snapshots" of the current particle states, and then tweening particles back to this state afterwardg. You can optionally choose your restoration to work on position, velocity, rotation, angular velocity, or scale, and you can choose the easing equation at work as well.

My motivation for this functionality came out of a talk with Mark Vann from the ActionScript division at Medialand, back in the middle of August. He said he would like to create an effect using Stardust, causing shattered pieces of a bitmap to regroup. It involves no pro coding to create such effect, but he would like to have it done in Stardust; so I'm working on it now, trying to push the limit of Stardust another step further.

Tuesday, September 1, 2009

Linked List Failure for Stardust

Stardust project homepage

This is my second attempt to try using a linked list for particle engine. The first attempt was for Emitter, and this time it's for Stardust.

Theoretically, a liked list data structure is the best choice for a particle engine. Linked lists are well-known for their efficient removal of arbitrary nodes from the list. There's no way knowing the dying order of particles in a particle list, hence no way knowing the order of particle removal from the list. It seems that using a linked list for a particle engine's particle list is a good idea, but after my experiments, it turned out not to be the case.

I've tried to use a linked list for Stardust's particle list, and then recompile some of my existing examples. The result showed that the performance didn't improve; actually, it's quite the opposite: the CPU consumption got even higher (approximately 5% higher than the original).

I'm pretty sure when the number of particles is large enough, linked lists shall yield far better performance than arrays, but for common particle effects and daily uses, the number is simply not that large, thus the result. I got the exact same result from the attempt to use linked lists for Emitter.

The original array version of Stardust makes use of object pools to improve performance; however, I encountered some difficulty in implementing object pools for the linked list version (yeah, I'm just an amateur programmer). I think the performance gained by using object pools compensate for not using linked lists. I'll just stick with arrays for Stardust, unless I somehow get motivated to make my third attempt to try linked lists for particle engines (this really is time-consuming).

If you are interested, I've saved a copy of the linked list version in the SVN repository. Click here to download the RAR archive.