article_type: Tips & Tricks

Guidelines for Working with Text-Based .acf File Formats

The .acf format in X-Plane up to and including version 9 is a binary format; X-Plane 10 switches to a text-based .acf format.  This was done for two reasons:

  1. To reduce the maintenance cost to LR, particularly when adding new features to aircraft.  (It helps that the text file can be inspected by hand when debugging.)
  2. To allow authors to do some very basic editing using tools other than Plane-Maker.

This note describes what kinds of operations on the text file are safe and what are not.

Things you can safely do:

  • Cut and paste blocks of ACF file between aircraft.  You can do this to move a section of information (e.g. all of the /engine/ fields) from one file to another.
  • Apply some simple processing (e.g. search and replace) to parameters, e.g. change all OBJ names within an ACF.
  • Apply some simple changes to the .ACF from a 3-d export script (e.g. add attached objects directly to the .acf from the OBJ exporter).
  • Manage the .acf file with source control.

Things you should not do:

  • Write utilities that edit the .acf as part of an X-Plane add-on.  The format will change over time, so it is important not to leave code in the field that assumes that the .acf format is unchanged.  Pre-process your .acf files “in the studio” but then ship the final .acf files.
  • Merge .acf files in source control.  There are some cases where merging will work, but there are also cases where merging can fail.  Be very careful with merging and check the results of the merge!  Some merges will complete successfully (to the source control application) but cause Plane-Maker to not open the file.
Comments Off on Guidelines for Working with Text-Based .acf File Formats

When to Use Global or Mesh Attributes in X-Plane 10

X-Plane 10 object attributes are properties of an .obj model file that control how drawing looks.  Examples of attributes include:

  • One or two sided drawing.
  • Alpha blending vs. alpha testing.
  • Specular levels (“shininess”).

In X-Plane 10, there are now two ways to set these attributes:

  • “Globally” via a command in the top of the .obj file that affects the drawing of the whole object or
  • “Per mesh” via a command that affects the next set of triangles.  (This is the only way to set these attributes in X-Plane 9.)

Which command should an exporter use?  What is best for performance?  Here are a few guidelines.

  • For scenery: The cost of a global attribute is higher than the cost of a mesh attribute, but you “pay” for a global attribute per .obj file, while you pay for a mesh attribute per placement.  Thus if you ues a single object 10 times (a jetway for example), you pay for a mesh attribute 10 times but a global attribute only once – a big win!
  • If an object will be used multiple times in a scenery system, try to use the global attributes when possible.
  • Try to make all objects that share a texture use the same global attributes. For example, if you have a normal object, every object that uses that normal map should use the same global specular attribute.
  • If an object has multiple attributes (e.g. part of the mesh is blended, part is not blended) try to set the global attributes to match the other objects that use the same texture.
  • For airplanes: global and per mesh attributes have the same cost, so there is no particular performance win or loss.
Comments Off on When to Use Global or Mesh Attributes in X-Plane 10

How To Create a Preview Texture for the Panel in a 3-d Cockpit

A panel is a 2-d screen drawn by X-Plane filled with instruments; you create your panel in Plane-Maker by dragging instruments onto the panel background.

The panel can also be used as a texture for the 3-d cockpit object – in this way elements of a 2-d panel (like a moving map) can be used in the 3-d virtual cockpit.

The panel is drawn dynamically by X-Plane; you can use X-Plane to create a PNG screenshot of your panel for use in your 3-d editor.  The steps are:

  1. Load your airplane in X-plane.
  2. Type control-alt-shift-space (or command-option-shift-space for mac users).
  3. X-plane will put the screenshot in the cockpit_3d/-Panels- or cockpit/panels folder of your airplane with a name “Panel_preview.png”.

Unlike your panel background, this panel will be a snapshot of the “live” panel in X-Plane with instrument moving parts drawn in, and it can be directly used for UV mapping in your 3-d editor.

 

Comments Off on How To Create a Preview Texture for the Panel in a 3-d Cockpit

How to Debug Scenery Pack Loading

What do you do if your scenery simply isn’t showing up in X-Plane?  This article explains some debugging techniques to trouble shoot your package.

X-Plane puts a log file (called Log.txt) into the X-Plane directory; this file is rewritten each time X-Plane runs.  So to use the log file, run X-Plane, go to the airport where your scenery is placed, then quit and do not restart X-Plane.  Now you can view the log.

Did X-Plane Find my Scenery Pack?  In the Right Order?

The first questions to answer are: did X-Plane find my scenery pack?  Is another scenery pack higher priority?  To tell, open the log file and look for the scenery package list – it’s near the top and looks like this:

I found the following scenery packages (prioritized in this order):
  0 Custom Scenery/KSEA Demo Area/
  1 Custom Scenery/KSEA Demo Terrain/
  2 Resources/default scenery/1000 autogen/
  3 Resources/default scenery/1000 decals/
  4 Resources/default scenery/1000 forests/
  5 Resources/default scenery/1000 roads/
  6 Resources/default scenery/1000 urban terrain/
  7 Resources/default scenery/1000 world terrain/
  8 Resources/default scenery/700 roads/
  9 Resources/default scenery/900 beaches/
 10 Resources/default scenery/900 europe objects/
 11 Resources/default scenery/900 forests/
 12 Resources/default scenery/900 roads/
 13 Resources/default scenery/900 us objects/
 14 Resources/default scenery/900 world object placeholders/
 15 Resources/default scenery/airport decals/
 16 Resources/default scenery/airport scenery/
 17 Resources/default scenery/default apt dat/
 18 Resources/default scenery/default atc/
 19 Resources/default scenery/sim objects/

In this case, there are 20 scenery packs – the highest priority one is the “KSEA Demo Area” pack and the lowest priority one is “sim objects.”  If your scenery pack is not listed, it is not in the Custom Scenery folder.  If there is another pack with higher priority, you may need to rename it to be earlier in the alphabet.

Did X-Plane Load My DSFs?

Every time X-Plane loads a DSF, it puts out a log message.  This is why it is important to go somewhere in your scenery’s area, e.g. to an airport.  Here is the log for the airplane starting at KSEA:

0:00:00.000 I/SCN: DSF load time: 701866 for file Custom Scenery/KSEA Demo Area/Earth nav data/+40-130/+47-123.dsf (0 tris)
0:00:00.000 I/SCN: DSF load time: 5123485 for file Custom Scenery/KSEA Demo Terrain/Earth nav data/+40-130/+47-123.dsf (243770 tris)

Every pack that is loaded is listed – in this case the KSEA Demo Area is an overlay, and the base mesh is loaded next.  Once X-Plane loads a base mesh, no more overlays are loaded.

Possible causes of not loading include the path to your DSF being wrong, and the priority order of the scenery being wrong.

Detailed Error Messages

If there is a problem with your scenery pack, X-Plane will show a dialog box that reads:

Error loading the scenery package:

Custom Scenery/KSEA Demo Area/

The scenery may not look correct.

Please see the log.txt file for detailed error information.

This message will show only once for your scenery pack the first time the error is hit for each session of X-Plane.  The message is simply meant to alert you that the log needs inspecting for problems.

When you open the log file you will find one or more lines like this:

Custom Scenery/KSEA Demo Area/KSEA_objects/DeltaCargo.agp:3:The file has an invalid .agp header.

The log will contain (hopefully) detailed information about the particular files that had problems and what was wrong with them.

Comments Off on How to Debug Scenery Pack Loading