Lighting Asteroids
I’m sure this sort of thing has been done in the past but I thought it was pretty cool. Matt suggested early on that we could add some atmosphere to the game by casting light from the ship onto the asteroids. In addition to adding some graphical flair, it could be used to make the game more challenging as distant obstacles would be harder to spot.
I must admit I was initially resistant the idea. Given our limited time I wasn’t sure the extra work was worth the subtle effect it would have on the core game. Also – as any of you that have worked with Android surfaceview will know – there’s only so many pixels you can push to the screen before the framerate starts to take a nosedive. I’ll talk more on that in another post.
After thinking about it for a bit, I decided to spend a little time developing a technique I was using for Badlands (working title!) that screened translucent bitmaps over a sprite to simulate light. Each sprite would be made up of a base layer with no obvious light source, plus four ‘light’ layers, each lit from a different side. Depending on the angle of the light source in relation to the sprite (this is a bit tricky as sprites can rotate), I overlay up to two of these layers on top of the base image – each faded depending on their relative angle. The gif below gives a rough idea of how it looks, it’s actually a lot smoother in-game.
Admittedly, this technique wouldn’t always work (anything with large protrusions would probably look odd), but it works pretty well for our asteroids. It did lower the fps a bit, but I think the effect is worth the hit. I’m still looking into ways of doing this more efficiently – any ideas welcome!

Nice idea, probably a lot better for fps than real time light simulations and normal maps!
Neat! Could we get a screenshot from in-game to see it in action? Interesting idea.
Freakin’ brilliant! Thanks for sharing
Thanks guys! We’re hoping to post a gameplay video soon, just need to sit down and film the thing.
If not, there will probably be a trailer released near the end of the month. It’s hard to appreciate the effect in a static screenshot, but you can sort of see it in this one:
http://twitter.com/PrePixel_/status/257225404228722688/photo/1
this is brilliant, just think about possible uses in html5/canvas!