Acorn Heroes

All aboard the bling train, part one

by on May.21, 2009, under Coding

There’s one type of system that’s present in almost all games, and yet has very little functional value. It’s pure bling. I’m talking about particle systems and, when well designed, they can add greatly to the character and style of a game. When implemented well, a particle system can be applied to a wide variety of effects – rain, fire, explosions, blood, splashes, smoke and even some that might not be so obvious, such as grass or footprints.

Particle systems also lie between the realms of artists and programmers, so they make an appealing option for a company built around two programmers with limited artistic abilities!  So in this article (and the ones that follow on from it) I’ll jump on the bling train and discuss the design, implementation and optimisation of a particle system engine for the iPhone. Here’s my want list of features from a design point of view:

  • The ability to manage a wide range of types of particle systems.
  • Creating a new particle system should require a minimum of coding, and rely on the underlying engine to handle the more mundane tasks, such as rendering, frustrum culling, memory management and so on.
  • Particles should be able to act as emitters, generating new particles (or maybe even entire particle systems?)
  • Rendering should be as fast as is feasible – the more particles we’re able to render, the more we can achieve visually.

From a technical point of view, there’s a lot of issues to address:

  • Designing base functionality that can be easily extended with the minimum of code.
  • Avoiding frequent memory allocation (this can be a significant performance killer).
  • Choosing between point sprites (fast) and textured quads (more flexible).
  • Fast floating point operation – particle systems typically involve massive numbers of vector operations.
  • How to store and hand off data to OpenGL for maximum efficiency - because of a particle systems dynamic nature, we’ll be resubmitting our vertex data every frame.

So, armed with a set of design goals, it’s time to do some hunting around for inspiration.  One of the better articles out there is this one by John Van Der Burg.  Also, Apple offer some handy tips for good OpenGL performance on the iPhone here.  There’s also some useful tips in various Game Programming Gems books.

Wow, look at me still talking when there’s science to do.  I’ll wrap this up here and get some coding done so that I can have something pretty to show off next time…

Share with friends:
  • Print
  • email
  • RSS
  • Facebook
  • Twitter
  • Google Bookmarks
  • Digg
  • Reddit
  • StumbleUpon
  • del.icio.us

Related posts:

  1. Rapid Prototyping Rule #5
  2. Trying Something New
  3. Faerie’s Journey – part 3
  4. Dynamic Lighting Experiments
:, ,

Leave a Reply