Advanced Solutions for Flight Simulation

 

The Aircraft Container System

 
In Microsoft-style flight simulators (FSX, ESP, Prepar3D), all aircraft specific files (except for the gauges themselves) are located in a folder generically called the aircraft container.   The aircraft container is just a folder that resides deep inside the folder heirarchy of flight simulator.  The folder heirarchy itself can be a little daunting at times, so let's look at a simplified view of the folder structure so you can see where the individual airplane container folders reside relative to the flight simulator root folder:

 

 

It doesn't matter if you install your flight simulator onto a different drive than the C: drive, or in a different folder than Program Files (x86), or even if you are installing FSX, or ESP, or Prepar3D.  But the layout of the folders inside the simulator root folder must remain intact in order for the simulator to operate properly.

A Single Aircraft Container - The Cessna 172

For the remainder of this guide, we will focus on a single aircraft container.  We will use the Cessna 172 as our example.  If you refer to the folder layout shown earlier, this means we will be looking at the C172 folder.  To simplify our examples moving forward, we will not show the entire heirarchy of folders above the C172.  But just keep in mind that when we are looking at the C172 aircraft container folder, we are already several folder levels down into the simulator's folder structure.

Aircraft Container Folder Layout

Once you've seen one aircraft container folder, you've almost seen them all.   The simulator software expects to find certain files and folders in every aircraft container, named exactly the same way every time.  It doesn't matter if you're looking at a C172 or a Boeing 747, the exact same rules apply.     The following image shows the basics of what every aircraft container has inside:



The starting point for looking at any aircraft container is a file called the aircraft config, or aircraft.cfg file.  It may not be at the top of the screen, but this is what flight simulator looks at first when detecting an aircraft.

The aircraft.cfg is a roadmap for everything else in the aircraft container.  You can think of it like a sign outside a building that tells you what offices are inside.  It's just a simple text file that can be viewed with Notepad or any other text editor program.  Some can get quite complex at times, but for now, it's sufficient to understand that the aicraft.cfg tells flight simulator how many different variations exist for this particular aircraft.  

So What Is an Aircraft Variation?

Let's imagine you have a Cessna 172 with a Bendix King radio and no GPS, and another Cessna 172 with twin GNS 430 units.  That's two different variations of the same Cessna 172.     That's what we mean by aircraft variation.  Flight simulator needs to know several things about these aircraft variations in order to be able to depict them in the simulated world.

Don't worry, you don't need to know how to make these in order to modify cockpit panels.  But a basic understanding of these components will help you understand how all the pieces fit together.
 
The Model
 
  First, in order to show the exterior of an airpalne in flight simulator, you need an aircraft model.   Not surprising, there is a folder called model in the aircraft container folder.   The aircraft model is also called the 3D-model because it's a 3-dimensional object in flight simulator.  Unlike a 2-dimensional image like a photograph, you can move "around" a 3D model.  You can look at it from above, below, from the side, from the front, and so forth.   A model is designed by an artist using a CAD system (computer-aided design).  For the most part, being an artist working as an aircraft modeller is like working with clay.  There are no colors, no moving maps, no flight behavior, just a 3-dimensional shape floating in space.   Without any of the other parts of an aircraft container, a 3D model would look something like this:  

Example of a 3D Model

 
 
The Texture
 

Next, we need a paint job.  This is called the texture.   (Notice the appropriately named texture folder in the aircraft container folder.)  The texture is an bizarre looking thing by itself.   It's just a collection of 2-dimensional images clumped together in a file.   A texture looks something like this:  



Example of a Texture File
  
  When the flight simulator does its magic, it "wraps" the 2-dimensional texture images around the 3D model so that you get a much more realistic looking airplane in the simulated world.   This wrapping process is also called skinning or repainting by some artists.   
 
Sounds
 
  Next we need to think about whether this airplane makes any sound, right?  Well you guessed it, sound files that are specific to this airplane can be stored in the sound folder in the aircraft container.  The sounds are just WAV files created by any number of tools used by sound editors.  
 
