From FSDeveloper Wiki
Jump to: navigation, search

Compiling Missions and Rewards

Both Missions and Rewards are written as XML files. While missions may be (and usually are) run straight from the XML, rewards must be compiled before they can be used. In short, if you don't use any rewards and don't care about saving a fraction of a second in loading time which the player won't notice anyway because they're reading the mission briefing, stop reading now.

There are two reasons for compiling a mission. First, it makes it rather faster to load. For all but the largest missions though, this isn't going to make much noticeable difference. Second, it makes it a little harder for the unwashed masses to find out your mission-writing tricks because the compiled version can't be loaded into mission editors. However, thanks to the SPB2XML [1] tool it can be converted back to XML.

On the other hand, it can also cause a little confusion for you, the mission designer. You have to keep the original mission XML available, otherwise you can't edit it any more. When you compile your mission though, FSX has two different versions to choose between and it prefers the compiled version. That means that if you compile a mission and then make some more changes, those changes won't appear in FSX unless you delete the compiled version. It's easier to only compile your mission once it's absolutely finished, or to not compile it at all.

Mission Compiler

The mission compiler, simpropcompiler.exe, is part of the SDK. It's located in the "Core Utilities Kit\SimProp" subfolder of the SDK and is a command-line tool. That means that if you double-click it, you'll see nothing more than a brief, black flash.

While it's certainly possible to set it up to work with drag-n-drop operation, there is a significant downside to this. If there are any errors in the XML, you won't see what they are because the DOS box that opens temporarily will close before you can read the error messages. It's better to open a good, old-fashioned DOS prompt.

Unfortunately there are several different paths needed, so the command-line can get rather long. After you've opened the DOS prompt (use Start->Run and type "cmd"), change directory to the folder with the file you want to compile. If you really don't do typing, you can drag the folder from an Explorer window over the DOS window and it will do it for you. Type cd (with the space afterwards) and then drop the folder.

The command you need will be similar to this:

"(Path to Compiler)" 2spb -symbols "(Path to FSX)\propdefs\*.xml" my_file.xml my_file.spb

(Path to Compiler) must be replaced with the path to the compiler, oddly enough. It must include the "simpropcompiler.exe" part. Again, the easiest way to do this is to find it using Explorer and then drag-n-drop simpropcompiler.exe onto the DOS window. The rest of the line gives the compiler instructions.

2spb tells the compiler what to do - that is, compile some XML to spb. -symbols "(Path to FSX)\propdefs\*.xml tells it where to find some important reference data. my_file.xml is the file you want it to compile, and my_file.spb is the file it will create. You need to change (Path to FSX) to wherever you've installed FSX to. If you have a standard installation, this will be:

C:\Program Files\Microsoft Games\Microsoft Flight Simulator X

so the full symbol path will be:

C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\propdefs\*.xml

A full command-line, then, might look like this:

"C:\Program Files\Microsoft Games\Microsoft Flight Simulator X SDK\SDK\↵
  Core Utilities Kit\SimProp\simpropcompiler.exe" 2spb↵
  -symbols "C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\propdefs\*.xml"↵
  my_file.xml my_file.spb

If this works, you will get an SPB file created. There is no 'success' message; if all goes well you will see the normal Microsoft copyright messages and nothing else. If it doesn't compile, you'll get a list of errors and you can use this list to find out what's wrong, and fix it. You can usually try compiling it again by just pressing the up-arrow key and then Enter.


  • 2spb - Compiles an xml file to a .SPB output file, (or produces an error list).
  • validate - Validates an xml file without creating an output file.

Likely Errors

Some of the most common errors are:

  1. Myfile.xml(0) : error 80004005 : Unable to load symbols.
    This means that the path to the symbols - the bit after "-symbols" - was wrong.
  2. MyFile.xml(0) : error 80004005 : Read failed.
    It can't read the XML file you told it to compile. Check that you're in the right directory, and that you've typed the filename correctly.
  3. MyFile.xml(0) : error 80070057 : Write failed.
    It can't write the compiled SPB file. Maybe you've not given it an output filename (the last option).
  4. MyFile.xml(0) : error 80070005 : Write failed.
    It still can't write the compiled SPB file. This usually means that it's tried to write it over a read-only file that already exists, or that you don't have permission to write to the output folder.
  5. MyFile.xml(1234,56) : error ??????? : Some Error Description
    This is an actual error in the XML. The first number after the filename is the line number that it thinks is wrong, and the error description should give you an idea of what's wrong and how to fix it.

Reward Compiler

As with the mission compiler, the reward compiler is also a command-line tool. However, it's a little less complex to use.

The reward compiler, BGLComp.exe, is also found under the SDK folder, in a subfolder called "Environment Kit\BGL Compiler SDK". Unlike the mission compiler, all you need to do to compile your rewards is change into the directory containing the XML file that contains your rewards, and run the compiler with:

(Path to BGLComp.exe) MyRewards.xml

With a standard SDK installation, that would be:

"C:\Program Files\Microsoft Games\Microsoft Flight Simulator X SDK\SDK\↵
  Environment Kit\BGL Compiler SDK\BGLComp.exe" MyRewards.xml

If this works as expected, a .RWD file will be created and you will see something like this:

Parsing document: MyRewards.xml

Parse complete!

Likely Errors

If BGLComp.exe can't open the XML file, you will get no output at all! However, if there are any errors in the XML, the reasons for the errors are clearly described. For example:

  • INTERNAL COMPILER ERROR: #C2623: Couldn't open file: (a filename)
    A file referenced by the reward, most probably an image, couldn't be found.
  • INTERNAL COMPILER ERROR: #C2032: XML Parse Error! Element tree follows:
    There's some kind of problem in the XML, and the next lines of output show where the error is.

Simplified Method

If frequently using FSX SDK command-line tools
it'll save a lot of time/head-banging, if you set up environment variables.

Please see SDK - Tools - Command Line - Environment Variables (FSX/A)




If you haven't found what you're looking for here, then we'd recommend, (in order of preference) -

  • AVSIM - Mission downloads (newest first).