BeatPong beat triggered particle systems

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:
[code language=”xml”]

<Beat effect=”smoke” duration=”00:00:05.0000000″>00:00:12.8150000</Beat>

[/code]
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.

The code can be found here:
http://code.google.com/p/beatpong/source/browse/trunk/Screens/GameplayScreen.cs#210
http://code.google.com/p/beatpong/source/browse/trunk/Screens/GameplayScreen.cs#328

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.

BeatPong gameplay demo

I have been hard at work on BeatPong, recently adding a menu system and a score reading at the top. I took the menu system from an XNA creators club example and adapted it to BeatPong. The example can be found here:http://creators.xna.com/en-US/samples/gamestatemanagement. Obviously, if you download the code as is, you will see that the options menu is completely bogus still, so it’s definitely a work in progress.

I think the coolest thing about how this was integrated is that the menu pause works by pausing the game update method essentially and pausing the music simultaneously. It’s a pretty basic function, but one of those things that just feels great to see in your own project.

Also important to note is that the player 2 paddle (right) is controlled by AI. If the ball is above the paddle, it moves up, and if the ball is below the paddle, it moves down. The speed of the paddle is limited to the same speed as the left side’s paddle, making it possible to score.

Here is the video:
http://www.youtube.com/watch?v=ozl3Xzu7hk8

BeatPong

I’ve been working on a game that, in concept, would synchronize the horizontal velocity of a pong ball to music. The ultimate goal is of course to do this in real time, but for a proof of concept I have started developing the idea with an XML file which signifies the beats of a song. Here is what I have so far:

First video: http://www.youtube.com/watch?v=yyaUibyrigg

Second video:
http://www.youtube.com/watch?v=FadV-tHOkqU

This video shows the ball with a locked vertical velocity for the sake of the demonstration. Prior to making this video, I used the record mode that I made. The song plays in the background, and I hit the spacebar on every beat. All the beats that I laid out with this method were then stored into an xml file (format shown @ http://xml.pastebin.com/f1e5cbe33). This video shows the playback of that XML file while the song plays in the background. Every time the ball hits a paddle, the horizontal velocity is adjusted so that it will hit the other paddle at the time when the next beat occurs.

Up to date code can be found here: http://code.google.com/p/beatpong/

I think it’s pretty slick… I hope others do too 🙂 More to come!