Status of AI in FlightGear: Difference between revisions

Jump to navigation Jump to search
Line 67: Line 67:
     |author=<nowiki>Hooray</nowiki>
     |author=<nowiki>Hooray</nowiki>
     |date=<nowiki>Mon Feb 04</nowiki>
     |date=<nowiki>Mon Feb 04</nowiki>
  }}
}}
{{FGCquote
  |he simplest solution is probably using scripted AI traffic nodes. Note however that AI traffic cannot currently make use of any FDMs (JSBSim/YaSim), instead you need to come up with your own "pseudo FDM" in scripting space.<br/>
<br/>
You might be able to circumvent this restriction by coming up with a separate FDM and communicating with FG using sockets.<br/>
<br/>
We have a number of more or less complex examples for this. $FG_ROOT/Nasal/tanker.nas is the simplest test case you'll find, which basically spawns an "AI tanker" that can be used for refueling purposes. It would be possible to generalize the script some more in order to spawn an arbitrary number of aircraft. Also, you could equip them with a scripted control loop, so that each node can be controlled individually, i.e. by either setting a bunch of properties, or even by issuing ATC instructions.<br/>
<br/>
Curt has recently provided a more complex example.<br/>
The most complex example for this technique is certainly the "bombable addon" which implements "AI bots" entirely in scripting space to provide "dog fighting" support.<br/>
<br/>
I would suggest to search the archives (wiki, forum, mailing list) and look into the aforementioned examples.<br/>
<br/>
Also, you'll inevitably need to look into the Nasal documentation, too: [[Nasal_scripting_language]]
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=146562&sid=5da9333fd84aa2d8c0e6f3235e6acb11#p146562
    |title=<nowiki>Re: Multiple intelligent flyers</nowiki>
    |author=<nowiki>Hooray</nowiki>
    |date=<nowiki>Tue Jan 03</nowiki>
   }}
   }}
}}
}}

Navigation menu