Limegarden.net Personal site of Wouter Lindenhof

31Mar/100

Nova’s Achilles heel

Nova’s Achilles heel is the math and a lot needs to be improved there. Instead of attempting to improve I thought I would use a high quality math library instead (in this case vmmlib). Using SVN external I added it so that it would automatically fetch the latest version from their SVN and be done with it. Problem is that I’m using DirectX which uses row major matrices and vmmlib was written to be used with OpenGL which uses column major matrices. So after a huge rewrite and removing the old math headers I tried to run Brick and see if it worked, I had hoped that by setting the effect files to use column major matrices I would let it use one system. Seeing the result, it either didn’t work or something else had gone wrong.

I don’t know what exactly went wrong (besides the obvious) but I guess that instead of using another library I just have to finish and improve my own math library. It’s a good thing SVN allows me to revert. :)

A good math library is essential for a game developer. It has to be easy to use and clear but I also want answers on the following questions when I’m using it:

  • When I define a quaternion is it written as W-X-Y-Z or as X-Y-Z-W?
  • Does a multiplication operator between two matrices do a matrix multiplication or an unit multiplication?
  • Also how safe are the functions?
  • How do I prevent hidden cost?
  • And how easy is it to cast from one to another? Vector3<float> to Vector3<int> might seems obvious but it requires code to support it. And I could also cast Vector3 to Vector2.

Then there are the bigger question about optimization, like do we use SIMD or not.

The biggest problem is of course to ensure that all math is correct. Most of the time I use it by instinct, but in this case I actually have to relearn all the math again, double check, ensure that I’m using the right version, triple check. Obviously I experience it as a pain, but it as they say:

No pain, no gain!

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.