Order that Celestia loads files.

Have a question about using Celestia? Check here first for FAQs and helpful advice.
Forum rules
Please help to make this forum more useful by checking the FAQs before posting! Keep it clean, keep it civil, keep it truthful, stay on topic, be responsible, share your knowledge.
Avatar
Topic author
LukeCEL
Posts: 373
Joined: 26.09.2017
With us: 7 years 4 months

Order that Celestia loads files.

Post #1by LukeCEL » 10.04.2020, 19:01

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

Avatar
SevenSpheres
Moderator
Posts: 828
Joined: 08.10.2019
With us: 5 years 4 months

Post #2by SevenSpheres » 10.04.2020, 19:23

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???
My Addons: viewtopic.php?f=23&t=19978 • Discord server admin
Celestia versions: 1.5.1, 1.6.1, 1.6.2, 1.7.0, and some unofficial versions like Celestia-ED

Avatar
Gurren Lagann
Posts: 434
Joined: 31.01.2018
Age: 18
With us: 7 years
Location: State of Rio de Janeiro, Brazil

Post #3by Gurren Lagann » 10.04.2020, 19:30

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.
"The tomorrow we're trying to reach is not a tomorrow you had decided on!"
- Simon the Digger
"Nothing is impossible for me, as long I'm determinated to keep moving forward!"
"If other people aren't going to do it, I'm going to do it myself!"
- Me (Gurren)

Current major projects:
- Aur Cir
- Cel+
- Project Sisyphus
- Populating the Local Group
- An galaxy generator

onetwothree
Site Admin
Posts: 706
Joined: 22.09.2018
With us: 6 years 4 months

Post #4by onetwothree » 10.04.2020, 19:39

No loading order is defined in Celestia itself. Everything depends on how your OS enumerated files.

Avatar
Lafuente_Astronomy
Moderator
Posts: 726
Joined: 04.08.2018
Age: 26
With us: 6 years 6 months
Location: Cebu City, Cebu Province, Philippines
Contact:

Post #5by Lafuente_Astronomy » 10.04.2020, 21:56

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
Official Administrator of the Celestia Discord Server.
Invite: https://discordapp.com/invite/WEWDcJh
If you don't have a Discord account, register here: https://discordapp.com/register
Have a blessed day.

Janus
Posts: 537
Joined: 13.08.2016
With us: 8 years 6 months

Post #6by Janus » 10.04.2020, 23:01

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.

Avatar
Topic author
LukeCEL
Posts: 373
Joined: 26.09.2017
With us: 7 years 4 months

Post #7by LukeCEL » 11.04.2020, 00:41

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.

Janus
Posts: 537
Joined: 13.08.2016
With us: 8 years 6 months

Post #8by Janus » 11.04.2020, 04:01

@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.

Janus
Posts: 537
Joined: 13.08.2016
With us: 8 years 6 months

Post #9by Janus » 11.04.2020, 16:23

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.


Return to “Help Central”