Game Development on a New Frontier RSS 2.0
 Thursday, April 03, 2008
Sitting bored in the Data Platform session of Microsoft's Heroes Happen Here conference, I began formulating how my state machine-driven particle system for XNA is going to be structured.  Here is what I've come up with so far:

The ParticleSystem class:  This class will be the top-level system, containing both the state machine that drives the system, as well as performance optimizations for rendering (under the initial assumption that the particles will be rendered as point sprites).  During creation of the ParticleSystem, a maximum number of particles will be specified and a dynamic vertex buffer will be created to arrange for them.  That's the basic rendering part.  The real joy of the system will be in the state machine.....

Every elementary particle state machine will have three basic states: Creation, Processing, and Death.  Every pass through an Update, the particle system will make each particle start at it's current state and run through all the states it possibly can until it is not directed to process another state.  At this point, it stops being processed until the next pass, at which point it starts back at the top of the last state it had entered.  To make this more clear, I'll demonstrate with some pseudocode how the different states work:

Creation:
  - Create the particle.
  - Go to the Process state (and continue processing during this pass).

Process:
  - Check if the particle has reached it's age limit:
       - If so, go to the Death state (and continue processing during this pass).
  - If processing gets this far, the particle's still alive and may perform additional manipulation.  Once it's out of actions to perform, it will stop being processed for this pass and the next pass will start at the top of this state.

Death:
  - Remove the particle (and stops processing).

I'll start pounding out a system for this over the weekend.  I may forgo the point sprites for now in favor of just a quick and dirty normal sprite rendering centered at the particle's location until I get the state machine working.

Cheers!

Devan

Thursday, April 03, 2008 8:13:21 PM (Pacific Standard Time, UTC-08:00)  #    Comments [0] -
XNA
Comments are closed.
Categories
 
 
 
 
 
 
Archive
<November 2008>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2008
Devan Stormont
Sign In
Statistics
Total Posts: 10
This Year: 10
This Month: 0
This Week: 0
Comments: 0
Themes
Pick a theme:
All Content © 2008, Devan Stormont
DasBlog theme 'Business' created by Christoph De Baene (delarou)