Howto:Add wingmen

From FlightGear wiki
Revision as of 21:09, 2 October 2010 by Gijs (talk | contribs) (moved Howto: Add Wingmen to Howto: Add wingmen: No unnecessary capitals in article titles please.)
Jump to navigation Jump to search
B-29s dropping their load.

Military aircraft are rarley seen singly: they usually operate nowadays in pairs or larger formations. The pair is the basic building-block, but historically the "vic" of 3 was also used, until it was realised that this was tactically inflexible, and the pair was adopted instead.[1]

AIWingman is the method in FlightGear whereby one or more aircraft can be added to the main model to build up formations. Thare is a significant framerate cost involved. However, formations of up to 12 aircraft have been tested, and with careful choice of options, and a fairly powerful computer, reasonable frame rates can be achieved, even at KSFO. Wingmen are not AI Aircraft. In the interest of framerate they are in fact a sub-class of slaved objects, with added sinusoidal noise and some simple AI rules. They can be released to act independently in a limited way: they can break and rejoin a formation. 12-Ship Formation video

The formation can be changed by the use of a Nasal script. There is no collision detection or avoidance, so you must avoid flying the wingmen into each other during a formation change. Thare is a significant framerate cost involved. The wingmen can be as simple or complicated as you wish. The ones currently implemented tend to be fully detailed, and can be "ridden". This is uneccesary, but gives a fun viewpoint of the formation.

This howto will explain how to add wingmen to your model

Step 1: creating the wingman

First, you need to create a file with the extension .xml containg at least one <entry> tag within a <scenario> tag. This file can have any name you like, but MUST go into the directory AI with all the existing scenarios. Here is an example taken from the $FG_ROOT/AI/wingman_b29_demo.xml:

 <scenario>
   <entry>
     <name>Wingman-Port</name>
     <type>wingman</type>
     <model>AI/Aircraft/b29/Models/b29-wingman.xml</model>
     <speed>0</speed>
     <life>-1</life>
     <repeat>false</repeat>
     <count>1</count>
     <x-offset>-500</x-offset>
     <y-offset>-500</y-offset>  
     <z-offset>0</z-offset>
     <yaw-offset>0</yaw-offset>
     <pitch-offset>0</pitch-offset>
     <roll-offset>0</roll-offset>
     <formate>true</formate>  
     <submodels>
       <path type="string">/Aircraft/b29/b29-submodels.xml</path>
       <serviceable type="bool">true</serviceable>
     </submodels>
     <coefficients>
       <heading>5.0</heading>
       <pitch>4.0</pitch>
       <bank>4.0</bank>			
       <speed>2.5</speed>
     </coefficients>
   </entry>
 </scenario>

References