Subject: Re: [stella] Real 3D Space Calculations From: "Roger Williams" <localroger@xxxxxxxxxxx> Date: Wed, 29 Aug 2001 18:41:36 0500 
Polar (or Spherical) coordinates seem to be one of the keys to success.
Absolutely. In order to draw the screen, you must convert everything in the game universe into shipcentered spherical coordinates. This will involve three angles, usually labelled rho, theta, and phi, as well as a radius. (The third angle is the object's rotation, which is trivial in cartesian coords but not in polar.) You can then translate to shipVIEWPOINT spherical coordinates by doing simple addition to rho and theta. You can then locate the object on the screen by treating rho and the arctangent of rho * the radius as polar coords and converting back into cartesian in the screen space. Phi directly tells you the object's rotation as it needs to be plotted, and the polar radius its size. In this coordinate system you can also move and rotate the ship very easily before converting back to spherical.
The more I'm reading about it, the more I think it's doable on the VCS.
The main problem is that all the values are going to have to be 16bit to get the motion smooth enough, and you will need at least 4 16bit random multiplications to do each transform in both directions. That is a lot of uncertain cyclecount code. You might be able to distribute the math across multiple vertical blanks, though.
I have done and tested some 8086 routines that do fast integer trig and polartocart conversions, and I have an old BASIC program that uses them to simulate a roulette wheel (in real time, on a 386DX20, at 640x480). They use MUL and 16bit regs but illustrate the principles; if you want I'll send them along.
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
 Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread 


< Previous  Index  Next > 

Re: [stella] Real 3D Space Calculat, Glenn Saunders  Thread  Re: [stella] Real 3D Space Calculat, Thomas Jentzsch 
[stella] My first (hopefully) finis, B. Watson  Date  Re: [stella] 'Look Ma No Flicker' r, Glenn Saunders 
Month 