2014/01/27

miniDoom: In Light of New Events...

Wooo! Real-Life twice-a-year obligations I can use as an excuse to post nothing over! (for now)

Actually, it's not like I haven't been doing anything during this latest exa... excuse period. I was a little burnt out with the polygon/collision detection code, so I've been tinkering with something else. And now, to appease my ego: Let there be LIGHT!



As I usually do, the breakdown:

  • The sprite is that of a new type of Corpsie: The Techie! Saavy players of the DooM series might recognize it as a reference to the orange-jumpsuit-ed zombies in DooM3. I'm rather proud of how creepy it looks despite being a silly big-headed cartoon.
  • The lighting is normal-map based pixel lighting, done by hand, meaning I both coded the algorithm and made the normal maps, pixel by pixel. I'll possibly post a tutorial of sorts on both of them.
  • The light itself in this example is what I call an unidirectional light. It just shines from a general direction, with no falloff. Think of it as sunlight illuminating an entire area, as opposed to a lightbulb that would illuminate a smaller section of an area. Each image has the light rotating over an specific axis, namely: Y, X and Z (Y being the vertical axis, unlike many 3d conventions where Z is the vertical axis).
    I have coded lights with falloff afterwards, though. I'm experimenting with those currently.
  • The animated gifs you're seeing, by the way, are rather heavy, and not very well synch'ed up. Need to work on my gif animation skills, and maybe code a "save to gif" module I could include in the final game so people can actually save replays.

Now, the question some people (those who understand the limitations of Java2d) might have is: How does this code perform?

Original resolution: 320x200

Not very well. The point of this code is more academical than practical. I wanted to code this type of effect myself to better understand it, but I doubt the final game will have this exact code (It will be either heavily optimized, or, most probably, ported to a library that allows interfacing with the hardware). Still, it is pretty encouraging. If something was having me down about the progress was the flat look of the sprites and tiles, but with some lighting they become quite interesting!

Also, sorry for the 2Mb gif... I really need to improve how I create these animations!

Also, I expect lighting to play a major role in gameplay itself.

Link to the tutorial I based my code off of: Shader Lessons 6: Normal Mapping

No comments:

Post a Comment