   common Particle/effect systems in game engines
  Hi,I am currently thinking which would be the best way to implement particles and effects in my engine.I saw that it is quite common to have som kind of effect editor based around the concept of an emitter where you can animate all its settings aver time. Anyways I was wondering how you would get those settings in your engine. Is that done via scripting? For instance that lua runs an update function for the emitter?Isn't that terribly slow?Anyways, what is the common way to be able to load effects from files?thanks!   
  Ogre3D has both emitters (that emit particles) and Affectors (that affect them). There's only a few types of affectors, liek a scaler, one that adds a linear force etc. By combining multiple affectors you can get quite alot of the effect you might wants.When I implemented my own particle system I also used affectors, you need to code for each affector but once thats done you can set it all up in a script and it runs with no increased slowdown. Of course, if you want the update function itself to be scripting then it will be relativly slow. Your not as free using premade affectors but it is pretty easy. Split the different behaviours into different affectors (one that scales particles, one that accelerates particles, one that fades particles etc) and then have multiple affectors per particle system.This is one of the programs that lets you create particle effect scripts for ogre:http://www.ogre3d.org/wiki/index.php/Particle_AcceleratorYou could take a look and get some ideas.   ;  Thanks!Ogres particle setup is a good inspiration. Anyways what if I wwant to affect my particles by a noise or sin/cos function. I guess in terms of speed it would be the best to hardcode a noise function in the engine and then just define some kind of special affector in my particle script, which basically just tells the emitter to use the noise/sin/cos functions with certain settings. This would mean that I would have to hardcode any special behaviours which are not linear though. Any ideas about that?   ;Quote:Original post by mokaschittaThanks!Ogres particle setup is a good inspiration. Anyways what if I wwant to affect my particles by a noise or sin/cos function. I guess in terms of speed it would be the best to hardcode a noise function in the engine and then just define some kind of special affector in my particle script, which basically just tells the emitter to use the noise/sin/cos functions with certain settings. This would mean that I would have to hardcode any special behaviours which are not linear though. Any ideas about that?Difficult one, what would you be affecting with such a function? If you were to do something such as wind, you may want to psuedo randomize the force thats applied. If so I would wrap such behaviour (random number generator/noise etc) in a c++ class, expose that to lua and have an affector that takes such a generator in its constructor:// psuedoNumberGenerator numberGenerator = PerlinNoise();Affector wind = RandomizedForce(numberGenerator);Not sure how you'd go about plumbing them all together, maybe NumberGenerator would be a base class that has a function that takes time/age as input and returns a number (in a given range) as output. RandomizedForce is a type of affector that gets its force then from such a NumberGenerator (could have some basic function ones then such as sin/cos).For changing colors, ogre has the "ColorImage" affector, you then define how particles change color as they age by use of a an image which gives a great deal of freedom. 