Aerodynamics
 
  So what about how this airplane flies?  How fast does it go?  How much does it weigh?  This type of aerodynamic information is stored in a special type of flight simulator file called an air file.  If you look at the example of the aircraft container folder, you will see a file named Cessna172SP.air.  This file tells the simulator how this airplane is supposed to fly.
 
Control Panel

  The only remaining thing to talk about in the aircraft control panel.  Again, not surprisingly, there is a folder named panel in the aircraft container folder.  This is where you'll spend most of your time when modifying cockpit control panels, and we will go into this in much more detail in the upcoming sections.


 
A Review - Pulling It All Together

So now you should be able to understand that the aircraft.cfg file tells flight simulator about what model, texture, sound, aerodynamic data, and control panel to use for any particular variation of an aircraft.   You don't need to worry about the details of how it all works.  But you can start to recognize that a wide range of artists and skills are required just to get to this point.   In many cases, the model is built by a one person, the texture is built by a different person, the sounds are recorded and stored by a third person, and the aerodynamic information is collected and entered by yet another person.  Yes, sometimes one person can play multple roles in the aircraft development process, but that simply means one person has developed skills in a wider range of topic areas.   But without the control panel (i.e. the panel folder in the aircraft container), you have nothing but a pretty airplane that flies around and makes some sounds in the simulated world, but with no instruments!  No GPS, no radios, no compass, nothing!  So now you see the massive importance of the panel folder.  So let's dive into the panel folder in much more detail.


The PANEL Folder in an Aircraft Container

Remember how the aircraft.cfg file was a roadmap to the rest of the aircraft container?  Well, in that same way, a special file called the panel.cfg (panel config) is a roadmap to the instruments on the cockpit control panel.   The panel folder is useless without a panel config file, and every panel folder must contain a panel.cfg in order to function in flight simulator.

The panel.cfg file is just a text file.   It can be edited with Notepad.  It is where the size and location of all instruments on the control panel are specified for both the 2D and 3D cockpits.  The instruments are also called gauges, and we will use this word gauges in the remainder of this guide to refer to every cockpit instrument.  An airspeed indicator is a gauge.  A GPS is a gauge.  It may also surprise you to find that a light switch is also a gauge.   Everything the pilot interacts with on the cockpit control panel is part of a gauge


The panel.cfg File

The panel.cfg file may look frigtening at first, but when you start to break it down, it's really the same structure repeating over and over again.   If you are familiar with Windows INI files, you will recognize that all config files in flight simulator follow this same structure.  And for flight simulator, there are tools on the market that will help you modify the panel.cfg file visually, meaning you drag gauges around with your mouse instead of working with the details of the panel.cfg file.  But please take a moment to read how this file works, it will make cockpit editing make much more sense.

A panel.cfg file is broken down into "sections".  Each section has a title, followed by some number of additional lines below it.   Sections names are surrounded by square brackets, like this:
 

[section name]


The individual lines inside a section are a name, followed by an '=' sign, like this:


this_value=something

Every panel.cfg file contains the following sections:


