Home | Rules and Guide | Sign In/Create Account | Write a Post | Reddit | | #ludumdare on irc.afternet.org (Info)

Ludum Dare 29 — April 25th-28th Weekend [9 PM EST] — Theme: ??? (Slaughter Ends Soon!)
  • Ludum Dare 29 Compo Begins: in 8 days, 11 hours, 26 minutes, 2 seconds
  • Ludum Dare 29 Jam Begins: in 8 days, 11 hours, 26 minutes, 3 seconds
  • [ MiniLD 50 | Warmup Weekend April 19th-20th | Real World Gatherings | Ludum Deals | Wallpaper ]


    Lighting Asteroids

    Posted by (twitter: @PrePixel_)
    October 22nd, 2012 10:00 am

    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!

    5 Responses to “Lighting Asteroids”

    1. Puzzlem00n says:

      Nice idea, probably a lot better for fps than real time light simulations and normal maps!

    2. 31eee384 says:

      Neat! Could we get a screenshot from in-game to see it in action? Interesting idea.

    3. Jedi says:

      Freakin’ brilliant! Thanks for sharing :)

    4. prepixel says:

      Thanks guys! We’re hoping to post a gameplay video soon, just need to sit down and film the thing. :P 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

    5. nosfer says:

      this is brilliant, just think about possible uses in html5/canvas!

    Leave a Reply

    You must be logged in to post a comment.


    All posts, images, and comments are owned by their creators.

    [cache: storing page]