Essential Math Weblog Thoughts on math for games

8/6/2009

Mike Acton Takes on C++ Math Libraries

Filed under: General,Mathematical — Jim @ 11:57 am

A couple weeks ago, Mike Acton, head of Core Technologies at Insomniac (where I’m now working, btw) posted this reaming of some standard C++ math code. I think it’s an excellent read if you’re interested in deeply optimizing your math code, in particular for consoles, and in particular for the PS3.

Of course, posting this at all is a bit uncomfortable from where I’m sitting.  I think it’s safe to say that if you were to compare our library code to what he is, er, analyzing, you’d find some significant similarities. However, our libraries were mainly designed to teach mathematical concepts rather than optimization concepts. As such, you end up with classes that represent mathematical entities, e.g. Planes, Spheres, Lines, etc. and simple code that emphasizes clarity. That said — as Mike’s slides aptly demonstrate — if you’re trying to squeeze every cycle out of the machine there are other ways to organize your data and code, and in fairness we didn’t address that much at all.  In retrospect this was an unfortunate oversight. I’d say more emphasis on optimization would be a good addition to the Third Edition, but I’m not sure what my family would think of another book…

5 Comments »

  1. Nice

    Comment by meysam(Iran) — 12/28/2009 @ 2:26 pm

  2. Hi Jim, I’ve misplaced my second edition cd. Is there some way I can get contents of the cd (feel free to quiz me, to prove I have purchased the book)?

    Comment by Jeff — 10/30/2010 @ 6:03 pm

  3. I think one book, which which I recently bought along with your book, that is suppose to address optimization is called “Real Time Collision Detection”. It deals with methods of determining collisions and how to optimize collision detection. I suppose you could always mention it instead of writing a whole new book, since his book only gives a one chapter review of mathematics and then delves right into collision detection. So it seems as if his book takes over where your book leaves off.

    Comment by Soulsphere — 1/7/2012 @ 12:33 am

  4. Christer’s book is excellent, and does address optimization and floating point issues beyond our book. And our book initially was designed as an introduction to both Christer’s and Dave Eberly’s books, so it does slot in pretty well. That said, as a book for programmers, it would be have been good for us to have spent a little more time on optimization issues even for the basic topics we cover — though perhaps not to the extent that Mike does.

    Comment by Jim — 3/11/2012 @ 11:29 am

  5. Optimization is extremely important, yes, but you can always leave optimization as some sort of future exercise. 😀

    It’s a little weird learning about video game programming, because now I’m starting to understand all the illusions and realize that things aren’t quite what I expected. However, it all makes sense. For instance, perspective is something I didn’t realize had to be specifically implemented by the programmer, but I now understand why it needs to be done.

    Comment by Soulsphere — 8/10/2012 @ 8:24 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress