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.
Topic author
Posts: 359
Joined: 26.09.2017
With us: 3 years

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?


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


Posts: 463
Joined: 08.10.2019
With us: 1 year

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 • Contributing to development as much as I can • Discord server admin
PC specs: HP desktop, Windows 10 Home 64-bit, Intel Core i7-7700 (3.60 GHz), 16 GB RAM, 1 TB HDD + 128 GB SSD, Intel HD Graphics 630
Celestia versions: 1.5.1, 1.6.1, 1.6.2 (primary), 1.7.0 (latest build + some older ones)

Gurren Lagann
Posts: 281
Joined: 31.01.2018
Age: 14
With us: 2 years 8 months
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

Site Admin
Posts: 510
Joined: 22.09.2018
With us: 2 years 1 month

Post #4by onetwothree » 10.04.2020, 19:39

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

Posts: 723
Joined: 04.08.2018
Age: 22
With us: 2 years 2 months
Location: Cebu City, Cebu Province, Philippines

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.

Posts: 523
Joined: 13.08.2016
With us: 4 years 2 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.


Topic author
Posts: 359
Joined: 26.09.2017
With us: 3 years

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.

Posts: 523
Joined: 13.08.2016
With us: 4 years 2 months

Post #8by Janus » 11.04.2020, 04:01

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.


Posts: 523
Joined: 13.08.2016
With us: 4 years 2 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.


Return to “Help Central”

Who is online