Page 1 of 1

Order that Celestia loads files.

Posted: 10.04.2020, 19:01
by LukeCEL
Hi everyone,

In my Celestia intallation, I have a folder in the "extras" directory that contains a bunch of .stc files. However, they are not loaded alphabetically. Why is this?

addonorder.png

By the way, this seems only true of macOS. SevenSpheres reports that on Windows, the .stc files are loaded alphabetically.

Luke

Posted: 10.04.2020, 19:23
by SevenSpheres
Found this on one of Selden's pages:

Celestia tries to load all of the STC, DSC and SSC files that it finds, in that order. The first part of a Catalog file's name also determines the order in which it is loaded. Catalog files of each type are loaded in alphabetical order under Windows. Under Linux and MacOS, however, you can't always depend on this. As a result, it's best to define all stellar objects in a single STC file and all planetary objects in a single SSC file.

Doesn't say why though.

Edit: I'm above 300 posts already???

Posted: 10.04.2020, 19:30
by Gurren Lagann
SevenSpheres wrote:Edit: I'm above 300 posts already???
Congrats! I'm on the forums for over 2 years, and I only have 200+ posts...

But yeah, its kinda weird that selden wouldn't say why that's the case.

Posted: 10.04.2020, 19:39
by onetwothree
No loading order is defined in Celestia itself. Everything depends on how your OS enumerated files.

Posted: 10.04.2020, 21:56
by Lafuente_Astronomy
SevenSpheres wrote:I'm above 300 posts already???

You have yet to beat my 600, not to mention many of the OG's have a thousand posts each

Posted: 10.04.2020, 23:01
by Janus
Exact loading order defined by the combination of OS, Caching, & entries in file system.
Hence there is no method to control, influence or even effect the load order.

I fixed this in one of my mods, (At selden's request.), and I personally prefer it.
Selden if I remember correctly, noted that it is possible for child to load before parent this way.
By loading everything in alphabetical order, the way you name/order the files can be guaranteed to be how it is loaded.
The code I came up with was offered back then, to which I never received a reply, and the offer remains open.
Though it should be cleaned up by a real C/C++ programmer first.


Janus.

Posted: 11.04.2020, 00:41
by LukeCEL
Having add-on files load alphabetically seems to me the most intuitive. At least, I thought they loaded alphabetically when I was doing testing for one of my add-ons.

Janus wrote:I fixed this in one of my mods, (At selden's request.), and I personally prefer it.

Cool! It might be useful for you to show us the code changes, so somebody can clean them up and commit to master at a later time.

Posted: 11.04.2020, 04:01
by Janus
@LukeCel
It took me a while to find it in my backups, but I have it.

However, there have been changes since I made it.
directory.cpp is now fs.cpp, and structured somewhat differently.

I can either post what I did back then, or I can reimplement it, then post the updated code.

Your choice.


Janus.

Posted: 11.04.2020, 16:23
by Janus
Scratch that.

After getting a good look at what has been done, I am rewriting it for my own fork.
The loading routines now use fs::recursive_directory_iterator which makes a very effective random loading order function.
This is the sort of thing I normally remove when I find it, along with any other stateless stuff.
Random loading order is a source of chaos, which makes tracing/troubleshooting very hard.

To be fair though, most of my work is low level, where this sort of high level fluff is just wasted cycles.
It also guarantees you have no way of really knowing what is happening, as it is happening.
Mostly I work in the Mhz range, not Ghz, with KB or MB, not GB, 1 core, not ??? many.
So I am used to thinking in terms of how long is this going ot take, and what else is happening while it does.

I also freely admit to a dislike/mistrust of this sort of 'Trust in the compiler' thinking.
For me, the simpler you can make something, the better.
To me, this sort of abstraction just shoves the complications under the rug.
I have nothing against object oriented programming (OOP) at all.
I use it, more than I like admitting, but it has its place, and filesystem stuff is nominally one of those.
But stateless is never an efficient answer, and seldom traceable.

I will be writing my own alphabetical loading routine.
Once I have it, I will post a build in my forking thread, along with code.
If anyone wants to use it, they are welcome to.
I also renew my warning, I am not a real C/C++ programmer.
So whatever code I post will not be pretty, just functional.


Janus.