Board index FlightGear Development Tutorials and missions

feature/file management

Interactive in-sim tutorials and missions

feature/file management

Postby Hooray » Fri Apr 25, 2014 5:27 pm

ludomotico wrote in Fri Apr 25, 2014 4:12 pm:Why does your tutorials.nas include functions to manage banners? Since banners are specific to a mission, I think they must be defined in the <nasal> section of the specific mission file, not in the general file. Hoops, on the other hand, seem a generic object useful for many cases and I agree they can be defined in tutorial.nas


I would suggest to keep the amount of custom Nasal code in tutorials very low - any huge amounts of code are a sure "code smell" that the framework isn't yet sufficiently generic and needs to be extended. Things like AI interaction or hoops should preferably be separate Nasal modules (files) that we can either just move into $FG_ROOT/Nasal (or as a submodule), or simply include via io.nas from some other place (load_nasal)

While the tutorial/mission system will need access to such features, those features should not be a part of "just" tutorials, those should really be modules that can be reused in other places. Hoops is one such example - we need to be able to use the code, but it should not be tied/coupled to just "tutorials". Thus, we simply need to use separate files here and make sure that we can include/load and use such code.

The tanker.nas code would be another example here, its features would be immensely useful to the tutorial/mission system, because we could easily create AI traffic and control it - but this should not be tied to "tutorials & missions" obviously.

For starters, and the sake of simplicity, it should suffice to simply maintain such features as separate submodule-files inside $FG_ROOT/Nasal/tutorial, so that things can be more easily refactored later on.

The only thing to keep in mind here is to ensure that such modules are mostly declarative, i.e. do not actually do anything other than provide helper functions and classes, so that these can be easily moved around without any refactoring needed.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11340
Joined: Tue Mar 25, 2008 8:40 am

Re: feature/file management

Postby Hooray » Fri Apr 25, 2014 10:04 pm

ok, I have downloaded Marius_A's package and committed it to a gitorious branch: https://gitorious.org/fg/missions-fgdat ... -integrate:

Some feedback regarding the additions to tutorial.nas:
  • the hoops code should be moved outside the tutorial.nas file, so that it is not specific/tied to tutorials
  • the dragonfly/banner towing code should also be moved to a separate Nasal file in $FG_ROOT/Nasal/tutorial

All the files in $FG_ROOT/Nasal/tutorial will be loaded into the same namespace automatically: http://wiki.flightgear.org/Creating_new ... ub_modules
And once the /loaded/ listener is triggered, everything will be just available

Once the corresponding code is separated, it will be much easier for several contributors to independently collaborate, i.e. fewer merge conflicts because people can work on individual files, less chance for breakage. Also, as long as those files are kept separate, we can easily move them somewhere else later on.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11340
Joined: Tue Mar 25, 2008 8:40 am


Return to Tutorials and missions

Who is online

Users browsing this forum: No registered users and 1 guest