nick and i had been talking about space games (master of orion, space empires, etc) and how most of them use a 2D mapping system. well, if i was ever going to write a 4X space game it would definately have to be set in a 3D environment.
so to see if this was even plausible i spent a weekend and came up with a model of how a 3D galaxy could look. there are a few problems though. first, the stars only spin around the Z (up/down) axis. in reality, i would imagine that stars would spin in a circle with the core in the direct center. this can be shrugged off if you assume that the galaxy is not actually rotating, but standing still while the camera rotates around it. the second major problem is that my galaxy is just stars.. no cool color effects like plasma clouds or huge nebulas. in fact, this is the probably the worst galaxy simulation program ever written. bite me.
i’ve zipped up the complete package for you to download, compile and run. i included the glut files you’ll need, but you might have to put them in the appropriate place on your machine. using opengl also means that i can’t guarantee performance on a machine without a suitable video card.
here is the source and executable: galaxy.zip (102 Kb)
keys
- l/k: rotate the camera
- s/x: speed up/slow down the rotation
- a/z: add or subtract stars from the galaxy
- c: toggle my crappy attempt at color
- esc: quit
- mouse: hold down the right mouse button and drag for camera rotation
screenshots
click to enlarge.



