framingXjake

framingXjake t1_iwqzaw1 wrote

Ahhh I didn't read the very end of it lol. Yeah, but the math is definitely obscure. Like who even thought of the idea of reading a single precision IEEE 754 binary number as a binary integer? That's like reading a German book even though you can only read English, and yet by the end of the book, everything somehow still makes sense.

2

framingXjake t1_iwq8hbj wrote

I believe the game was Quake III Arena, but there was a physics engine gravity problem in the development phase of the game. They needed a way to calculate inverse roots (i = 1/√x) quickly, but couldn't do it since you pretty much always get long ass floating point numbers which aren't very accurate sometimes, especially with roots and fractions. So some guy on the dev team came about some ass-backwards solution that makes absolutely zero sense in any regard, but somehow still worked nearly flawlessly. He fixed the games gravity with math that doesn't make any fucking sense whatsoever. If you scroll through the games code to find these lines of physics engine voodoo fuckery, the dev team left a comment that literally says "what the fuck?" If we can find the dev who solved that problem, maybe we can get him to answer our dark matter questions.

https://medium.com/five-guys-facts/the-fast-inverse-square-root-7f9e1fbaa2d

edit: Correction, the calculation was for lighting and reflection effects. My mistake, I heard most of this story secondhand from a professor I had in college.

6