A lot of the time has been dedicated to analysis of information about stars, their types, spectral classes, magnitudes (luminosity), size and count. It however looks like the source of star counts (ratios of star types in the Galaxy) is not much reliable. Although it gives a small ratio (or percentage) to the largest and most luminous stars, in the end when the numbers are applied to Galaxy parameters, it still results in a huge amount of bright stars within the range of visibility. Normally about 5000 stars should be visible in 360? view, but I am getting more than half million of canditates for visibility. That's really a lot. It looks that I'll need to tweak the percentages a bit (or rather a lot), or ask some experts for some more accurate estimations than those one can find through Google and Wiki.
For now the number of stars is reduced significantly to allow continue of works on the project. After a week spent just by reading materials and reaching a doubtful results I really needed to take a rest and code a bit. Star generator has been modified from generating absolutely random stars into generating of stars of specific type and spectrum.
So far the recognized star types are:
- Hypergiants (class 0),
- Supergiants (class I),
- Bright Gaints (class II),
- Giants (class III),
- Subgiants (class IV),
- Dwarfs (class V),
- Subdwarfs (class VI),
- White dwarfs (class VII).
Spectral classes ranges from
- red M (<3700 K) and K (3700-5200 K),
- yellow G (5200-6000 K), F (6000-7500 K),
- white A (7500-10,000 K),
- to blue B (10,000-33,000 K) and O (33,000 - 52,000 K).
A magnitude (luminosity) based on real data is assigned to the star by its type and class. This says from how far the star can be seen. Dwarfs are the faintest, giants a middle ranged, and hypergiants the most visible stars. Also a red (cooler) star is less visible than blue (hotter) star. From the previous preview the stars changed a lot in their size. From oversized blobs they were scaled down to their real size and also a fading of distant stars has been implemented to prevent their sudden pop up.
Basics for adding planets to these generated stars have been laid as well. Generating of planetary systems seems to be the next step, but for now a planet is at each star to avoid searching for a star among thousands that is so lucky that it was granted a planet by the generator.
The last delay of this entry was caused by a need of textures to show you a bit better looking images. Instead of propagating a bunch of textures from upper layers down to generated stars and planets, a texture manager has been made. Only a reference to this manager is passed to object which then use it to ask for any texture it may need.
Here is a video of a planet orbiting a small dwarf star. The orbit is now very fast because of testings. In final it will be much slower, nearly static. The time is expected to flow just about 12x faster than in real, so Earth in StarDust would rotate around its axis in 2 hours.
Finally I promissed to somebody explain a bit more how StarDust generates the stars using the new sectors.
It's not in a power of normal home PC to store information about all stars from the Galaxy. Only stars in area of about 5000 ly (light years) around the observer are really interesting at the moment, because these stars can be visible. This area is covered by the largest sector of StarDust (internally called G2-sector). It's a cube of size 5103 light years. But even an area of 5000 ly contains too much stars and vast majority of them is too faint to be visible from large distace. So the generator generates only the largest and brightest stars (Hypergiants and Supergiants) into the G2-sector. Inside of the sector is generated a smaller G1-sector, with a size of 1701 ly. This sector contains smaller and less bright stars that are too faint to be put in the largest sector. However even the G1-sector contains too many stars, and so similar process is applied to it as before. G1 holds bright giants (class II) and the most luminous giants (class III). Smaller stars are generated into a smaller M-Sector (567 ly). This breaking iterates further through S-Sector (189 ly), T-Sector (63 ly) to Base-Sector (21 ly). So each sector type is responsible for generating of stars of only a specific brightness and does not require to be regenerated to bring up smaller stars when player change his position - generating of smaller stars is a task of independent smaller sector.
Each sector in the galaxy is given a unique ID that is used for initialization of random generator. Because the generator is for same sector initialized always by the same ID, it generates for it always same results.
Well, that should basically cover how the star generator in StarDust currently work.
So that's all for now. I hope you liked it. See you with next dev-log.