January 21st 2011
Here’s a quick youtube of some of the ballistic aimbot capabilities of a hack that I am developing for Bad Company 2.
Video has been obsoleted, see the new post for the new one.
The physics and realtime estimation involved is definitely the most interesting part of both the hack and the game itself. DICE did a pretty good job with the Frostbite engine. I’ll admit I got some help trying to simplify the equations of aiming a projectile affected by gravity in 3D at a moving target. In loose terms, my approach is to simplify the “easy” case of aiming a projectile at a stationary target by collapsing the plane parallel to the ground into one dimension, since gravity only acts in the “Y” dimension. This is trivial, and comes easily with the intuition that the yaw (think side-to-side aiming) does not depend on the speed of the bullet or gravity. This leaves us with an equation of the form
at^4 + bt^2 + c = 0
which is easily solved. We then use this t to advance the target, and repeat the previous steps until the discrepancy between steps becomes tolerably small.