Talk:Initializing Nasal early

From FlightGear wiki
Jump to navigation Jump to search

Brainstorming

  • bootstrapping: there's not just $FG_ROOT/Nasal, but also various XML files that support embedded code -especially GUI dialogs, need to check those, too -maybe via grep/sed to patch them accordingly
  • subsystem-specific fgcommands should also be registered at the subsystem level via ::bind()
  • provide at least two *.boot files, e.g. default.boot and fgcanvas.boot, common code should reside in 'include' files, to be used by any *.boot files
  • check what's needed to disable/hide the GUI for a FlightGear Headless mode
  • once we use separate SGSubsystemGroup instances, we need to edit monitor.nas to support different "root" groups - that's trivial, the PerformanceMonitor allocation should probably happen in SGSubsystemGroup::postinit() though, and not in fgCreateSubsystems() ...
  • for better debugging/troubleshooting and feature scaling, we'll need to expose GL* query functions to Nasal
  • investigate re-implementing the splash screen using Canvas/Nasal
  • all subsystems should expose a signal via their ::init() method, so that listeners can respond accordingly
  • consider exposing SGSubsystem* via Nasal/CppBind for complex systems like Bombable, Local weather, the ND etc?
  • Philosopher mentioned that it'd be kinda cool to provide an example using HLA to do RPC between fgcanvas<->fgfs, this could very well be the foundation for improving FG performance, because Nasal could then be run outside the main loop/process
  • Prepare FGNasalSys to support multiple instances (currently, it's a "broken singleton" by design)


Existing Initialization Scheme

Note  need to track:
  • ctor calls
  • init, postinit calls
  • bind/unbind
  • dtors calls
diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx
index 718e70e..6af89e5 100644
--- a/src/Main/globals.cxx
+++ b/src/Main/globals.cxx
@@ -502,6 +502,7 @@ FGGlobals::add_subsystem (const char * name,
                           SGSubsystemMgr::GroupType type,
                           double min_time_sec)
 {
+    SG_LOG(SG_GENERAL, SG_ALERT, "# Adding: " << name);
     subsystem_mgr->add(name, subsystem, type, min_time_sec);
 }

Subsystem Creation

  1. Adding: terrasync (session-persistent)
  2. Adding: time (session-persistent)
  3. Adding: sound
  4. Adding: prop-interpolator
  5. Adding: properties
  6. Adding: performance-mon
  7. Adding: http
  8. Adding: flight
  9. Adding: environment
  10. Adding: ephemeris
  11. Adding: systems
  12. Adding: instrumentation
  13. Adding: hud
  14. Adding: cockpit-displays
  15. Adding: xml-autopilot
  16. Adding: xml-proprules
  17. Adding: route-manager
  18. Adding: io
  19. Adding: logger
  20. Adding: gui
  21. Adding: Canvas
  22. Adding: CanvasGUI
  23. Adding: ATC
  24. Adding: mp
  25. Adding: ai-model
  26. Adding: submodel-mgr
  27. Adding: traffic-manager
  28. Adding: controls
  29. Adding: input
  30. Adding: replay
  31. Adding: history
  32. Adding: voice
  33. Adding: fgcom
  34. Adding: lighting (session-persistent)
  35. Adding: events (session-persistent)
  36. Adding: aircraft-model
  37. Adding: model-manager
  38. Adding: view-manager
  39. Adding: tile-manager
  40. Adding: nasal

Subsystem Initialization

Reset: cleanup

diff --git a/simgear/structure/subsystem_mgr.cxx b/simgear/structure/subsystem_mgr.cxx
index f9eb752..8cc6692 100644
--- a/simgear/structure/subsystem_mgr.cxx
+++ b/simgear/structure/subsystem_mgr.cxx
@@ -559,7 +559,7 @@ SGSubsystemMgr::remove(const char* name)
   }
   
   _subsystem_map.erase(s);
-  
+ SG_LOG(SG_GENERAL, SG_ALERT, "# Deleting subsystem:" << name);
 // tedious part - we don't know which group the subsystem belongs too
   for (int i = 0; i < MAX_GROUPS; i++) {
     if (_groups[i]->get_subsystem(name) != NULL) {
  1. Deleting subsystem:nasal
  2. Deleting subsystem:prop-interpolator
  3. Deleting subsystem:gui
  4. Deleting subsystem:properties
  5. Deleting subsystem:performance-mon
  6. Deleting subsystem:http
  7. Deleting subsystem:environment
  8. Deleting subsystem:ephemeris
  9. Deleting subsystem:xml-proprules
  10. Deleting subsystem:route-manager
  11. Deleting subsystem:io
  12. Deleting subsystem:logger
  13. Deleting subsystem:controls
  14. Deleting subsystem:input
  15. Deleting subsystem:replay
  16. Deleting subsystem:history
  17. Deleting subsystem:fgcom
  18. Deleting subsystem:flight
  19. Deleting subsystem:systems
  20. Deleting subsystem:instrumentation
  21. Deleting subsystem:xml-autopilot
  22. Deleting subsystem:ATC
  23. Deleting subsystem:mp
  24. Deleting subsystem:ai-model
  25. Deleting subsystem:submodel-mgr
  26. Deleting subsystem:traffic-manager
  27. Deleting subsystem:hud
  28. Deleting subsystem:cockpit-displays
  29. Deleting subsystem:Canvas
  30. Deleting subsystem:CanvasGUI
  31. Deleting subsystem:voice
  32. Deleting subsystem:aircraft-model
  33. Deleting subsystem:model-manager
  34. Deleting subsystem:view-manager
  35. Deleting subsystem:tile-manager
  36. Deleting subsystem:sound

Reset: re-initialization

  1. Adding: sound
  2. Adding: prop-interpolator
  3. Adding: properties
  4. Adding: performance-mon
  5. Adding: http
  6. Adding: flight
  7. Adding: environment
  8. Adding: ephemeris
  9. Adding: systems
  10. Adding: instrumentation
  11. Adding: hud
  12. Adding: cockpit-displays
  13. Adding: xml-autopilot
  14. Adding: xml-proprules
  15. Adding: route-manager
  16. Adding: io
  17. Adding: logger
  18. Adding: gui
  19. Adding: Canvas
  20. Adding: CanvasGUI
  21. Adding: ATC
  22. Adding: mp
  23. Adding: ai-model
  24. Adding: submodel-mgr
  25. Adding: traffic-manager
  26. Adding: controls
  27. Adding: input
  28. Adding: replay
  29. Adding: history
  30. Adding: voice
  31. Adding: fgcom
  32. Adding: aircraft-model
  33. Adding: model-manager
  34. Adding: view-manager
  35. Adding: tile-manager
  36. Adding: nasal

Reposition

Shutdown