Status of AI in FlightGear: Difference between revisions

Line 62: Line 62:
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |date=<nowiki>Wed Aug 28</nowiki>
     |date=<nowiki>Wed Aug 28</nowiki>
  }}
}}
{{FGCquote
  |For starters, I'd suggest to read through these:<br/>
[[What_is_Nasal]]<br/>
[[Nasal_for_C%2B%2B_programmers]]<br/>
<br/>
You'll find a few analogies in those articles - but basically, Nasal scripting works exactly like JavaScript in your browser: it's an embedded extension language, that is integrated into FlightGear as a conventional FlightGear subsystem - during each frame, the Nasal interpreter gets its time slice to process scripts - which is why badly written scripts may slow down the sim and affect frame rate/frame spacing - in addition, Nasal supports dozens of FG-specific extension functions to do various FG-related things - which allows callbacks to be registered in the form of property listeners (which get invoked whenever a property is written to) or via timers (that may expire and trigger a callback). In addition, there's a standard library of Nasal library functions and a plethora of FlightGear-specific modules in $FG_ROOT/Nasal that greatly simplify coding stuff from scratch.<br/>
<br/>
To learn more about timers, see: [[List_of_Nasal_extension_functions#settimer.28.29]]<br/>
[[List_of_Nasal_extension_functions#maketimer.28.29_.28v._2.11.2B.29]]<br/>
<br/>
To learn more about listeners, see: [[Using_listeners_and_signals_with_Nasal]]<br/>
<br/>
You can start playing around with Nasal by using the so called "Nasal Console": [[Nasal_Console]]<br/>
[[File:Nasal_console.png|250px]]
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=190385#p190385
    |title=<nowiki>Re: How would I go about controlling an airplane with nasal?</nowiki>
    |author=<nowiki>Hooray</nowiki>
    |date=<nowiki>Fri Sep 20</nowiki>
   }}
   }}
}}
}}