Flight Docs: Virtual File System

Overview:
In order to combat some of the issues we saw in FSX with 3rd parties having to modify the same files for their addons as other developers addons, we developed a virtualized file system for Flight. There are also other benefits of this system, such as improved loading times, faster installations, and easier distribution.
The file system in Flight consists of pak files (uncompressed zip files only), and FileLocator.config files. Each DLC\addon as well as the base Flight app generally has a single FileLocator.config file. The FileLocator.config file specifies a set of pak files to load files from, and contains a "VirtualPath" which is prepended to all the files within that pak. the FileLocator.config can also optionally define variables with values that can be shared in multiple places.

Example:
Code:
<?xml version="1.0" encoding="utf-8"?>
<FileLocator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Variable Name="ContentName" Value="World DEM" />
  <MappingEntry LocationType="Zip" PhysicalLocation="Content.pak" VirtualPath="[ContentName]" />
  <MappingEntry LocationType="Zip" PhysicalLocation="Languages\Content.[LocaleName].pak" VirtualPath="[ContentName]" />
</FileLocator>
This FileLocator.config specifies to load two different pak files and place both of their contents under the VirtualPath using the "ContentName" variable. "LocaleName" is a special variable that is defined at runtime based on what language of Flight is installed. There are several other built in variables like this.
So, for example if Content.pak in this example contains a file: "scenery\foo.bar", to Flight the full path of that file will be "World DEM\scenery\foo.bar"

File Replacement\Overrides:
Each DLC\addon can specify a set of other DLC that they depend on. The FileLocator.config files of all DLC are processed in a specific order that is determined by the DLC dependencies. FileLocators of dependencies are always loaded prior to the FileLocator of DLC that depend on them. Each MappingEntry within a FileLocator.config is processed in the order they appear in the file. Using this system, it is possible to override files by placing the newer versions in another pak file and having that pak file be processed after another contining files the same virtual paths.
In the example above, if "Languages\Content.[LocaleName].pak" also contains: "scenery\foo.bar", to Flight the full path of that file will be "World DEM\scenery\foo.bar", and it would override the file that is in Content.pak.

File Removal:
If you override a file with a file that is 0 bytes, Flight treats that as removing the file.

Other:
The FileLocators also support specifying a directory to use, but in the public version of Flight there is special code in the engine to disable loading assets (described in the Asset system) from those folders, so you shouldn't try to use it.

The convention we used on Flight was to make the virtual paths for each DLC start with the DLC name (in this example "World DEM") in order to avoid accidental override of files from other DLC. In cases where you want to override files in another specific DLC we put them in a separate .pak file with the same VirtualPath as the DLC you are trying to override.
 
Top