Smoke signals

Posted on 2011-11-23 in Stingray Incursion
Finally, after a bit of a rewrite, the particle system is taking shape.

I initially just set off doing my own thing, using the existing architecture of the game. Things worked... but it looked utter crap. I was initially using an instanced quad, and was about to get into how to billboard it. But it wouldn't have worked. Calculating rotation angles for 600+ particles per smoke plume was always going to be too expensive. Of course, you can argue that you only need to calculate it once because each particle needs to face the same direction. But only if you're viewing it from a horizontal position. Instead I decided to look at the AppHub 3D Particle sample. And boy did that one look pretty damn good.


So I set about rewriting my particle system a bit to make use of the clever ideas implemented in that sample. The circular array instead of a list (must faster). The dynamic vertex buffer instead of an instanced quad. And the vertex shader which does almost all the calculations on the GPU instead of on the CPU. Clever stuff.


There's still one bit of this implementation that I don't quite understand: the way it calculates the actual screen space coordinates of each particle based on the viewport scale (??) and a single position vector. It's something I'd never have thought of in the first place, but using this method evidently requires very little overhead to do billboarding. So I'm quite embarassed to say that at least that bit of code is a straight copy and paste from the sample.


In the end though it's at least looking proper. That said, the first implementation is something I'd want to keep, because there will be use for a system that uses instanced geometry. I'm thinking debris particles when something blows up. That would just look 100 times better using actual models than billboards, and you can do some excellent random rotation per particle.


And lastly, untweaked and not done yet, is the new HUD showing in these screenshots. It's fully integrated with the chopper, and doesn't required the player to move focus from the action in order to see the details. Granted, at some angles it does become less readable, but so far to me that doesn't pose a problem.

Other posts in Stingray Incursion
Yes... there are finally some gameplay elements.
I'm on a roll man! The few vehicles (actors) on my test level are now roving around, following thier randomly generated patrol routes.
So when you're going up a hill, you're going up a hill, right? Not so easy when you're coding it.