Some Thoughts on a Node Based Particle System

This is an old ar­ti­cle from 2012. I was a kid. I learned a lot since then, so please do think twice when tak­ing ad­vice from me as a kid.

My vs­ge game en­gine us­es a node based graph­ics en­gine. This makes par­ent­ing re­al­ly easy for ex­am­ple. En­ti­ties of the game en­gine own a graph­ics node and up­date it’s trans­form, so they can be dis­played to the screen eas­i­ly.

Call­ing the nodes draw­ing pro­ce­dures is han­dled by the graph­ics en­gine and Nodes draw their chil­dren.

- Node based Par­ti­cle Sys­tem -

Now how would a par­ti­cle sys­tem fit in­to the node based graph­ics? I found a so­lu­tion that us­es the ad­van­tages of nodes and works pret­ty fine up till now. I di­vid­ed the par­ti­cle area in the fol­low­ing class­es:

  • Par­ti­cleN­ode: An graph­ics node which isn’t ac­tu­al­ly vis­i­ble, but han­dles life­time of an par­ti­cle and so on. For ac­tu­al­ly draw­ing a bit­map or sim­i­lar to the screen, I would add a SpriteN­ode or some­thing like that to the Par­ti­cleN­odes chil­dren.
  • Par­ti­cleEmit­terN­ode: This graph­ics node can spawn par­ti­cles, set­ting their ini­tial trans­form. This makes it pos­si­ble to cre­ate them at a cer­tain po­si­tion for ex­am­ple.
  • Par­ti­cleSys­temNode: the graph­ics node that han­dles all the par­ti­cles as own chil­dren. This makes them in­de­pen­dent from the emit­ters po­si­tion, so if the emit­ter moves, the par­ti­cles wont all move with it. Par­ti­cleSys­temNode al­so ap­plies the Par­ti­cleAf­fec­tors be­fore the par­ti­cles are drawn.
  • Par­ti­cleAf­fec­tor: this is not a graph­ics node like the oth­er parts of the par­ti­cle sys­tem. This class can change a par­ti­cles at­tributes as wished. You could add a Grav­i­ty­Par­ti­cleAf­fec­tor for in­stance, which changes the trans­form for ex­am­ple.

- My Progress -

I al­most got this sys­tem im­ple­ment­ed and it works great so far. What I am at right now is get­ting the time stuff to work. I will prob­a­bly put a time vari­able in the Ker­nel or so, if Al­le­gro 5 doesn’t have one al­ready. :)

This post was im­port­ed from tum­blr

Tumblr

Archived blog posts from squareys.tum­blr.com.