Create amazing particle effects with Stardust Particle Engine

Time to learn something about particle systems… the term particle system refers to a computer graphics technique to simulate certain fuzzy phenomena, which are otherwise very hard to reproduce with conventional rendering techniques. Examples of such phenomena which are commonly replicated using particle systems include fire, explosions, smoke, moving water, sparks, falling leaves, clouds, fog, snow, dust, meteor tails, hair, fur, grass, or abstract visual effects like glowing trails, magic spells, etc.

If you want more information about particle systems, refer to official Wikipedia page.

Today I want to introduce you Allen Chou‘s Stardust Particle Engine.

The main Stardust features are:

* Supports 2D and 3D.

* Easy to extend for custom initializers, actions, fields, deflectors, clocks, and 2D/3D renderers.

* Includes 3D extensions for ZedBox, Papervision3D, and ND3D.

* Includes a native 3D renderer.

* Supports masking (particles can be masked out for actions).

* Supports gravity and deflector simulation.

* Supports action triggers (for creating complex particle behaviors).

* Supports XML serialization.

On the official page you can find a lot of examples, and this is a quick example I made following the basic tutorial

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import flash.display.Sprite;
	import flash.events.Event;
	import idv.cjcat.stardust.common.actions.*;
	import idv.cjcat.stardust.common.clocks.*;
	import idv.cjcat.stardust.common.initializers.*;
	import idv.cjcat.stardust.common.math.*;
	import idv.cjcat.stardust.twoD.actions.*;
	import idv.cjcat.stardust.twoD.emitters.*;
	import idv.cjcat.stardust.twoD.initializers.*;
	import idv.cjcat.stardust.twoD.renderers.*;
	import idv.cjcat.stardust.twoD.zones.*;
	public class stardust extends Sprite {
		public function stardust() {
			var emitter:Emitter2D=new Emitter2D(new SteadyClock(0.5));
			var sprite:Sprite = new Sprite();
			addChild(sprite);
			var renderer:DisplayObjectRenderer=new DisplayObjectRenderer(sprite);
			renderer.addEmitter(emitter);
			var displayObjectClass:DisplayObjectClass=new DisplayObjectClass(star);
			var position:Position=new Position(new Line(0,0,500,0));
			var velocity:Velocity=new Velocity(new SinglePoint(0,5));
			emitter.addInitializer(displayObjectClass);
			emitter.addInitializer(position);
			emitter.addInitializer(velocity);
			var move:Move = new Move();
			var deathZone:DeathZone=new DeathZone(new RectZone(0,0,500,400),true);
			emitter.addAction(move);
			emitter.addAction(deathZone);
			var drift:RandomDrift = new RandomDrift();
			drift.randomX=new UniformRandom(0.1,0);
			var oriented:Oriented = new Oriented();
			oriented.offset=180;
			emitter.addAction(drift);
			emitter.addAction(oriented);
			addEventListener(Event.ENTER_FRAME, emitter.step);
		}
	}
}

That gives this result:

but I am not learing this engine for the sake of learning a particle engine… I am going to use it in my upcoming games so expect tutorials about using it in game design.

Rate this post: 1 Star2 Stars3 Stars4 Stars5 Stars (13 votes, average: 4.00 out of 5)
Loading ... Loading ...
Flash Templates provided by Template Monster are pre-made web design products developed using Flash technology.
They can be easily customized to meet the unique requirements of your project.
Be my fan on Facebook and follow me on Twitter! Exclusive content for my Facebook fans and Twitter followers

This post has 8 comments

  1. niraj

    on January 12, 2010 at 3:19 am

    try tweensy too
    http://code.google.com/p/tweensy/
    its also cool and super fast

  2. Wahooney

    on January 12, 2010 at 7:19 am

    Is Stardust a branch of Flint Particles (or vice versa)?
    Because the methods used are pretty much exactly the same.

  3. m_man

    on January 12, 2010 at 3:42 pm

    Hi, i visit your blog a lot and I appreciate all the work you do for us.
    Anyways I don’t like particle engines that go around the net and i dedicated myslef to making a fast simple in use particle code. it’s not as professional as this thing but here’s my result:
    http://mmankt.boo.pl/stuf/shade.swf
    I making this to use in my games and it’s more practical than stars falling form the sky.
    it supports all effects you can imagine, wind, shock waves, bullet ballistics with penetration and ricochets. more effects are coming to it and i’m also planning box2d integration for collisions.
    it’s not public yet and probably won’t be.

  4. Allen Chou

    on January 12, 2010 at 5:36 pm

    Nice tutorial there. Can’t wait to see your complete game in action!

    @Wahooney
    As described on the Stardust homepage, the core class structure was inspired by Flint, so the interface for the core classes look quite similar.

    It’s got some extra features though, including action triggers, particle masking XML, and serialization.

  5. Tink

    on January 13, 2010 at 12:35 pm

    “Is Stardust a branch of Flint Particles (or vice versa)?”

    I don’t know any info on branches etc, although Flint has been around in public a lot longer.

    Flints first commit is Feb 07, 2008. Richard was presenting Flint back in Feb 2008 (http://www.lfpug.com/practical-particle-effects-with-flint/)

    Stardusts first commit is Jul 04, 2009

  6. Richard Lord

    on January 16, 2010 at 2:24 pm

    As CJ says on his blog “The class structure of Stardust is inspired by Flint Particle System”.

  7. Weekly Shared Items – 19. January, 2010 | TOXIN LABS - weblog of a german design student from wuerzburg

    on January 19, 2010 at 8:07 am

    [...] Create amazing particle effects with Stardust Particle Engine [...]

  8. Anatomy of a Flash game main screen - Emanuele Feronato

    on June 17, 2010 at 5:08 pm

    [...] particle engine: reviewed here, it’s a quick and easy way to create amazing particle effects to be used in your [...]