Difference between revisions of "Talk:COS.DAT"

From UFOpaedia
Jump to navigation Jump to search
m
Line 1: Line 1:
 
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? --[[User:MikeTheRed|MikeTheRed]] 19:29, 21 September 2006 (PDT)
 
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? --[[User:MikeTheRed|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.
 
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.
Line 16: Line 18:
  
 
- [[User:NKF|NKF]]
 
- [[User:NKF|NKF]]
 +
 +
----
 +
 +
It was my impression that all fired weapons travel in a straight line (with the exception of celatid spit). I don't see why you'd need trig for a simple "rise 0.1 and go left 0.2, per tile" (or whatever) velocity. Bullets drop?
 +
 +
However, clearly thrown items and celatid spit (should) use an arc. I had been thinking that too didn't ''have'' to have trig (although it can be used), because one could just start with initial heading and subtract the effect of gravity each tile. Which seemed simpler to me... and X-COM likes to stay simple. Just a guess on my part, though.
 +
 +
Zai, we've seen a lot of small inaccuracies due to integer rounding. I wouldn't be surprised if they are what lead to small surprises on the battlefield. Possibly even the co/sine values themselves get rounded too, "in action". It would be real interesting if you found any mistakes in the co/sine tables.
 +
 +
Does anyone see a need for co/sines, for drawing the globe on the geoscape? I have no idea how they might have programmed it. --[[User:MikeTheRed|MikeTheRed]] 17:24, 22 September 2006 (PDT)

Revision as of 00:24, 23 September 2006

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. To find how much to add to the X, Y and height coordinates, trig functions are used.

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


It was my impression that all fired weapons travel in a straight line (with the exception of celatid spit). I don't see why you'd need trig for a simple "rise 0.1 and go left 0.2, per tile" (or whatever) velocity. Bullets drop?

However, clearly thrown items and celatid spit (should) use an arc. I had been thinking that too didn't have to have trig (although it can be used), because one could just start with initial heading and subtract the effect of gravity each tile. Which seemed simpler to me... and X-COM likes to stay simple. Just a guess on my part, though.

Zai, we've seen a lot of small inaccuracies due to integer rounding. I wouldn't be surprised if they are what lead to small surprises on the battlefield. Possibly even the co/sine values themselves get rounded too, "in action". It would be real interesting if you found any mistakes in the co/sine tables.

Does anyone see a need for co/sines, for drawing the globe on the geoscape? I have no idea how they might have programmed it. --MikeTheRed 17:24, 22 September 2006 (PDT)