Sunday, February 20, 2011

I refuse to say "Let there be light"

...mostly because EVERY tutorial I have read about XNA lighting over the last 3 days have used the line. So I am not, so there! :)

After promising myself not to waste time on point lights, I decided to do point lights. First a comparison...
Basic lighting. Just ambient light.
Bodge lighting. BasicEffect with directional lights simulating point lights.

Point lights via custom shader.

I am quite impressed with the result. I used FXComposer from nVidia to test the shader. FXComposer is excellent and free! It only took about 10 minutes to get the shader working, and 2 coding sessions to get it working in the game...(cue: Benny Hill theme)...

Coding session 1 : After quickly getting the shader written, I put the code into the game...but it doesn't produce a single pixel. After hours of trying to work out why (debug, hardcoding values, etc), I decide to rewrite the C# routine that call the shader....only to find out that the original routine was commented out and not even being called. After uncommenting, I got scenery but it looked wrong.

Coding session 2: I spent another couple of hours going through dozens of sample code and tutorials, only to see code almost identical to mine. Long story short: everyone was wrong :) I changed the length() HLSL function to distance() and all was good. WTF?!? A little bit of tweaking later, and I am happy.

Another thing to note is the new model for DEMII. Its a work in progress, as I move to the final version, prior to animating. A few major things are in the works with the art for the game. Watch this space.

I have also read some papers on RPG level design. Eye opening stuff! It would be easy just to cram repetitive and derivative corridors and rooms just to get it done. It takes effort and thought to make levels good. But I have learnt quite a bit over the last week.

I have been playing some old games for inspiration. Namely, UFO:Enemy Unknown on the PC and Centurions X on the C64. I am considering adding one more major game element. A lot of puzzling bang for very little development time buck. I will then put an end to new things and focus completely on level design.

No comments:

Post a Comment