Explosions, fire, snow, blood, dust, shining stars, bonuses… particles are a handy tool to add nice effects to your games.
Every game object that is loosely related to the game logic (– eye candy –) should be handled as particle, since it allows to have very light weight objects, and it allows the game engine to focus on its real tasks.
JSparkle is fast, since the update phase does take very little time, and there’s nothing we can do to get the draw phase to run faster on an html5 canvas. It does not create garbage, since it uses a fixed loop buffer that allocates all particle on engine creation. Another few tricks here and there made the update time fell below 5% of the draw time on my computer.
I won’t go into a full review here of the engine and its features -it was quite an effort allready to have it work fast, commented, with a few (hopefully) clear examples… dig into the code (maybe only to read the methods comments) if you wish to know more.
The gitHub with the library and a few demos is here :
You’ll find some help if you want to create your own engine in the readme.txt, but maybe the fastest way to understand is to look at an example -bubbles being the most simple-. Feel free to play with the engine, and tell me what you think.
I’d be happy to include your examples, i’m sure some of you have cool graphical ideas that would just rock with JSparkle.
I post here a few screenshots and links to the demo. Obviously, the screenshots are … well… quite still 🙂 so watch the demos to know hat it’s like 🙂 .
Latest example is Fire. move your mouse ! :
Bubbles is a very-simple-on-purpose example where balls just bounce on the borders on the screen. It spawns once all particles on engine start.
StarField is what we would expect :
Here’s another starfield : http://gamealchemist.co.nf/Particles/StarField2/StarField2Demo.html?800
mouse your mouse around to change the stars direction.
Fireworks is the most amazing to date, be sure to click here and there to make your
own fireworks !!
Fireworks uses an auto-spawn, and spawn also on a mouse click.
(in this last screenshot we see the debug panel, that show the time and the current buffer use).