Howto:Adding Bombable to FlightGear Aircraft

From FlightGear wiki
Revision as of 19:29, 2 October 2011 by Flug (talk | contribs) (created page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to make a FlightGear aircraft work with Bombable.

To make FlightGear aircraft work with Bombable--both as the main aircraft, an AI aircraft, and via Multiplayer (MP)--you need three things:

  • Weapons submodels that report impacts properly
  • A section of code in the load/unload section of the Aircraft's XML files that allow Bombable to initialize and give it information about the aircraft needed to operate as an AI or Multiplayer model
  • A snippet of code added to the aircraft's -set.xml file to allow communication of Bombable information over Multiplayer


Where your aircraft files are

An important detail in getting Bombable to work with aircraft over AI and MP is the directories you store the files in and the names you choose to use for them.

FlightGear stores aircraft and AI aircraft files in at least two different places.

In a typical FG installation, in your FGDATA folder, you will find

* FGDATA/Aircraft
* FGDATA/AI/Aircraft

FGDATA/Aircraft holds files for the main aircraft whereas FGDATA/AI/Aircraft holds files for AI and MP aircraft.

AI/MP aircraft don't have all the features of main aircraft, so you might find the very same aircraft in FGDATA/Aircraft and in FGDATA/AI/Aircraft--but the one in FGDATA/AI/Aircraft will be very stripped down, fewer files, smaller, and less complex.

When building a FlightGear AI scenario, you can specify the exact path and filename of the file FlightGear looks for. You can specify a file in the FGDATA/Aircraft directory, or in the FGDATA/AI/Aircraft, or really anywhere within the FGDATA directory that you like. Examples:

<model type="string">AI/Aircraft/sopwithCamel-Bombable/Models/sopwithCamel-model.xml</model> 

OR

<model type="string">Aircraft/sopwithCamel-Bombable/Models/sopwithCamel-model.xml</model> 

When loading an MP aircraft, FlightGear first looks for the (typically smaller/simpler) aircraft file in FGDATA/AI/Aircraft.

If it doesn't find the aircraft there, it then searches FGDATA/Aircraft.

How FG matches Multiplayer Aircraft with your local AI aircraft models

As of version 2.4.0, FG searches first the AI Aircraft directories, then the Aircraft directories.

It searches for a match by looking for the file with a name exactly matching the MP aircraft's model and if that fails, look for a matching -set.xml file.

The important points for making AI models that will work over MP with Bombable:

  • Make sure the main aircraft and the AI version of the aircraft have the exact same names for the aircraft's model file and the aircraft's -set.xml
  • If you're modding an existing but non-bombable-compatible aircraft, you need to decide whether you're going to leave all the directories, model XML file names, and -set.xml file names the same as the standard flightgear aircraft (leading to possible frustration as your version overwrites existing aircraft files on users hard drivers) OR rename the aircraft's directory, -set.xml file name, and model file name (which means you're going to have to do a bit of work on the aircraft's XML files to make sure everything still works with all those name changes.
  • You can create a separate, stripped down AI version of the aircraft in the FGDATA/AI/Aircraft directory and add the Bombable additions to it (more work for you but smaller/quicker download and easier on the memory and framerate in FG) OR you can simply add all the Bombable additions to the main aircraft directory in FGDATA/Aircraft.

Bombable will work with any of those options--so it is really up to you.