Creating guided missiles: Difference between revisions

Jump to navigation Jump to search
(→‎Future Plans: http://flightgear.org/forums/viewtopic.php?f=23&t=7791&start=45#p84830)
Line 75: Line 75:


So I am wondering, if we should take a look at the three addons (tanker.nas, fox2.nas, flug's bombable) and come up with a new generic Nasal module for controlling AI objects? Normally, this would be a task for the Nasal library maintainers. But just looking at the three scripts, it should be possible to come up with an API. This would make it easier for other people to reuse your code and create similar addons.
So I am wondering, if we should take a look at the three addons (tanker.nas, fox2.nas, flug's bombable) and come up with a new generic Nasal module for controlling AI objects? Normally, this would be a task for the Nasal library maintainers. But just looking at the three scripts, it should be possible to come up with an API. This would make it easier for other people to reuse your code and create similar addons.
So it is probably a good idea to base such an "ai.nas" module on your code, i.e. simply take a look at your code, generalize and abstract it and put it into a new Nasal module.
Once your own scripts can use that module, we can still look at the other two addons (bombable and local-weather) to see how the ai module needs to be modified to be fully usable by the other scripts.
That in itself should help reduce duplicate code and improve code reuse among Nasal scripts.
Or maybe even help improve such an ai.nas module.
Once we have a working ai.nas module, we could start work on porting all existing addons to start using this module then.
I am really convinced that this is the right thing to do, because it is generally better to look at any large portions of code and see how it can be refactored into distinct reusable components. This is something that has been done rather well with the Nasal standard library in $FG_ROOT/Nasal.
Starting this effort right now would help us combine all related projects and unifying the code.
And I think it is a good idea to do this directly, without bothering the core developers at the moment.
The Nasal library maintainers can still check everything and improve the final outcome once we are satisfied ourselves.
Until then it should be completely possible to sort of have a "peer review" where we review our Nasal scripts and help improve them.
Having a group of volunteers who can read and write Nasal to help review/create new modules would be a good thing, because it would mean less work for the core developers. Especially given the size of the three addon scripts, each of which is more than 100 kb in size if I remember correctly.
With such a workflow, the library maintainers would only get to see reviewed and fixed code.


== Future Plans ==
== Future Plans ==

Navigation menu