When you turn your spacecraft the stars should seem to rotate around your craft. The center of rotation of the starfield is where the viewer is when the viewer is not moving. As the viewer begins to move, when the viewer turns, the center of rotation of the stars is offset to the left, right, below, and above the craft.
So if you turn left at a certain speed, the stars will start from the left of the screen and rotate into view towards the right side of the screen - if they simply just keep coming at you like a normal starfield, you cannot tell that the spacecraft is turning - unless you have a background bitmap for the sector of space that you are in. Normally the stars start at the center of the screen and move towards or away from the viewer - but when turning/pitching this center ought to change.
Hope this helps.
Thanks for the ideas on how to avoid gimbal lock - I will implement them ASAP. Probably will not use quaternions as I have little or no experience with them.
I did figure out how to get the stars to regenerate.
Code:
for (int i=0;i<NUMSTARS;i++)
{
if (Stars[i].local.z<1)
{
....choose new random x
....choose new random y
Stars[i].local.z=Player.Location.z+random(MAXSTARDIST);
}
if (Stars[i].Screen.x<LEFT || Stars[i].Screen.x>RIGHT || Stars[i].Screen.y<TOP || Stars[i].Screen.y>BOTTOM)
{
...Regenerate a new star (same as above code)
}
}
My thinking here is that no matter how you rotate the viewer - z should always be directly in front of the viewer - this would make it easier to determine where to regen the stars. So the view vector is rotated to align with the viewers current attitude in 3D space.
The stars are simply pixels right now - billboards seem like overkill just to simulate movement through space. Bitmap Tiling will be used for the backdrop for each system or I might place the viewer inside of a huge 3D cube and texture it like most games seem to have done.