Don’t Blow It! – Particles plus

Let’s see what big changes there have been since last time…

First of all, I made a particle engine.  Okay, it sounds like reinventing the wheel, and really… it is.

The fact is, I couldn’t find a free, open-source, cross-platform C++ particle engine that actually worked and was worth using.  At least I had been told that it’s not a tough thing to write if you can keep your head about you.  So, it took me about 3 days of work to write the particle engine of my dreams. 😉  Ha ha, well it is pretty good!  The performance isn’t wonderful (< 100 particles is fine) because I slapped it together with immediate-mode OpenGL.  Also, I only need a 2D particle engine, so that makes the effort a little more focused.  And I don’t have forces yet.  However, it does save to and load from XML and you can evolve every particle parameter.  So it’s mostly functional and definitely useful enough for now.

Of course the goal was to bring the particle engine into Don’t Blow It.  To do that, I needed to break the game for a while…  The camera system was all done explicitly by passing around scroll and scaling parameters to all of the drawable objects.  That is fine if you have to do it (and can keep track of it all), but since changing to OpenGL, I’ve been wanting to pull it all out and make it right.  That’s what I had ahead of me.  There was no way I was going to pollute my beautiful new particle engine with extra parameters all over the place just to pull them out again later, so I started that very important refactoring of the camera code.  I used SDL_gpu’s camera system (an abstraction over OpenGL’s view matrix transforms) to replace the old methods I had used since the game’s 2D framebuffer days.

Eventually, I did finish that transition and now there are nice particles of various types in the game.  There are ambient particles like leaves and dust motes that float by.  Movement events trigger particle emissions, too.  Turning around quickly, jumping or landing cause dust particles to kick up.  Collectables burst into star particles when touched.  It all adds up to a really nice, graphically immersive feeling.

After that, I experimented with a new grab/throw input style.  How would the game feel if you held the “grab” button to hold an object and then released the button to throw it?  Bad, that’s how.  Mostly because of the ease of accidental release and pain for players using a keyboard (due to key ghosting/jamming).

To reinforce tight platforming control, there is now air drag when you release your movement buttons in midair.  The character slows down, making landing on smaller platforms easier.  You don’t have to rapidly press back and forth to keep the character on target as he falls.

The collectables are now animated.  The star collectable spins left and right.  I added candy collectables to replace the stars in the first demo level.  They seem to make more sense in a “party” setting.  The candy bobs and sways, almost in time with the music.

The kids love this.

Levels also now have the ability to load geometry from other files.  I started an object library so all sorts of objects can be instanced this way.  The collectables use it now and it will save a lot of editing time for identical objects.

See ya next time!

Leave a Reply

Your email address will not be published. Required fields are marked *