Aircraft-set.xml: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (Created page with "An aircraft-set.xml file (or *-set.xml file) is the main file that is loaded by FlightGear to load an aircraft. It contains further information to describe the FDM, the 3D models...")
 
mNo edit summary
Line 1: Line 1:
An aircraft-set.xml file (or *-set.xml file) is the main file that is loaded by FlightGear to load an aircraft. It contains further information to describe the FDM, the 3D models involved, Nasal scripts used, cockpit panels, keyboard and joystick bindings, as well as lots of other important information. The aircraft-set XML file is a [[PropertyList XML File]].
An aircraft-set.xml file (or *-set.xml file) is the main file that is loaded by FlightGear to load an aircraft. It contains further information to describe the FDM, the 3D models involved, Nasal scripts used, cockpit panels, keyboard and joystick bindings, as well as lots of other important information. The aircraft-set XML file is a [[PropertyList XML File]].
=== The -set.xml file ===
This is the most important file of a FlightGear aircraft. This is the only file that is read directly by FlightGear. Actually it can be compared with an airport hub (from where flights of a certain airline to all other airports departure and arrive). The -set.xml file leads FlightGear to all files that are needed to simulate the aircraft. The -set.xml file should be stored in the aircraft's root directory (eg. <tt>$FG_ROOT/Aircraft/747-400/</tt>)
==== The -set.xml file gives your aircraft its name ====
The name of the -set.xml file gives the aircraft its official name withing FlightGear--for instance, the name that is used to select that aircraft on the command line when FlightGear is started, and the name that is used to match an aircraft running on one computer with the corresponding multiplayer aircraft shown on a different computer on the multiplayer network.
For instance, if the filename is
  fkdr1-set.xml
Then the command line to start with that aircraft is something like:
  fgfs.exe --aircraft=fkdr1
This naming convention gives you the opportunity to create two (or more) aircraft within one directory--for instance, create versions of your aircraft using two different FDMS, but sharing many or most other features (and .xml files/models):
  fkdr1-yasim-set.xml
  fkdr1-uiuc-set.xml
==== The -set.xml file gives your aircraft its properties ====
Most XML files in FlightGear use the so called [[PropertyList XML File|Property List]] format.
Always begin the -set.xml file with:
<PropertyList>
  <sim>
and close the file with:
 
  </sim>
