• Create Account

### #Actualepicpunnum

Posted 19 February 2013 - 03:17 PM

To clarify, I felt that a lookup table would be a necessity because:

• More than half of my ingame entities would be using some form of rotation
• Rotation is a key aspect of the gameplay
• Elastic and inelastic collisions are frequent

If I understand correctly, the Math variations on trig functions run an algorithm  to accurately determine it each call. For lookup tables, it only has to run those calculations once for each angle and function (less if you understand the symmetry of the unit circle). So let's assume that you only really need to run 270 (aka 90*3) calls to a trig function and its really accurate algorithm. Because of the high frequency of trig functions in my game, it wouldn't suprise me that at any given time I could be running AT LEAST 50 of these functions on any given frame.

For the record, I honestly don't mind using only integer angles or sacrificing some accuracy. I do most of my away-from-home programming on an outdated netbook (32-bit processor, 2 GB RAM, 1.6 Ghz CPU, >4 years old), where Flash can lag easily. Anything that can optimize calculations is useful for me.

EDIT: Thank you EWClay, that at least addresses the issue of precision. As long as it comes close and there are no discernible differences visually, its fine for me.

### #1epicpunnum

Posted 19 February 2013 - 03:08 PM

To clarify, I felt that a lookup table would be a necessity because:

• More than half of my ingame entities would be using some form of rotation
• Rotation is a key aspect of the gameplay
• Elastic and inelastic collisions are frequent

If I understand correctly, the Math variations on trig functions run an algorithm  to accurately determine it each call. For lookup tables, it only has to run those calculations once for each angle and function (less if you understand the symmetry of the unit circle). So let's assume that you only really need to run 270 (aka 90*3) calls to a trig function and its really accurate algorithm. Because of the high frequency of trig functions in my game, it wouldn't suprise me that at any given time I could be running AT LEAST 50 of these functions on any given frame.

For the record, I honestly don't mind using only integer angles or sacrificing some accuracy. I do most of my away-from-home programming on an outdated netbook (32-bit processor, 2 GB RAM, 1.6 Ghz CPU, >4 years old), where Flash can lag easily. Anything that can optimize calculations is useful for me.

PARTNERS