This is the game engine overview, in case 
digging into the code isn't very attractive 
to you.

The engine basics are as follows.

The program resolution is 640*480. The player's
ship is placed in the middle of this screen
(320,240), while the Camera x and y variables
change according to the ship's speed and angle.
A part of the screen, enough to fill a 320*240
screen no matter with what angle this part is
rotated(edges mustn't be visible), is captured 
and rotated by the ship's angle. Over this 
rotated screen we paste the ship's sprite and 
any other content that shouldn't be rotated(ship's 
status text, etc.). This rotated screen with the
extra content pasted over it is captured from
160,120 to 480,360(in order to fill a 0,0 to 
319,239 box) and stored into a memory buffer.

In graphic mode 1(Scale2X) this memory buffer is 
pasted in upper-left corner of the screen(0,0) 
and then the content from 0,0 to 319,239 is 
doubled with Scale2X function to cover the 
entire 640*480 screen.

In graphic mode2(Stretch) this memory buffer
is pasted in the center of the screen(320,240)
but scaled by the factor of 2(double). This
mode is slower. We could directly rotate and
scale the screen but this would give us a headache 
in other aspects(like with pasting the remaining 
graphics content over the rotated and already 
scaled screen).

In two players mode all this stuff is put into
a FOR loop going from 1 to 2 and we capture two
screens, but now wide 160 and not 320 pixels, one 
for the first player and one for the second player.

In graphic mode 1 we paste these two screen into
the upper-left corner of the screen, one beside
another(two 160 pixels wide buffers fill a 320
wide box), and then this content is doubled with
Scale2X.

In graphic mode 2 each of these two memory buffers
are placed in the center of one half-screen(x=160 
for player 2 and x=480 for player 1) scaled by the 
factor 2, so that they fill the entire screen.

In two players mode I had to paste the ships'
status text in real size since I failed to
find a way to avoid this.

All the objects in the game need to pasted on
position Object.X - CameraX, Object.Y - CameraY.

Enemy ship AI needs to target the player's 
REAL position which is: 
MainShip.RealX = MainShip.X + CameraX
MainShip.RealY = MainShip.Y + CameraY

MainShip.X and MainShip.X are 310,232 and
they don't change. Just a note that the
center of YOUR sprite must be in 320,240.

For two players mode to work MainShip and
Camera variables must be dimensioned with
two elements so that they can be connected
with a FOR loop like this:

FOR countplayer = 1 TO numofplayers
radangle! = (MainShip(countplayer).Angle* 3.14159)/180
CamX(countplayer) = CamX(countplayer) - MainShip(countplayer).Speed * SIN(radangle!)
CamY(countplayer) = CamY(countplayer) - MainShip(countplayer).Speed * COS(radangle!)
MainShip(countplayer).RealX = MainShip(countplayer).X + CamX(countplayer)
MainShip(countplayer).RealY = MainShip(countplayer).Y + CamY(countplayer)
....

In single player mode numofplayers = 1 so it's
like we don't have a FOR loop at all. In
two players mode numofplayers = 2.

This is just the basics. A lot of nitpicks need
to be done for this to work properly(like
with the AI and similar).


~ Lachie Dazdarian, 18.08.2006