[stella] Real 3D Space Calculations

Subject: [stella] Real 3D Space Calculations
From: cybergoth@xxxxxxxx
Date: Fri, 24 Aug 2001 12:35:25 +0200 (CEST)
Hi there!

I think some of you might remember that I first
started doing a game called "Star Fire", when joining
the list. After some tries I stopped it and
thought doing something *simpler* first, which
resulted in Gunfight.

With that almost done, I started thinking 
again about doing Star Fire now.

I already told you about my 2D pseudo approach, but
now I'd just like to know how *real* 3D would work.

So this are more some philosophical "Can it be done"
thoughts. I tell you how far I am with my thoughts,
and maybe the mathematicians here can add things or 
correct me where I'm wrong :-)

Ok. First I thought I'd have a 'space cube' with
256*256*256 possible coordinates.

Now, when any object in the cube would go farther
than 255 it'd reappear at position 0, thus 
having all objects *trapped* within 
this cubeshaped *void*

This'd make three byte per object.

Now, I'd need more information about all these
objects (I call them atoms from now on)

Any atom would've a direction vector and a speed.
I tought I'd do it simple again.

I have Two bytes for all this information.
It is encoded like this

First Byte:

1. Bit + or - movement on the X-Axxis
2-3. Bit speed 0 - 3 on the X-Axxis
4. Bit + or - movement on the Y-Axxis
5-6. Bit speed 0 - 3 on the Y-Axxis

Second Byte

1. Bit + or - movement on the Z-Axxis
2-3. Bit speed 0 - 3 on the Z-Axxis
(4-6. Bit encodes the # & position of atom copies,
 we might need that later :-))

This leaves 4 Bits unused at the moment,
Maybe they'd be of use for something...

So in summ I'd have 5 Byte per atom in my
space cube.

(I'd need another 5 Byte for each enemy shot,
 if I'd track it with this sytem for example)

Now, from here on I'd need help:
(Here's your homework for the weekend: :-))

(All these questions are related to 8-Bit processing
 with our 6507, I'm _not_ asking how this'd be done
 _normally_ :-))

Would I put the (0/0/0) Spot in the absolute center 
(i.e. the coordinates would range from -127 to +128)
or in one of the corners (As said above with linear
coordinates from 0 - 255)?

Would I put my own ship at (0/0/0) or would it float
around as an atom as well?

Can anybody give me some math theory in what'd be the
easiest way to calculate which enemies are in sight
and how far they are (based on the above descissions)
(I'd need three extra bytes here, for the 
 screen x-y coordinates and the size as well I assume?
 That'd make 8 bytes per enemie in eye-sight and 5 for any
 enemie behind me, right? Phew...)

Ok, that's it for a start. I didn't say that I'm gonna
do it in real 3D, I'd just like to learn how it would be
done. So all of this is a theoretically brain-thing,
just in case :-)

Feel free to post any thoughts, math, 6507 code whatever
that might give any deeper insisight *how* this stuff
would work. Ultra-Quick algrithms, tricks, shortcuts,
ideas to make anything simpler... just contribute
and/or tell me what you think about this 'problem'.

To encourage you more I state here:

"It can't be done!"

(In comp.sys.cbm that works always :-))

     have a nice weekend,

Knaller, Schnäppchen & Specials finden Sie beim Nexgo-Shopping!

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

Current Thread