The Drag[en]gine is a fully customizable game engine and game development environment designed with modularity and extensibility in mind not requiring expensive licenses.

Report article RSS Feed Particular Particles

Some time ago I mentioned once the particle system in the engine. With the changes in transparency rendering and the terrain system gone I had now the time to make particle systems work again. Three major improvements have been done to the particle system code.

Posted by Dragonlord on Nov 8th, 2010

Parameters / Emitters

   The old particle system used a little bit a cranky definition of parameters especially relaying on an old Curve code I had in use back then. Since some time proper Bezier-Curves are included in the engine and the editors. The new particle system uses now Bezier-Curves for the parameters. Bezier-Curves simply means you can define a curve as either constant, linear or bezier. With constant mode the value between curve points equals to the most left curve point value. Linear obviously is a linear interpolation which Bezier allows to define the curve with good control. In general the system has been streamlined and more parameters added. The idea is not to have an utterly complex particle system since this game engine has special objects for tasks typically done with particle systems otherwise. These are though not fully implemented as I first wanted to get the particle system done.

   One of the changes is how parameters are defined for particle emitters. In this game engine you have only Particle Emitter objects no particle system objects as found in other game engines. This is since particle system usually define a bunch of emitters and how they evolve over time. This is not the task of the game engine to define but the task of the game scripts. This allows utmost control over the process allowing to even have individual particle system definitions for individual games if required. A default particle system implementation will be given with the DragonScript Script Module later on.

   Each particle emitter has a set of parameters which are all defined in a compact way. For each parameter you can define a lower cast, upper cast, cast curve and progress curve. The following equations hold true to obtain the values:

CastValue = random( lowerCast, upperCast ) * castCurve( emitterTime )
RenderValue = CastValue * progressCurve( particleTime )

   The cast curve is not yet fully implemented but will allow to alter a parameter also according to an emitter time the game script can define at will. Should be useful for certain effects. Empty curves count as 1. This system should be variable enough for the time being. If required more complex calculations can be added later on.

Currently the particle emitters support the following parameters:

  • Size: Radius of a particle or the size in general.
  • Red: Value to multiply red component of texture property „color" with.
  • Green: Value to multiply green component of texture property „color" with.
  • Blue: Value to multiply blue component of texture property „color" with.
  • Transparency: Value to multiply texture property „transparency" with.
  • Emissivity: Value to multiply texture property „emissivity" with.
  • Mass: Mass of the particle in kg.
  • Rotation: Billboard rotation of particles in relative rotation (0=0°, 1=360°).
  • LinearVelocity: Magnitude of linear velocity (direction currently given by physics simulation).
  • AngularVelocity: Billboard rotation speed in relative rotation per seconds (0=0°/s, 1=360°/s).
  • BrownMotion: A random force changing with each frame applied to particles.
  • Dampening: Reduce linear and angular velocity each frame regardless of mass.
  • Drag: Apply air drag force to particles depending on their velocity and mass.
  • GravityX: Acceleration to apply to particles in the world x direction.
  • GravityY: Acceleration to apply to particles in the world y direction.
  • GravityZ: Acceleration to apply to particles in the world z direction.
  • LocalGravity: Blend factor between world gravity and GravityXYZ parameter. Can be used to make particles float at the beginning of their life and getting affected by gravity towards the end.

    More parameters are possible but for the time being this should be enough. If you have propositions for parameters I forget just post them in a comment.

Skins / Dynamic Skins and Lighting

   Nice thing on particles is that they do not only support assignment of a Skin object with all skin properties available to particles as they are available to Components but they can be also assigned a Dynamic Skin object. This allows to change skin parameters dynamically as with Components. The dynamic skin system is though still under construction and more abilities will be added later on. Planed is to make particles properties available to Dynamic Skin objects. This would allow to influence skin properties using the state of particle parameters. But that's to come.

   Another nice property of particles is that when they are emissive that they actually illuminate their surrounding. This adds more realism to particles like for example sparks or fire in that they illuminate without having to juggle lights around. With Deferred Rendering hundreds of particle lights can be rendered fast. The video below contains an example.


   One property missing from the old particle system had been the support for particle collisions. The major problem here is speed. Using the Bullet Physics library though particle collisions can be simulated with good speed. Besides Bullet has support for GPGPU physics as well as OpenCL support (not mature yet though) which will help to make lots of particles fast to simulate. Currently collisions are just handled internally. Additional parameters will be added later on to allow game scripts to alter how particle collisions are handled. For the time being only the Layer Mask is used to determine with what particles can collide.

   This video shows a few example particle systems. Excuse the „hiccups" in there. For some reason the capture soft gives me troubles since some days. Maybe HD a bit full who knows. The first one you might recognize from an old video about prop fields. It's the little fountain a thirsty dragon has been drinking from. Didn't plan for the splattering effect but the basic collision behavior of particles bouncing off the surface gave this (albeit crude) effect until more collision parameters are available. Second system shows some smoke. Later on this will be done using a special Smoke Emitter object but can also be done using particles which looks not that bad. Eventually a test with a spark emitter. The sparks are emissive which shows well in darker light conditions where they illuminate nearby geometry. As a little funny part I plugged in a plant model which acts like a particle catcher resulting in interesting lighting effects. These are just a few examples of what can be done with the system.

An editor for particle systems is going to come next. Right now the parameters are set by hand.


   Besides the particle emitters a new Editor has been added. Actually the editor by itself is not new but during the transition to the modular IGDE Application the Skin Editor had not been reworked yet. Now it has been. Skins can now be edited using this editor and tested on Components and maybe also particle emitters (depending on how the Particle System Editor is going to look like).


   With the particle collisions working a new way for handling collisions is available. Next step is to improve some collision routines using new Bullet features to gain speed where things still go a bit slow.

Post comment Comments
Tottel Nov 9 2010, 3:19am says:

Wauw, I didn't expect to see anything like this already. The smoke looks very convincing.. And those emitting particles: Well, "sexy" is the first word that comes to my mind. :)

+1 vote     reply to comment
Silverfisk Nov 9 2010, 10:21am says:

This particle system produces very nice results! Great work!

+1 vote     reply to comment
Kamikazi[Uk] Nov 9 2010, 11:03am says:

I love particles in games :D.

+1 vote     reply to comment
AniCator Nov 12 2010, 8:12am says:

Those light emitting particles look awesome!

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Windows, Linux
Team Epsylon
Send Message
Official Page
Release Date
Engine Watch
Track this engine
Report Abuse
Report article
Related Engines
Drag[en]gine L-GPL TBD
Related Groups
Indie Devs
Indie Devs Hobbies & Interests group with 1,095 members
Team Epsylon
Team Epsylon Developer & Publisher with 2 members