</PropertyList>
The following tags are to be placed between the <sim> and </sim> tags.
===== <description></description> =====
The text that is to be shown in the aircraft selection dialog of [[FGRun]] and other GUIs.
===== <aircraft-version></aircraft-version> =====
Commonly shows the latest update date.
===== <status></status> =====
The status of the development of your plane. This can for example be used in order to get a list of aircraft with a certain minimum development status by passing the --min-status= parameter to the fgfs executable.
See [[Formalizing Aircraft Status]] for guidelines.
===== <author></author> =====
Place your name(s) here. If multiple people worked on the same aircraft, you can place the specific development area for each person between ( ).
===== <flight-model></flight-model> =====
What FDM system is the aircraft using. Set to 'yasim' for [[YASim]] and to 'jsb' for [[JSBSim]].
==== <aero></aero> ====
The filename of the FDM file, without .xml.
For instance, if your FDM file is sopwithCamel1F1.xml, the aero section would look like:
<aero>sopwithCamel1F1</aero>
You have created this file earlier on at: [[#The .xml file (FDM)]]
==== <splash-texture></splash-texture> ====
Place the location of an image you would like to show during loading of the aircraft. FlightGear will randomly pick one of the generic splashes in <tt>[[$FG ROOT]]/Textures/</tt> when this line is not found in the -set.xml file.
==== <splash-title></splash-title> ====
Adds small text (above the splash texture) to the loading screen.
===== <model><path></path></model> =====
Where to find the model. Could be an .ac file (plain model format) or .xml if you want to have extras like animations etc.
===== <sound><path></path></sound> =====
The path to your aircraft's sound file, do not include if you don't have one. The pitch and volume of the sound is controlled by the xml file and throttle position. If for example you find a nice wav file of the jet engine you're using, you can fix it up with your favorite sound editor so it loops nicely and include that into your model (I've noticed a few models where it can get quite annoying when the loop length is so small you can really notice it) so make it smooth.
For additional information, you'll want to check out <tt>[[$FG ROOT]]/Docs/README.xmlsound</tt>
===== <panel><path></path></panel> =====
Where to find the (2D) panel. We prefer 3D cockpits, which are linked in the model .xml file.
===== <autopilot><path></path></autopilot> =====
Where to find the [[autopilot]] system.
=== Engines/ directory ===
Only required for JSBSim aircraft. In this directory the engine and thruster/propeller files are stored.
=== Models/ directory ===
This directory contains all model related files; such as textures, models and animation files (.xml). In the -set.xml file we've set the path to one .xml file. That file should link (indirect) to each other model file (including a possible 3D cockpit) needed for the plane. The whole plane could be modeled into one file, but most developers prefer to split things up. A cockpit for example can be built up by several files, each existing of just one [[Creating instruments for FG|instrument]] or panel. This way it is easy to (re)move certain parts of the aircraft. You set up your model file like this:
<pre>
<PropertyList>
<path>Aircraft.ac</path>
<model>
  <name>Cockpit</name>
  <path>Aircraft/.../Models/cockpit.xml</path>
  <offsets>
  <x-m> -5.25</x-m>
  <y-m>  0.00</y-m>
  <z-m>  1.30</z-m>
  </offsets>
</model>
<animation>
  <type>rotate</type>
  <object-name>AileronLeft</object-name>
  <property>/controls/flight/aileron</property>
  <factor>-65</factor>
  <center>
  <x-m> 2.09</x-m>
  <y-m>-5.50</y-m>
  <z-m>-1.50</z-m>
  </center>
  <axis>
  <x>1</x>
  <y>0</y>
  <z>0</z>
  </axis>
</animation>
</PropertyList>
</pre>
The cockpit.xml file can contain a similair structure, with all the instruments as seperate models. The amount of models is not limited, nor is the amount of animations.
A detailed article about animating and models can be found in [[Howto: 3D Aircraft Models]].
A common subdirectory is the <tt>Liveries/</tt> one, which holds the livery files. See [[Livery over MP]] for more information about that subject.
=== Nasal/ directory ===
All [[Nasal]] code specific to the aircraft is placed in this directory, with the exception of some system or instrument specific Nasal. If a certain Nasal script is usefull for all aircraft (eg. weather or [[Howto: Multiplayer|multiplayer]] related) it can be placed in the <tt>[[$FG ROOT]]/Nasal</tt> directory. Nasal scripts that are useable on multiple aircraft (eg. [[Howto: Air-Air Refueling|air-air refueling]]) can be found in the <tt>[[$FG ROOT]]/Aircraft/Generic</tt> directory.
=== Sounds/ directory ===
What is an airliner without the sound of its mighty engines, or a glider without the sound of wind blowing around your face? Sounds are quite important to increase the feeling that you are actually into the simulation. In this directory all sound files that are specific for the aircarft are stored. Sounds that can be used on multiple aircraft (eg. the click of a switch or thunder) are available in the <tt>[[$FG ROOT]]/Sounds</tt> directory.
=== Tutorials/ directory ===
A helpfull feature in learning how to start the engines of a plane, flying a basic leg etc. is FlightGears tutorial system. It allows you to create a step by step tutorial that guides the user through a certain procedure. It can even indicate what switches should be pressed!
More about the tutorial system can be found at [[Tutorials]].
== Comments in XML files ==
We can place extra information in XML files, that will be ignored by FlightGear. Such as descriptions and explanations of certain XML markups, changelogs etc.
These will be mainly useful to other developers working with your XML code, for example when updating/maintaining your files, or when borrowing XML code from your work.
<pre> <!-- Last update: 09-10-2007 --></pre>
Beware that certain characters are not allowed within an XML file, even within comments, and will always cause problems.  This include the characters:
  -- < &
More info here: http://wiki.flightgear.org/XML#3._Data

Revision as of 12:57, 7 February 2012

An aircraft-set.xml file (or *-set.xml file) is the main file that is loaded by FlightGear to load an aircraft. It contains further information to describe the FDM, the 3D models involved, Nasal scripts used, cockpit panels, keyboard and joystick bindings, as well as lots of other important information. The aircraft-set XML file is a PropertyList XML File.


The -set.xml file

This is the most important file of a FlightGear aircraft. This is the only file that is read directly by FlightGear. Actually it can be compared with an airport hub (from where flights of a certain airline to all other airports departure and arrive). The -set.xml file leads FlightGear to all files that are needed to simulate the aircraft. The -set.xml file should be stored in the aircraft's root directory (eg. $FG_ROOT/Aircraft/747-400/)

The -set.xml file gives your aircraft its name

The name of the -set.xml file gives the aircraft its official name withing FlightGear--for instance, the name that is used to select that aircraft on the command line when FlightGear is started, and the name that is used to match an aircraft running on one computer with the corresponding multiplayer aircraft shown on a different computer on the multiplayer network.

For instance, if the filename is

  fkdr1-set.xml

Then the command line to start with that aircraft is something like:

  fgfs.exe --aircraft=fkdr1

This naming convention gives you the opportunity to create two (or more) aircraft within one directory--for instance, create versions of your aircraft using two different FDMS, but sharing many or most other features (and .xml files/models):

 fkdr1-yasim-set.xml
 fkdr1-uiuc-set.xml

The -set.xml file gives your aircraft its properties

Most XML files in FlightGear use the so called Property List format. Always begin the -set.xml file with:

<PropertyList>
 <sim>

and close the file with:

 </sim>
</PropertyList>

The following tags are to be placed between the <sim> and </sim> tags.

<description></description>

The text that is to be shown in the aircraft selection dialog of FGRun and other GUIs.

<aircraft-version></aircraft-version>

Commonly shows the latest update date.

<status></status>

The status of the development of your plane. This can for example be used in order to get a list of aircraft with a certain minimum development status by passing the --min-status= parameter to the fgfs executable.

See Formalizing Aircraft Status for guidelines.

<author></author>

Place your name(s) here. If multiple people worked on the same aircraft, you can place the specific development area for each person between ( ).

<flight-model></flight-model>

What FDM system is the aircraft using. Set to 'yasim' for YASim and to 'jsb' for JSBSim.

<aero></aero>

The filename of the FDM file, without .xml.

For instance, if your FDM file is sopwithCamel1F1.xml, the aero section would look like:

<aero>sopwithCamel1F1</aero>

You have created this file earlier on at: #The .xml file (FDM)

<splash-texture></splash-texture>

Place the location of an image you would like to show during loading of the aircraft. FlightGear will randomly pick one of the generic splashes in $FG ROOT/Textures/ when this line is not found in the -set.xml file.

<splash-title></splash-title>

Adds small text (above the splash texture) to the loading screen.

<model><path></path></model>

Where to find the model. Could be an .ac file (plain model format) or .xml if you want to have extras like animations etc.

<sound><path></path></sound>

The path to your aircraft's sound file, do not include if you don't have one. The pitch and volume of the sound is controlled by the xml file and throttle position. If for example you find a nice wav file of the jet engine you're using, you can fix it up with your favorite sound editor so it loops nicely and include that into your model (I've noticed a few models where it can get quite annoying when the loop length is so small you can really notice it) so make it smooth.

