Procedurally generated galaxy (image-heavy)

Miscellaneous Forums/Blitz Showcase/Procedurally generated galaxy (image-heavy)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

500 million unique stars in a couple of hundred lines of code. David Braben did it in the early 90's, and I thought to try my hand at it, too.

Starmap zoomed up on a star sector:


The names of the stars are pseudo-randomly generated out of three syllables glued together. I think I accidentally invented a whole new language.

Zooming out just a little bit...:


A bit more...:


When zoomed out far enough, a galaxy image overlay kicks in with the individual star generator disabled:


One quarter of the entire galaxy:



The starfield density variations are based on a 1024x1024 grayscale image of a real galaxy, NGC 5457, taken by the Hubble space telescope. The algorithm loads and parses the actual image pixel-by-pixel, and the amount of stars generated in any area depends on the brightness of a pixel. Each pixel represents an area of 8x8 star sectors (one of which being highlighted green in the screenshots), so the entire galaxy has some ~67 million star sectors, each having 0 to 63 stars.

Every individual star seen in the screenshots are created on-the-fly while scrolling and zooming the starmap. Scrolling is quite fast even with tens of thousands of generated star blips on the screen.

Here's a small stripped-down Win32 demo of Ananta, featuring only the scrollable starmap and galaxy generator. Everything else in the game has been disabled for the purposes of this demo. Please give it a spin! :)

http://ananta.googlecode.com/files/ananta_procedural_universe_demo_20080518_win32_bin.zip