GAME JOBS
Contents
Tutorial: Simple, High-Performance Particles for Mobile
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
June 6, 2013
 
Wargaming.net
Build Engineer
 
Virdyne Technologies
Unity Programmer
 
Wargaming.net
Dev-Ops Engineer
 
Gameloft - New York
UI Artist
 
Wargaming.net
Quality Assurance Analyst
 
Wargaming.net
Python Developer
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
June 6, 2013
 
Cracking the Touchscreen Code
 
10 Business Law and Tax Law Steps to Improve the Chance of Crowdfunding Success
 
Deep Plaid Games, one year later
 
The Competition of Sportsmanship in Online Games
 
Gamification, Games, Teams and Competitive play
spacer
About
spacer Editor-In-Chief:
Kris Graft
Blog Director:
Christian Nutt
Senior Contributing Editor:
Brandon Sheffield
News Editors:
Mike Rose, Kris Ligman
Editors-At-Large:
Leigh Alexander, Chris Morris
Advertising:
Jennifer Sulik
Recruitment:
Gina Gross
Education:
Gillian Crowley
 
Contact Gamasutra
 
Report a Problem
 
Submit News
 
Comment Guidelines
 
Blogging Guidelines
Sponsor
Features
  Tutorial: Simple, High-Performance Particles for Mobile
by Itay Duvdevani [Production, Interview, Console/PC]
4 comments Share on Twitter Share on Facebook RSS
 
 
May 20, 2013 Article Start Page 1 of 4 Next
 

When it comes to game development, is there really a silver bullet?  Perhaps, but from what I've found, you have to shoot a lot of bullets and shoot 'em fast.

 We all know that the current mobile casual-gaming world poses many challenges for developers. It's tempting to imagine the game we're working on as the next Angry Birds or Cut the Rope, but that's more like winning to lottery -- we can't really count on it. Managing your investment and risk is distributed among many smaller titles can be a key strategy in determining success.  To do that, we need our game development process to be as efficient as possible.



One of the areas where cost can be managed is graphics. There is no arguing that beautiful results can be achieved in 3D, but that doesn't mean "2D sucks." In many aspects, developing 2D is quicker than 3D: Assets and game engines are quicker to develop, while with a good artistic eye we don't have to settle on "coolness" and the value-to-player.

During my experience at Playscape (formerly MoMinis), we've implemented 2D effects with the most basic building blocks that every 2D engine should offer. But before we go into those, some background:

The Playscape Platform started as a rapid game development platform for J2ME, before the "iPhonedroid" revolution. At the time, the engine was limited to MIDP's capabilities, which included simple bitmap sprites and right-angle rotation.

When the platform was ported to Android (and OpenGL) we decided to preserve simplicity for our game developers, and limit the Android renderer by the same constraints imposed by J2ME.

This was a long time ago.  Since then, J2ME almost disappeared from Playscape's target markets and OpenGL ES became a standard for mobile games.

But even though we ditched J2ME for some time now, we were still bound by the MIDP limitations. This happened mostly due to more pressing business concerning our game development pipeline (we were releasing a new game every two to three weeks).

Eventually, we came to the conclusion we cannot just stop everything to modernize the platform. Instead, we decided on a very limited set of features that every 2D engine should have:

  • Free rotation around a pivot point (with angular speed and acceleration)
  • Free scaling around the same pivot;
  • And color "tinting" -- application of an RGBA color to a texture with MULTIPLY combiner

For portability reasons, these features are implemented on-top OpenGL ES 1.1. Apparently, this is enough for some nice looking particle effects.

Now, let's take a look at some specifics:

Particle Systems

In 3D and 2D, particle systems are used extensively to simulate a variety of physical phenomena and special effects, such as: Fire, smoke, blood, magic, sparks, rain, water, grass and many more.

A particle system is essentially an emitter object, which has shape and size, which creates particles according to certain rules. Each particle that's created receives a variety of attributes form the emitter and environment, such as speed, color progression, direction, rotation and time-to-live.

The idea is to combine and blend many of these basic particles in a way that create pretty and complex effects:

(The above is a single emitter which emits about 40 particles a second, each with a random fade duration, grow, speed and angular speed. Particles fade from opaque-red to transparent-black as their end-of-life approaches. The smoke textures are grayscale, so any smoke color can be generated with the same assets as we MULTIPLY the texture's color).

Illumination and Occlusion

If we keep it simple, a pixel blended to the pixel buffer can either occlude the existing pixel, or illuminate it.

Smoke or blood occludes the scene, while sparks, flames and flares illuminate it. However, a particle system isn't limited to one of these -- consider a torch particle system -- A particle starts as an illuminating particle (flame) but as time progresses it transforms to an occluding particle (smoke). Therefore, we need to support both effects, sometimes in the same particle at the same time. 

 
Article Start Page 1 of 4 Next
 
Top Stories

image
Keeping the simulation dream alive
image
A 15-year-old critique of the game industry that's still relevant today
image
The diversity of game dev students: Who's joining the industry?
image
Amazon launches dedicated indie games storefront
Comments

Nick Ralabate
profile image
What exactly do you mean by each particle's ADD mask? I stared at the example image for a minute, and the edges look about the same softness to me.

Itay Duvdevani
profile image
This can be confusion - I'll try to explain better.

What I meant is that in the ignition stage we've softened the edged of the RGB channel not because we've premultiplied it with the alpha channel (which is all black) - but because we don't want our addition mask to be "sharp".

If we were to set the addition mask (RGB channel) to a single color, we would get a sharp transition on the flame's edge, instead of a soft one - this is different than the third (smoke) particle, which is premultiplied - in the ignition we want to "add less and less" around the edges while in the smoke we want normal occlusion blending.

Tom Hughes
profile image
Super interesting tutorial! I'm going to try it out as soon as I get home from work

Romain Guy
profile image
Just a quick note about Android: the behavior you ran into with premultiplied textures is because all bitmaps are always loaded premultiplied by the platform. It is definitely a problem for games, and not only for the reasons you mentioned here (if you use the 4 ARGB channels and need the RGB data to remain intact – say if you're storing normals for instance –). It's something I would like to fix at some point though. In the meantime, sorry about the inconvenience :)


none
 
Comment:
 




UBM Tech