[Window Titles]
[Window
##]
[VCockpit
##]
[Default View]
[Views]
 

 
The 2D cockpit in any aircraft is Window #0, so the section in the panel.cfg that defines the 2D cockpit is similarly named [Window00].

Any windows other than #0 are considered popup windows by flight simulator.

If you look at a panel.cfg file at its Window00 section, you will see among other things, a group of lines that start with
gauge=

Here's an example of a 2D panel from the default Cessna 172:
  
Each line that defines an individual instrument starts with the word gauge followed by a 2-digit sequential number and an = sign.    As you can see the first gauge is gauge00, the next is gauge01, etc.  For most purposes, the order is not important, but it is crucial that the numbers not be duplicated inside a particular section.

After the = sign is a very specific order of items.  The format is:

gauge##=GaugeFile!GaugeName, X, Y, Width, Height, [optional 5th parameter]

The GaugeFile refers to a program file.   Unlike normal Windows programs, most gauge files do not end with the extension .exe or .dll, but instead, they traditionally end with the extension .gau.   In the case of the example above, the gauge is cessna.gau (or optionally cessna.dll).   The extension (.gau or .dll) is not required on these lines.

(For the the technical folks reading this guide, a gauge file is actually a DLL, and starting in FSX, developers could name the file with the .DLL extension insted of .GAU, but internally, they are both DLL's).


You can assume the actual file referred to by GaugeFile is located in the gauges folder in the simulator root folder.  We have not discussed this folder yet to avoid confusion, but all you need to know is that most gauges are located in this folder.  

After the GaugeFile is an exclamation point (!), followed by a GaugeName.  A single gauge file (program) may have been developed by the programmer to contain more than one instrument (gauge) inside it.   So  you have to denote both the name of the GaugeFile and the GaugeName on each of these lines in the panel.cfg.

After the gauge file and gauge name are numbers specifying the coordinates  and size of the gauge.  Think back to your geometry class, remember the cartesian coordinate system and the X and Y axes?   X is the location in the left-right direction.  Y is the location in the up-down direction.  Width and Height are self-explanatory.    For flight simulator, an X,Y coordinate of 0,0 is the top left corner of the window.   The X-numbers get bigger as you move to the right, and the Y-numbers get bigger as you move down the screen.
 
 
The Flight Simulator Coordinate System

Selecting the value of the numbers themselves can be a little mysterious because they are based on a position against a background image.  But since so many tools can help you position gauges, and you can always use trial-and-error to position them, there is no need (or time) for us to go into the detail of exactly what those numbers represent.  For more information about that, read the Panels SDK in the simulator documentation.

The Optional 5th Parameter

Most gauge lines in the panel.cfg will include the X, Y, Width and Height parameters, which is four parameters.   Sometimes, you can omit the Height, and flight simulator will figure out what height to use based on the Width you requested.  In other cases you can leave out both the Width and the Height parameters, and flight simulator will use the default size of the gauge.   But the 5th parameter is special.   The more advanced Mindstar Aviation gauges like GPS's make use of the 5th parameter, and it is very important that it truly be the 5th parameter on the line.   This means that if you have chosen to omit the WIdth or the Height, you still need to put the comma on the line so that the 5th parameter appears after the correct number of commas. 

The 5th parameter is defined by the programmer of a particular gauge.  There is no standard way to use it, and it's completely up to the programmer to explain how it should be used with his or her particular gauge software.   We will explain how the 5th parameter is relevant to Mindstar Aviation gauges in a later section.. But for now, its sufficient to understand that there are up to 5 parameters, seperated by commas, on the gauge lines in the panel.cfg.

Popup Windows

In the previous sections, we described how the [Window00] section in the panel.cfg defines the layout of gauges In the 2D cockpit.  All additional [Window**] sections are popup windows.  The title of the popup window is defined in the [Window Titles] section.  That window title is also the name that appears In the flight simulator menubar where you select a popup window to appear.   And if that's not enough, the window number is also used with the shift key during a flight to make that popup window appear and disappear.  For example, Shift+1 toggles Window # 1 on and off during a flight.

The 3D Virtual Cockpit

If you have used flight simulator for a while, you have probably noticed that there are two different "modes" you can display for the cockpit.  The 2D cockpit shows all the instruments flat on the screen without any perspective.  This is the mode that is most appropriate when displaying gauges inside hardware enclosures or in professional flight simulators.  But for home and entertainment use, and for certain professional applications, there is a more immersive mode that lets you look left and right inside the cockpit and see everything as if you were sitting in the pilot's seat.  If you look down, you see the seat; if you look forward, you sed the control panel, and if you look back behind you, you can see the passenger seats.  This is the 3D cockpit, also known as the Virtual Cockpit or VC.

The VC is a combination of two different parts of the aircraft container.  The 3D shapes of the cockpit itself are part of the aircraft model.  It is not something you can edit, it is an integral part of the model stored in the model folder, and only the modeller/artist who created it can change it.    But if the VC is part of the 3D model, and the 3D model has no color until the simulator wraps (skins) it with the images from the texture folder (remember the skinning of the exterior of the airplane), then how is it that we can see these beautiful immersive cockpits in the VC?

It happens because instead of wrapping the VC with simple static images from a texture file, the simulator wraps parts of the VC with the images generated by the gauges themselves.  The bumps and shapes of the 3D model become colored by the gauge image generated by the gauge software.  With proper positioning of the gauges over the 3-dimensional shapes of the model, it makes the gauges appear to be three-dimensional.

At this point, it's important to emphasize that there is nothing 3-dimensional about gauges.  Gauges are always only 2-dimensional flat images.  There is nothing a gauge programmer can do to make a gauge either work, or not work, in the VC.  The ability to incorporate a gauge into the 3D model of the VC is completely dependent on how the person or company created the 3D model.

Will Your Gauge Work In The VC?

We often get questions asking whether our software will work in the VC.  Unfortunately, this is not a question we can answer.  This question needs to be directed to the company or person who created the aircraft model you are using.  We don't (and can't) do anything to prevent our software from being used in the VC.  Your level of success with editing VCs will be dependent on decisions made by the modeller, so please direct VC-related questions to the vendor of your aircraft.

Modifying Gauges In The VC

With all that said, you still have a shot at modifying gauges in the VC.  The layout of the gauges in the VC are controlled by the gauge lines in the [VCockpit**]section of the panel.cfg.  It is best to limit your changes to the VC gauges by replacing one instrument with another of a similar size and shape.  The easiest starting point is to find a gauge made by one manufacturer that you want to replace with the same type of gauge from another manufacturer. 

When you modify the gauge line associated with the gauge you are trying to replace, try to change only the  GaugeFile and GaugeName portion of the line.  Leave the X, Y, WIdth and Height parameters as-is.  This gives you a best first-shot at positioning the new gauge exactly where the old one used to be.  Just remember, if the new gauge requires a different format of 5th parameter, be sure to enter the 5th parameter in the way expected by the new gauge you are trying to use



Additional Panel Configurations In The Aircraft Container

Until now, we have talked about the 2D panel and VC of one particular variation of a Cessna 172.  But what if you want to create a variation of cockpit control panel with a different brand of GPS?  Creating a new cockpit variation is simple.  You just create an additional panel folder with an extension in the folder name.   For example, you can create a folder named panel.1, or panel.new, or panel.mpi_gns.   Anything after the dot in the folder name becomes the "name" of the new panel variation.

The new panel folder must still have its own panel.cfg, but that panel.cfg can be copied from an existing one and modified to suit your needs. 

New Variations In The Aircraft.cfg File
 
Whenever you add a new panel folder, it won't be recognized by flight simulator until you also add a reference to the new panel in the aircraft.cfg file.   Earlier, we described what the aircraft config file is, but we haven't shown it to you until now.  

The aircraft.cfg file is separated into sections, similar to those you saw in the panel.cfg.   But each section in the aircraft config represents a different variation of the same airplane.  Each variation appears in a section with a section title of [fltsim.#]
where # is a sequential number starting at 0, and incrementing forward for each additional variation.

In our earlier examples, we referred to the panel folder (with no extension).  This means the panel has no specific name, so it's considered the default panel.   Look at each variation section in the aircrfaft.cfg shown below.  Notice the line that says panel=.  There is nothing after the = sign, which tells flight simulator that for these variations, it should use the panel folder that has no extension after its name.
 

Example of Aircraft Variations That Use The Default Panel Folder


 


Now imagine if we created a new panel folder named panel.mpi_gns.   In order for that new panel folder to be recognized by flight simulator, we need to add a [fltsim.#] section to the aircraft config that tells flight simulator about our new cockpit vairation.  (see image below).
 

Example of an Aircraft Variation That Uses a Named Panel Folder



Aircraft Variation Titles in AIRCRAFT.CFG

The Title= line in the aircraft must always be unique.  No other aircraft variation can use this name.  But this doesn't mean just inside this particular aircraft.cfg, it means across all variations in all airplanes in the entire simulator.   So for this reason, it's best to make the title something that includes both the airplane and some identifying aspect of the control panel.

It's also good practice to make corresponding changes to the ui_variation and description items too.  This ensures that no matter how you view the airplane in flight simulator, you will see something that clearly identifies what this variation is intended to display.