Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Changes

Jump to: navigation, search

AI Systems

593 bytes added, 18:58, 30 April 2016
m
AI Models
== AI Models ==
Starting with FlightGear version 0.9.4 you can place AI objects in the "FlightGear world". In version 0.9.4 the AI objects can be defined in the preferences.xml file, or in an [[aircraft-set.xml]] file. In later versions they They are defined in a "scenario " XML file. The scenario file must be in the " onlydata/AI" directory. The There are several different types of AI objects you can have are airplanes, ships, thunderstorms, thermals/sinks, static and ballistic objects. === Types of AI Objects ===* aircraft* ship* thunderstorm* thermal* ballistic* static* wingmen AI objects have some things in common: * The have a location in the "FlightGear world", they * They can have an associated exterior 3D model, and they * They can move according to an internal [[Flight Dynamics Model|FDM]] (flight dynamics model). As of now, these  === Selecting Scenarios ===In order to use AI objects are created at simulator start-up by adding some XML code it is necessary to a load one or more scenario filefiles. The scenario There are several ways to select scenarios.* set it in preferences.xml file must be in the data* use commandline parameters* load/unload through AI directory. You select which scenario files you want to use by naming it menu at runtime  ==== Set Scenarios in the preferences.xml file. ====The preferences.xml file has an entry that looks like this (in FlightGear versions newer than 0.9.4, including [[Git]]):
<syntaxhighlight lang="xml">
<ai>
<enabled type="bool">true</enabled>
<scenarios-enabled type="bool" userarchive="y">true</scenarios-enabled>
<scenario>aircraft_demo</scenario>
</ai>
The above bit of XML enables the AI system and selects a scenario file called aircraft_demo.xml.
Notes: ==== Load Scenarios with command line parameters ====* XML tags are case-sensitive.* Introducing certain characters into the XML file, even as part of a comment, will cause the file It is possible to choke. These include &, <, and --load scenarios with commandline parameters.
e.g.: --ai-scenario=aircraft_demo
 
The value of the --ai-scenario parameter is the filename of the scenario xml file in "data/AI" directory.
If necessary the --ai-scenario parameter can be repeated to load multiple scenarios.
 
==== Load Scenarios at runtime ====
In newer FG versions it is also possible to load/unload scenarios at runtime with the menu entry "AI/Traffic and Scenario Settings".
 
=== Scenario File definition ===
The scenario file contains one entry for each AI object. The entry specifies what kind of object to create, what its initial conditions will be, and optionally (for aircraft and ships) a flight plan. The entry for a sailboat could look like this:
<syntaxhighlight lang="xml">
</syntaxhighlight>
Notes: * XML tags are case-sensitive.* Introducing certain characters into the XML file, even as part of a comment, will cause the file to choke. These include &, <, and --. Most of the parameters are self-explanatory. The "type" of object can be one of "aircraft", "ship", "carrier", "thunderstorm", "thermal", "ballistic" or , "static" and "wingman". The rest of the items give the AI object a model, a starting location, and a starting speed and direction. You use the <model> item to give the object any valid exterior model. You can even make the ship look like an airplane if you want! Note that the speed of the AI object is true airspeed, and since AI aircraft and ships don't feel wind or current then this also the ground speed. The "ship" type can also have a <rudder> value specified, which will cause the ship to move in a circle ({{itip|Use small values, five degrees or less, and right rudder is positive}}). Here is an example of how to create an aircraft AI object:
<syntaxhighlight lang="xml">
<!-- puts an A-4 north of KSFO, orbiting at 7000 ft -->
543
edits

Navigation menu