Talk:COS.DAT

From UFOpaedia
Revision as of 05:01, 22 September 2006 by NKF (talk | contribs)
Jump to navigation Jump to search

I'm surprised X-COM has sines and cosines. The only place I can think that these might be used, is with the construction/presentation of the world globe and related things, perhaps night/day lighting changes and maybe aircraft travel arcs. Thoughts on why they might have trig values? --MikeTheRed 19:29, 21 September 2006 (PDT)

My interest was the Battlescape. (I'm thinking of figuring out the LOS algorithm. There's some definite weirdness since you can reaction-fire on aliens you can't see during your turn.) The numerical approximations could be responsible for the possibility of missing at 100% accuracy reported by NKF. It also could be involved in computing the trajectories of missed shots.

--Zaimoni 12:01 Sept 21 2006 CDT

For the movement of projectiles at particular angles. I'm guessing the game uses fixed velocities, so that's not a problem, but it needs to know were the bullet is going to appear in the next frame update.

Storing all sine and cosine values in lookup tables helps speed up the maths as the computer need not re-calculate everything over and over again. Ye olde Computers of yore did not have math coprocessors, so repeat calculations, particularly slow math routines like trig functions, tended to really bog down the computer. It was much faster to just populate a lookup table and just grab the pre-calculated values.

X-Com, rather than generating the lookup tables at the start of the game, has all the values pre-calculated and stored in a file.

I have the feeling that it's one of the game's trig functions that's causing the problem with CE's blaster bomb bug, but I don't think it's the fault of the Sine and Cos tables.

- NKF