On the Bodies and Stars issue, I think doctorjoe's idea is not incompatible with conserving memory or keeping star searching up to speed with an octree. I'd agree with him.
For those interested, the star database overhead problem is mentioned in the DEVGUIDE.txt doc that Fridger kindly pointed me to in the celestia root directory of a CVS snapshot.
I'll use something I wrote in topic Physics and Astronomy ?» Light scattering in earthlike atmospheres? (
http://www.celestiaproject.net/forum/viewtopic.php?t=4714) to illustrate why what doctorjoe wrote can work:
At Tue Mar 23, 2004 8:55 pm, Spaceman Spiff wrote:We currently have too little control over defining stars in Celestia to make sensible multiple star systems. Initially, we had to pick up whatever Hipparcos gave us in stars.dat, but this usually gave single star systems. Then we had the Tycho catalogue extend stars.dat, to include wide systems but it has two problems: a) wide binaries/multiples consist of 'fixed' stars the cannot move in orbits; b) entire systems that are close binaries are usually missing - why? - because the stars' fast orbital motions caused Hipparcos to read their positions with larger errors and the catalogue bad-parallax filter rejected them for it. Alula Australis was a perfect example - a naked eye star that 'disappeared' with the Tycho-based stars.dat for being a naughty pair of close binaries. Then we got STC files, but addition of companion stars using STC files still leaves them fixed in space, and addition of stars as 'emissive' planets in SSC files is, well, ugh. Even then, adjacent planets still have a single light source appearance.
So, my proposal on the first step:
We reduce each star system to a single 'invisible' class reference marker to be some median position for that system (e.g., the 4 or 5? stars of the Alula Australis system). To do this, we need to process all stars in the catalogue to derive a median point for each star system - that's the hard bit: Alpha Cen A and B obviously belong together, but do we for example tie Alcor to Mizar or not? Maybe distant companions are better left to drift under proper motion instead.
In the absence of any STC files to define that system's stars, Celestia just uses the Hipparcos/Tycho catalogue 'default' star(s) to render in the sky. Otherwise, if there's a STC file bearing the star system name or HIP name, it takes over. Note that there's no need to consider this reference marker until we 'enter' the system (at whatever 1000 A.U.'s that is), so for distant systems in the sky, we just render the star according to the good old-fashioned catalogue.
The reference marker won't end up being the true barycentre, so we need to be able to specify its offset from that - this can be worked out by knowledge of masses and positions of stars as observed for visual binaries, or totally made up for spectroscopic, hypothetical, fantasy or simply unknowable systems. It may be some tricky 3D geometry, but I'm sure enthusiats will start building up these STCs like people make Add-Ons for anything else. From this barycentre, we can reference the usual Celestia orbits - the kinematic (Keplerian) kinds - and reference further barycentres of further binaries as being in orbit about prior barycentres (like what you did with the Nearby Stars STC/SSC files, Grant). All barycentre, star, and star orbit stuff goes into this STC file.
Then, when we've got the stars in the STC file in the right orbits, we add the planets in SSC files. Planets either orbit a star or a pair of stars' barycentre at a distance, maybe even the main barycentre, maybe even double planets have their barycentre orbit another barycentre. The possibilities are endless! Reference plane for orbit inclination may need a bit of thought.
That, I hope, would at least lay the foundation for multiple star systems in Celestia, even before we start on working out the resultant multiple-source lighting problem. There's also the Roche-lobe star shape problem for close/contact binaries - Beta Lyrae, here we come!
... and to my delight, Chris responded:
chris wrote:The implementation of multiple star systems that I've been playing around with is a lot like what Spiff described.
... and we got to manipulate stars in STC files as well. Selden posted details on Page 2 of topic Celestia Users ?» Celestia 1.4.0 prerelease (
http://www.celestiaproject.net/forum/viewtopic.php?t=6067).
.. and Lo! It was to be in Celestia 1.4.0pre* ever since.
If what doctorjoe is proposing were followed, we could abandon the STCs and the *.stc file extension altogether. This would be good, because the .stc extension unfortunately clashes with the OpenOffice spreadsheet template file extension.
So, we should replace what are referred to as 'stars' in the octree with stellar system 'placeholders'. That's where a new C++ class comes in. All placeholders are rendered as the usual pointlike stars according to the Hipparcos/Tycho catalogue data when outside the current stellar system, because that's how they appear from far away. Upon entering a system, Celestia checks whether there is an existing SSC, if not, it uses that catalogue data to guess the appearance of the star as it does now, otherwise as the star(s) is (are) defined in the SSC. You can form a heirarchy: a main barycentre hangs off the placeholder, the main star(s) hang off that, further stars or planets hang off those, further planets or moons hang off those.
N.B. ideally, the stellar system barycentre is at the placeholder position, or rather, the placeholder is positioned where the stellar system placeholder should end up. That relies on knowing precise masses for real multiple star systems to work out where that barycentre is compared to the stars' current catalogue positions. It might mean someone 'processing' the entire database from 'stars' to 'system placeholders': there's not necessarily a one-to-one correspondence. That's why I talk of a need for a barycentre offset in my quote above.
Another advantage of including stars as bodies inside SSCs is that their orbits will now be drawn, for example, the orbits of Alpha Cen A and B are currently not, nor are those for barycentres. Barycentres should also be a subclass of Body, yet invisible, but with orbits.
Some consideration might need to be made for wide multiple star systems visible from current stellar system. I do not know whether any nearby stars (say within 10 light years of current observer position) can be checked from their SSC files for all bodies that are stars, and rendered from that, and whether this could be done while travelling, or should wait until a stellar system is properly entered.
It seems to me that doctorjoe is very compentent at C++, and my understanding from here (
http://www.cplusplus.com/doc/tutorial/) is that it is a low-level language and the things doctorjoe says seem to be exactly those recommendations made about how to write C++ for best system/memory resources usage. I think following such ideas would be a good way forward.
Of course, abandoning STCs would be more likely to create reverse imcompatibility than class architecture changes (I think?), which means a Celestia version 2.0 step. This does not mean a fork, but a fork could bring this about.
On the other hand, silly me, that would remove any way of creating fictional star systems.
Perhaps those SSC editors could be revised to read in SSCs, add stars and export SSC and/or XML? Also output a little delta placeholder database for fictional add-ons? No need to duck then, Sirius?
Just my two eurocents.
Spiff.