Hi, I've pushed an improvement to our Nasal script loading process. Should help with some of the issues we recently discussed.
1. Nasal scripts can now be grouped into submodules stored in separate folders (fgdata/Nasal/MyModule/*.nas). This has several advantages: - Better structure. Things like multiplayer, local weather, ... are no longer mixed-up in a single directory. - Better sequence. The Nasal scripts within a directory are loaded in random order. As soon as a script relied on other (basic) scripts, you had to delay initialization, to be sure all dependencies are available. The new subfolders are loaded after the base directory, and all the basic scripts remain in the Nasal root directory. So, submodules can now rely on all the basic stuff (like props.nas, math.nas, debug.nas, gui.nas, ...) to be already present, and don't need to delay anything with timers/listeners - at least not just to resolve dependencies. 2. The submodules are also visible in the property tree below "/nasal". There are properties showing which modules are available and which are loaded. There's also a persistent "enable"-flag for each module, so loading specific modules can be optional now. We could add a generic GUI to enable/disable specific addons. Loading can also be controlled automatically. I've tested loading the multiplayer scripts depending on whether the multiplayer feature is actually enabled. Specific GUIs are also possible of course (such as a loading switch in the local weather GUI). Currently all module loading is done in the start-up phase. But we could easily add listeners to the modules' "enable"-flags though, so that they can be loaded any time - even if they were disabled during start-up (without restarting fgfs). Not loading unnecessary Nasal scripts has performance advantages (see our lengthy 1Hz stutter / garbage collector discussion). Of course, performance improvements would be even higher in the first place, when more bulky/complex things were implemented in... well, I guess that point was pretty clear now... This is the relevant commit: http://www.gitorious.org/fg/flightgear/commit/298f832d4313cdba882ca5a398efdbc7a3599789 Comments welcome. If there are no objections, I'll update fgdata/Nasal shortly, moving some initial modules to separate folders. I've tested this locally with the multiplayer, local weather, wildfire and ATC chatter scripts. cheers, Thorsten ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel