Monday, 21 November 2011

Bugfixes

This weekend, I got to see a legitimate Robot Wars battle at the NEC - two flipper-armed robots throwing each other (and themselves) around. I also saw and spoke to a couple of engineers on the Bloodhound SSC project and saw the vehicle itself.

On the game, instead of coding anything new, I went through some of the very worst bits of my code and carefully removed a few of the worst-offending bugs.

  • The first one was that resizing the window would not resize the stencil buffer, resulting in some fairly unusual artifacts appearing. It took me a fair while to notice that I was actually allocating the buffer twice, and corrected it. Now I have stencils, which makes culling pixels for lighting very easy now.
  • The second one was a silly mistake in how I handled texture path names. I'd been doing it in a silly way (hard-coded slashes, which is death for cross-platform compatibility) - I went through and replaced most of them with the appropriate platform-independent solution. 
  • The final one was a complete pain to find and kill - I found that when changing camera angle with bright lights in the scene, the lights would flicker in a fairly irritating manner. I checked and double-checked my entire lighting code several times, as well as the matrix transformation, before realising that everything was (surprisingly) perfect. The actual issue was that my normal buffer was at too low a precision to make the lights adjust properly over a wide range of viewing angles. Unfortunately, a side effect of increasing the precision is that the lights now take longer to process - now, 800MP would seem to take (very approximately) half a second to run, giving me 16MP to use for lights, not 32MP (which is fair, given that I doubled the bits). It remains to be seen whether changing some of the other calculations (inverse of the matrices, reprojection, etc), lowering precision (8-bit floating not 16-bit floating buffers) and/or constraining the areas will be enough - though there's no reason it shouldn't. 

I also managed to fix George's PS3 for the second time and started work on a super-secret project, which is going to be revealed fairly soon (on or before next week).

No comments:

Post a Comment