OXP loading order
Moderators: winston, another_commander
- Phantom Hoover
- Dangerous
- Posts: 100
- Joined: Mon Mar 22, 2010 9:06 pm
OXP loading order
Why, exactly, are OXPs not loaded in any well-defined, user-adjustable order? It would seem like a relatively small change in the code for a great benefit to OXP developers.
Re: OXP loading order
This has been discussed before. There was no deliberate decision made as to why OXPs are loaded in an indeterminate order. They are simply loaded in the order the underlying filesystem APIs give them to the program logic - which tends to differ between platforms.
To change it, we would need to pre-load the OXPs (or the OXP names, or the OXP metadata, depending on the solution we picked), sort it into whatever order makes sense, and then proceed to actually load & initialise the various OXPs.
To change it, we would need to pre-load the OXPs (or the OXP names, or the OXP metadata, depending on the solution we picked), sort it into whatever order makes sense, and then proceed to actually load & initialise the various OXPs.
The glass is twice as big as it needs to be.
- Phantom Hoover
- Dangerous
- Posts: 100
- Joined: Mon Mar 22, 2010 9:06 pm
Re: OXP loading order
Would it be that hard just to add some code to alphabetically sort the contents of the directory?
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: OXP loading order
What are you actually doing that’s load-order dependent?
(By the way, there is no “the” directory.)
(By the way, there is no “the” directory.)
E-mail: [email protected]
- Phantom Hoover
- Dangerous
- Posts: 100
- Joined: Mon Mar 22, 2010 9:06 pm
Re: OXP loading order
Nothing personally, but it seems like a sensible thing to add. Principle of least surprise and all that.
- Cmdr James
- Commodore
- Posts: 1357
- Joined: Tue Jun 05, 2007 10:43 pm
- Location: Berlin
Re: OXP loading order
Submit a patch then :pPhantom Hoover wrote:Would it be that hard just to add some code to alphabetically sort the contents of the directory?
I am not convinced it is a good idea. OXPs should be load order agnostic, and where they depend upon or override each other, this should be explicit, not encoded in file name.
- PhantorGorth
- ---- E L I T E ----
- Posts: 647
- Joined: Wed May 20, 2009 6:48 pm
- Location: Somewhere off the top left of Galaxy 1 map
Re: OXP loading order
Please have look at the wiki page http://wiki.alioth.net/index.php/Handli ... JavaScript that I wrote that goes specifically into that subject.
Phantor Gorth
Phantor Gorth
Chat and relax with other commanders in the [url=irc://irc.oftc.net/oolite]DS's Seedy Space Bar[/url]. The Coolest Bar in the Eight.
Phantor's OXPs: GalCop Rewards and Safe Docking
Phantor's OXPs: GalCop Rewards and Safe Docking
- Killer Wolf
- ---- E L I T E ----
- Posts: 2279
- Joined: Tue Jan 02, 2007 12:38 pm
Re: OXP loading order
why would it make a difference what order they load in? :-/
- Phantom Hoover
- Dangerous
- Posts: 100
- Joined: Mon Mar 22, 2010 9:06 pm
Re: OXP loading order
Because they can override each other. For instance, the orbits OXP has different behaviour if it's loaded before or after farsun.
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: OXP loading order
Orbits and Farsun are both very special cases. Both can cause incompatibilities with other OXPs, so it is to be expected that they may also have problems with each other.
Altering the fundamental aspects of planetary systems in Oolite not only in one, but in two different ways at the same time cannot be guaranteed to work without glitches. So use at your own risk.
If there is JS scripting involved, you may achieve a consistent load order in the way proposed by PhantorGorth.
Altering the fundamental aspects of planetary systems in Oolite not only in one, but in two different ways at the same time cannot be guaranteed to work without glitches. So use at your own risk.
If there is JS scripting involved, you may achieve a consistent load order in the way proposed by PhantorGorth.
- Phantom Hoover
- Dangerous
- Posts: 100
- Joined: Mon Mar 22, 2010 9:06 pm
Re: OXP loading order
Well, alright, but it would be nice if there was a nicer way to express dependencies and conflicts. I mean, there's already a requires.plist in the OXP root directory—why not extend it to express inter-OXP dependencies?
- JensAyton
- Grand Admiral Emeritus
- Posts: 6657
- Joined: Sat Apr 02, 2005 2:43 pm
- Location: Sweden
- Contact:
Re: OXP loading order
Because there’s no good way to reliably identify another OXP without loading and running its scripts. Adding an optional means of identification wouldn’t be a general solution; a mandatory one would break backwards compatibility.Phantom Hoover wrote:Well, alright, but it would be nice if there was a nicer way to express dependencies and conflicts. I mean, there's already a requires.plist in the OXP root directory—why not extend it to express inter-OXP dependencies?
I actually intend to break backwards compatibility in quite big ways in the next development cycle, with a comprehensive solution to expressing dependencies being one minor effect, but it would be crazy to contemplate doing it before MNSR.
Guaranteed lexicographic loading order would be a possible workaround for now, but I find it distasteful because names are for naming and shouldn’t be overloaded with other semantics in user-visible ways. Design is hard, let’s go shopping!
Bonus fact: there is actually a defined partial order on loading, namely:
- Loose files in the app’s Resources directory
- (Mac only) Loose files in ~/Library/Application Support/Oolite/AddOns
- Loose files in AddOns next to the application
- (Except Windows) Loose files in ~/.Oolite/AddOns (Looking at it now, I have no idea why this is 3 while ~/Library is before, but apparently we discussed it in May and only recorded the result)
- OXPs in the app’s Resources directory
- (Mac only) OXPs in ~/Library/Application Support/Oolite/AddOns
- OXPs in AddOns next to the application
- (Except Windows) OXPs in ~/.Oolite/AddOns
- (Mac only, I think) OXPs specified at launch time by opening them in the Finder or through other means
E-mail: [email protected]