[Tech] Musing on VectorStorm lights

So I mentioned earlier that I’ll be adding lighting support to VectorStorm.  This breaks down into a number of little tasks.  In particular:

  • Need a ‘vsLight’ class for setting up and positioning lights.
  • Need to add ‘normal vector’ support to the vsDisplayList and vsVectorBuffer objects.  And, of course, to the vsRendererSimple.
  • Need to add some sort of ‘vsMaterial’ which defines the various color properties of an object to be lit (diffuse, specular, emissive, etc).  I should probably integrate the existing “DrawMode” additive/opaque settings into this class;  that was pretty messy before, and having it all together in a nicely organised vsMaterial class would be good.
  • Need to think about how to specify and enable/disable vsLights.  If I’m going to stay with the current “vsLayer” system, then the lights should be specified on the vsLayer in the same way that the vsCamera and vsCamera3D are.  This approach is very clean and easy-to-understand, but isn’t very flexible.  In real-world games, you often want fancy behaviours like “each object picks the three nearest lights and renders using only them”, or “this light only illuminates the player, not anything else around him”.  These sorts of tricks can’t be done if lights are set on the layer and affect everything within the layer.  To do these types of tricks, you really want the lights to be pushed onto the display list, and popped off again when they’re no longer being used.  Need to think about this some more.

Also, I notice that the “Asteroids” testbed game is still not working quite right, as its objects are trying to move faster than Box2D will allow.  I either need to modify the Asteroids game to bring the scale of the game objects down, or else modify Box2D to allow objects to move faster.

Also also, apologies for two tech posts in a row.  I’m going to have to write something game designery tomorrow to make up for this.  :)