No video this time (yet), but I wanted to post to let anyone who is interested know that I have been making some slow progress with BeatPong. I just committed revision 20 which showcases a single particle system that is triggered on a beat.
The new XML beat element format is:
<Beat effect=”smoke” duration=”00:00:05.0000000″>00:00:12.8150000</Beat>
The new effect attribute specifies a name for the particle system, and the duration specifies how long the particle system will be on for. The inner text still specifies the time of the beat. This particular beat would occur at 12.815 seconds into the song, and the smoke effect would last for 5 seconds.
Right now it’s pretty basic… with every beat, if the beat has an effect attribute, a function is called to add the DateTime object which specifies when the specified particle system should stop emitting particles. The times are stored in a Dictionary<ParticleSystem, DateTime> object. The UpdateSmokeParticles() function checks the DateTime for the smoke particle system every time the update runs (60 per second by default in XNA), and if the current time is less than or equal to the end time in the dictionary, it emits a particle. Plain and simple right? I forgot that the emitter is also moved along with the ball, and the ball is made invisible, so you get the effect of smoke coming out where the ball should be.
I’m pretty excited about this, as it lays the framework for other beat triggered events, and it will be the foundation for all the particle effects that need to be beat synchronized.