## Re: [stella] Real 3D Space Calculations

 Subject: Re: [stella] Real 3D Space Calculations From: Chris Wilkson Date: Fri, 24 Aug 2001 15:56:13 -0400 (EDT)
```I'm surprised that no one has mention spherical coordinates yet.

For those who don't know, these consist of 2 angles (theta and phi)
and a radius (r).  They are all referenced to the center of the sphere.
One way to implement it is to have theta and phi range from 0 to 180
degrees (or -90 to +90) and have r range from -x to +x, where x is the
maximum distance.

theta measures the angle from the center.  Looking straight ahead is
zero.  If you nod your head up and down, phi measures that angle.
Again, looking straight ahead is zero.  This gives you vision of the
hemisphere in front of you.  Going on with the example...r measures
the distance from the center of your head.  Positive r is in front of
you, negative r is behind you.

Now, when your ship rotates, all you have to do is add angles...not
multiply.  Of course at some point, you need to convert to screen
coordinates, but this can be done using sine and cosine lookup tables....

-Chris

On Fri, 24 Aug 2001, Glenn Saunders wrote:

> <<
> Even this would be hard, though.  For one, it involves
> multiplication and division of non-power-of-2 numbers,
> and values that won't fit in 8 bits...and that's just
> the beginning...
> >>
>
> Really the best approach is to disassemble Star Raiders for the 400/800.
> It's only 8K.  SR has more accurate pseudo-3D coordinate system than any
> 8-bit space sim I know of outside of Elite, and Elite (as I remember it on
> the Apple II at least) had a really sluggish framerate so I don't think that
> would be a good game to copy.
>
> You could also look at the disassembly of Solaris.  Even though it's behind
> the ship perspective, it's still kinda 3D with the radar and all.
>
>
>
> _________________________________________________________________
>
>
> -
> Archives (includes files) at http://www.biglist.com/lists/stella/archives/
> Unsub & more at http://www.biglist.com/lists/stella/
>

-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/

```