By: Joseph Moyle

Download the demo here.

Download the Particles Project here.

Download the EmitterBuilder Project here.

cEmitter Releasing Donuts

Controls:

  • Esc – Exit.
  • Shift – Toggle particle’s geometry.
  • Backspace – Toggle between controlled camera/emitter.
  • Arrow Keys – Move camera/emitter.

Updates:

  • Goals
    • To create a solid and robust system, that is both simple to use and easy to customize.
    • To polish the project and make it as difficult to misuse as possible.
    • To remove unnecessary expansions that I had introduced last sprint.
  • Changes & Additions
    • sVector input force, which gives them a constant force that is applied to all particles upon creation.
    • Removed the variable length of the transforms array.
      • Users now have a fixed number of particles.
      • Particles are created upon spawn, and are reset rather than destroyed and created.
      • A particular particle will always be contained as the same element in an array.
        • You can use these elements as implicit identifiers.
    • Converged back into one cEmitter class.
      • Functionalities from other emitters can simply be created with a singular point emitter.
    • cEmitter‘s body is a sRigidBodyState which you can now move around.
      • This will effect the spawning position of refreshed particles, not where the currently are now.
    • EffectBuilder project is completed.
      • You can now load many different cEmitters into your game.
        • This functions similarly to how we have created other systems up until this point.
        • Specifying any field is entirely optional.
          • Default values can be set in the cEmitterBuilder.cpp.
    • How I Did It.
      • By following the same process we have used for both our cGeometry and cEffect assignments, I was able to create the builder project and binary reading load function in a timely manner.
        • This allowed me to focus on the functionality more.
        • I decided to unify my many sRigidBodyStates update functions into one per emitter.
        • This allows the game play programmer to lessen the amount of code they have to use.
      • By restricting the public accessible variables, I removed a lot of room for error.
      • Keeping the transforms array as a public facing data retrieval made it easy to keep things safe.
    • What I Learned
      • I should have put in more time thinking about how I could customize the inputs of an emitter.
      • Finishing one initial emitter first then moving on would have been a better move, rather than attempting to add functionality before I considered everything I might have to do.
      • How to more efficiently write to a binary file.
        • I didn’t fully grasp how to utilize this previously.
      • Design first.

Adding the System:

Particles Project to put in your Engine Directory
Particles Project Property Sheets
EmitterBuilder Project to put in your Tools Directory
EmitterBuilder Project Property Sheets
My Game Referencing Particles Project

Insert These:

The only .h you must Include
What to add to your AssetsToBuild.lua
Public Interface of the cEmitter
What to add to your AssetBuildFunctions.lua

Example Uses:

A Demonstrative Struct to hold your cEmitter
An Emitter Handle to Load into
How to Initialize a cEmitter
Called in UpdateSimulationBasedOnTime

Hot Tip: Do not call update on the emitter.body, as this is done within emitter.Update. You may, however, use the emitter.body to render something at the source if you wish.

Called in SubmitDataToBeRendered

Hot Tip: increase the maximum size of your the objects your engine is able to render to account for each of the particles!

Moving the cEmitter with sRigidBodyState
Cleaning up your cEmitter

File Format:

.emi File with all Optional Fields Specified

Hot Tip: You only have to specify the fields which you want to! You can change the defaults in cEmitterBuilder.cpp.

.emi File with Only Some Fields Specified