For additional information, you'll want to check out $FG ROOT/Docs/README.xmlsound

<panel><path></path></panel>

Where to find the (2D) panel. We prefer 3D cockpits, which are linked in the model .xml file.

<autopilot><path></path></autopilot>

Where to find the autopilot system.

Engines/ directory

Only required for JSBSim aircraft. In this directory the engine and thruster/propeller files are stored.

Models/ directory

This directory contains all model related files; such as textures, models and animation files (.xml). In the -set.xml file we've set the path to one .xml file. That file should link (indirect) to each other model file (including a possible 3D cockpit) needed for the plane. The whole plane could be modeled into one file, but most developers prefer to split things up. A cockpit for example can be built up by several files, each existing of just one instrument or panel. This way it is easy to (re)move certain parts of the aircraft. You set up your model file like this:

 <PropertyList>
 
 <path>Aircraft.ac</path>
 
 <model>
  <name>Cockpit</name>
  <path>Aircraft/.../Models/cockpit.xml</path>
  <offsets>
   <x-m> -5.25</x-m>
   <y-m>  0.00</y-m>
   <z-m>  1.30</z-m>
  </offsets>
 </model>
 
 <animation>
  <type>rotate</type>
  <object-name>AileronLeft</object-name>
  <property>/controls/flight/aileron</property>
  <factor>-65</factor>
  <center>
   <x-m> 2.09</x-m>
   <y-m>-5.50</y-m>
   <z-m>-1.50</z-m>
  </center>
  <axis>
   <x>1</x>
   <y>0</y>
   <z>0</z>
  </axis>
 </animation>
 
 </PropertyList>

The cockpit.xml file can contain a similair structure, with all the instruments as seperate models. The amount of models is not limited, nor is the amount of animations.

A detailed article about animating and models can be found in Howto: 3D Aircraft Models.

A common subdirectory is the Liveries/ one, which holds the livery files. See Livery over MP for more information about that subject.

Nasal/ directory

All Nasal code specific to the aircraft is placed in this directory, with the exception of some system or instrument specific Nasal. If a certain Nasal script is usefull for all aircraft (eg. weather or multiplayer related) it can be placed in the $FG ROOT/Nasal directory. Nasal scripts that are useable on multiple aircraft (eg. air-air refueling) can be found in the $FG ROOT/Aircraft/Generic directory.

Sounds/ directory

What is an airliner without the sound of its mighty engines, or a glider without the sound of wind blowing around your face? Sounds are quite important to increase the feeling that you are actually into the simulation. In this directory all sound files that are specific for the aircarft are stored. Sounds that can be used on multiple aircraft (eg. the click of a switch or thunder) are available in the $FG ROOT/Sounds directory.

Tutorials/ directory

A helpfull feature in learning how to start the engines of a plane, flying a basic leg etc. is FlightGears tutorial system. It allows you to create a step by step tutorial that guides the user through a certain procedure. It can even indicate what switches should be pressed!

More about the tutorial system can be found at Tutorials.

Comments in XML files

We can place extra information in XML files, that will be ignored by FlightGear. Such as descriptions and explanations of certain XML markups, changelogs etc.

These will be mainly useful to other developers working with your XML code, for example when updating/maintaining your files, or when borrowing XML code from your work.

 <!-- Last update: 09-10-2007 -->

Beware that certain characters are not allowed within an XML file, even within comments, and will always cause problems. This include the characters:

 -- < &

More info here: http://wiki.flightgear.org/XML#3._Data