Argyne - Superemitter particle system

Monkey Programming Forums/User Modules/Argyne - Superemitter particle system

Nobuyuki(Posted 2013) [#1]

As part of a project that will be released soon, I needed a particle emitter that would suit my needs and preferably be re-useable for future projects. As I wanted to design it generic enough from the start to support nearly everything I could think of, the one-file module quickly ballooned into an entire system. I've named this system "Argyne".

Some of the features of Argyne are:
* A "Super-emitter" interface-based design - All valid particles implement Particle, including emitters, which means that emitters act as particles, and can recursively spawn other emitters as if they were particles, as well.
* Linear tween capability of all base properties - As an interface requirement of Particle, there exist 3 copies of a base properties container -- The Current of which is automatically tweened on update between the first and last values. adding more properties is simple; all tools are exposed in the ParticleValues class.
* Frame-based iteration values exist as default ParticleValues, including delta-spin, delta-xy, and gravity. This is in addition to the delta-time based values of location, angle, scale, and alpha. These values iterate based on how many estimated frames have elapsed since the last update, providing flexibility to coders who prefer frame-time animation. These values can also be automatically tweened over the life of the particle.
* Factory-based particle emitting. Emitters take an argument of an object which implements ParticleFactory, which contains a method allowing the emitter to spawn particles according to factory specifications. Factories can spawn other emitters which can call on itself or other factories, and thus spawn emitters recursively to n levels.
* A particle manager which performs automatic memory management of particles available. Particles and emitters mark themselves Dead after ttl as an interface requirement of Particle, and ParticleManager cleans them up. Eventually, it will deal with both allocation and deallocation using brl.pool, but for now, things are allocated manually, and de-allocated by ParticleManger.
* Some basic all-purpose particles are included with the module to get you started.

Features I want to add:
* Curve easing for tweens. Depending on where I take this library, this will either be implemented with preset curves similar to skn3's tweening.monkey, or (if a custom editor is made), I'll add custom spline-based easing instead.
* Delay value in addition to ttl. Automatically delays the start of the behavior of a Particle until after the delay has passed.
* Some sort of animated particle class to the basic all-purposes
* ParticleManager caller values for all particles, so a particular manager can manage the total number of particles and emitters in the system, and cycle out old ones when the manager's limit is reached (preventing cascade reactions).
* Resource pooling using brl.pool for optimal memory management.

Since this is still an extreme work in progress, I expect some of the method signatures and possibly some variable names will change and/or be re-factored in the near future. There are many more features I wish to evaluate before the module matures, but I believe it's at least ready to show people.

Get it / Clone it here:
I recommend seeing it in action!

Why0Why(Posted 2013) [#2]
Thanks for sharing! Love the Monkey community.

Difference(Posted 2013) [#3]
Thanks for sharing, looking forward to trying it out.

RENGAC(Posted 2013) [#4]
Cool! Thanks for sharing!

Xyle(Posted 2014) [#5]
Easy to implement for goof ball like me! Just what I needed!