Monday, October 16, 2006

Anatomy of the Scenery Tools

This is a description of what I am planning for the anatomy of the "full scenery tools". Until now we have only published small utilities (ObjConverter, DSF2Text, etc.). The next scenery tools release should cover a lot more, including the first versions of WED.

First of all, WorldMaker is not part of the next-gen scenery tools. WorldMaker is slowly going away, as functionality in WorldMaker is either moved directly into X-Plane for "live" use (navaid editing) or into the scenery toolset.

The new scenery tools will be a single distribution for all tools. In other words, instead of a download for each tool, you will download one archive that contains all of our tools and support files. They will live together in a single "install" folder.

The distribution will not be based on our installer - more likely they will just be a zip file. The scenery tools total size should be small enough that there is no need to do incremental installs. There is no need to put customized files in the scenery tools folder _ever_, so simply replacing it should be a non-issue.

The scenery tools will be completely separate from X-Plane itself and will have their own release schedule and versioning. The scenery tools contain no x-plane code and will also be available in source.

Some undecided issues:
  • What to call the main visual editor. The working name has been "WED" (WorldEditor) but that's so similar to WorldMaker that I fear total confusion. I am open to naming suggestions.
  • Whether to make a distribution or each platform or simply put all the EXEs for all the platforms in one download. I don't think code size will be so huge as to prevent this.
  • Whether to allow the scenery tools to be installed in any folder or to require them to go in /Program Files (Windows), /Applications (Mac) or /usr/local/bin (Linux).
One more change: currently I provide a GUI version and a command-line version for some converter apps. With the new scenery tools, I will provide a command-line version for each converter (like now) and a single GUI tool that can do ANY of the conversions that ALL of the command-line tools do.

In other words, for users who want a UI, you will be able to do model->OBJ conversions, ENV->DSF Overlay conversions, OBJ->OBJ conversions, and DSF<->TXT conversions in a single application. This "swiss army knife" GUI application will be extensible and will be our "master converter".

So the new scenery tools should include:
  • Many command-line tools for low level operation.
  • A swiss army knife GUI converter tool.
  • A visual scenery editor (WED).
  • The AC3D OBJ export plugin.
I do not know what the release date of all of this will be, and I do believe that the tools will come out in stages - that is, the first WED will not edit meshes, the AC3D exporter may not be included in the first release, etc. I don't want to hold up the availability of useful code (like a WED that can edit apt.dat 850 airports) because other parts are missing (like an AC3D exporter version 3.0).

Please do not email me to ask about release dates; now that X-Plane 850 is final, I am working on scenery tools today. I will post more info as I have it.

Saturday, October 14, 2006

Pixel Shaders and Scenery

X-Plane 850 was the first version of X-Plane to start employing pixel shaders -- they make the new hardware-accelerated lights possible. Our next step will be to start converting existing OpenGL code over to pixel shaders.

DISCLAIMER: these are my predictions for the future of X-Plane, not promises or guarantees. Do not base your purchasing decisions on what I say, and do not come back quoting this blog saying "you promised X". This is a statement of our intentions, but we cannot predict what limitations we could hit in the future, such as graphics problems we did not anticipate!

Right now X-Plane works based on individual selection of features - that is, each separate part of X-Plane examines our summary of a driver's capabilities and does what it can based on those capabilities. The result is good for users in that X-Plane's visual features turn off one-by-one as a card becomes less capable, leaving as much eye candy as possible.

What's bad about this technique is that there are huge combinations of possible configurations, more than we can test individually, so we sometimes have bugs that show up only with a peculiar combination. Since most of the code that uses this driver spec has been relatively stable we haven't seen a lot of bugs due to this in 830-850, but I definitely fixed a lot of configuration-related OpenGL bugs in the early v8 run when the rendering engine was new.

Pixel shaders (we use GLSL for the OpenGL nerds out there) will change that; the OpenGL shader spec is powerful enough that if we have it, we can do everything we want. So the new world of shaders will make X-Plane's visuals be either "you have it" or "you don't". This definitely helps us for testing - we can test the shader version, the legacy version, and that's it.

Remember the dark old days of X-Plane 6 when GeForce 4 MX's had two pixel shaders, but GeForce 4 Ti's had 4, and ATI cards had 2,3,4 or 6? Fortunately we're past that. The last three generations of video cards have pixel shaders and every card with shaders has 16 texture units, which is more tha enough for us.

Here are the cards that will support shaders, at leaset I think from the specs posted on the web (all suffixes have equal pixel shader capabilities - the suffix usually is about the speed of the card):
  • ATI Radeon 9500-9800.
  • ATI Radeon X300-x850.
  • ATI Radeon X1000-X1900.
  • nVidia GeForce 5200-7900.
  • Any card that hasn't been released yet will surely support shaders.
Here are the cards that X-Plane will run on but don't support shaders:
  • ATI Radeon 7000-8500.
  • GeForce 2,3, and 4.
  • Intel GMA950 (and probably a few other Intel chipsets I don't know abot).
I don't know about the old Rage 128 or original GeForce 256 - technically they probably meet minimum requirement, but they're so underpowered you wouldn't want to run X-Plane 8 on them. Also I don't think they ever came in 16 MB variants. I don't know about Matrox's compatibility.

To use pixel shaders you will also need reasonably new and modern drivers. Both ATI and nVidia ship modern drivers that support shaders fully, but very often what you get on your machine or with Windows XP does not. So if you have a card that supports shaders but don't see them, it might be time to check the vendor website.

For Mac users Apple shipped full pixel shader support in 10.4. So: if you have a card with pixel shaders and you use 10.3.9 you should upgrade to either 10.4 now or 10.5 when it comes out! Otherwise x-Plane will not have the right driver to utilize your hardware! An X850 or 7300 on OS 9 is definitely a waste of potential. (X-Plane 8.50 already has features that are only available to pixel-shader users on 10.4!)

I am excited about pixel shaders because we'll be able to finally fix some of the bugs we just couldn't fix before. For example, when you turn on the landing light, X-Plane's ambient lighting levels drop to pitch black. With pixel shaders we will finally have the capability to fix this!

Wednesday, October 11, 2006

High Altitude Object Placement

Jonathan Harris sent me a test package showing how that 850 betas misplace objects at high altitude. The pyramid is 1000 meters up, and the object should be right on top of it. (Mind you DSF has a little bit of rounding error; the amount depends on the smartness of the DSF writer. DSF2Text isn't that smart, so I can't promise it's better than half a meter anyway.)

The problem is that X-Plane figures out how high the ground is based on a cartesian coordinate system, not based on true round world math. This is not a problem as long as the ground and the point you are looking at the ground from are not that far apart vertically. (This is why this does not represent a physics bug; as the plane gets closer to the ground, the error in terrain height, which is also a function of slope and is thus probably zero on a good runway, gets smaller and smaller until we are dead-on at the instant the wheels touch down.)

The problem is that DSF objects do not have elevation specified in the DSF file; they are "dropped" onto the terrain. In order to drop them and know their elevation, we must have their location in cartesian coordinates, and that requires knowing their elevation. Doh! A paradox.

X-Plane 850 used to simply pick an elevation of 0 to start out the process. This leads to a lot of error at high elevation areas away from the center of mapped scenery. X-Plane 850RC4 "solves" this problem (temporarily until I can come up with something better) by dropping the object twice. The second drop is done using the height of the first drop to redo the conversion from lat-lon to cartesian coordinates. Since the first drop is only off by a little bit (a few meters usually) the error introduced in the second drop is very little.

Here's a comparison of placement in 850RC3 and RC4 (coming to a web page near you soon I hope). The object is 5 meters tall and 1 meter across. While RC4 is still not perfect, the error should be small enough that you won't have to hack your scenery package to get good object placement.

That was so fun - let's do it again!

One of the less fun aspects of X-Plane 8.50 was dealing with driver bugs. The basic problem is that PC hardware vendors have a relatively slow cycle for updating the software they bundle with their machines; while the companies that write drivers (ATI and nVidia) have a pretty high latency from when they first ship a card to when the driver support is to the level that X-Plane needs.

The clearest case of this I saw during 8.50 was in the case of PC users with "1.5"*-type ATI drivers. These drivers will cause the terrain textures to swim when hardware-accelerated runway lights are used. Upgrading to "2.0"-type ATI drivers fix the bug. A lot of users were just fine with the 1.5 drivers that came with their machines until X-Plane 8.50 came out, and have only now updated.

8.50 started using pixel shaders; hence the need for newer drivers with bug-free pixel-shader support. But in the future we're going to move from "DSP"-type shaders (that is, shaders written in a very low level language) to shaders writen in a GLSL, a high level abstract way to write shaders.

My fear is that this will induce a second round of "update your driver" for PC and Linux users. (Apple ships new drivers with system update, so users of the current Mac OS can usually just run the updater if it isn't set to update automatically.) But I think it's probably for the best that people use the latest drivers, as ATI and nVidia put software changes in the drivers that increase the throughput of the graphics card, through smarter use of the hardware.

The one group that is really stuck is Macintosh 10.3 users; Apple doesn't provide driver updates to older operating systems. So for example users with 10.3.9 and an ATI card with pixel shaders can't get hardware-accelerated texture lights without buying OS X 10.4. I would go as far as saying that in the future if you have a pixel-shader card it might be worth buying an OS upgrade to unlock the driver support needed to use these features.

Why move to GLSL (and require more driver updates)? In the long term it will provide superior framerate. The current shaders we have now are written in a very low level language, that roughly matches the technology of the first generation pixel-shader cards (Radeon 9700 and GeForce "FX" series). As cards gain new capabilities, Austin and I can't take advantage of the new capabilities using this old language.

GLSL however is a higher level language; when we write a shader in GLSL, the graphics driver translates our shader into code specific to the video card at hand when X-Plane starts. This means that if the video card has some new magic trick it can do, the driver can take advantage of that trick as it translates our shader, resulting in higher framerate. And everyone loves higher framerate. :-)

EDIT: who will be able to use GLSL? Basically any card that has hardware-based pixel shaders** from ATI or nVidia will support GLSL-based shaders if you have a modern enough driver. So if you are seeing hardware-accelerated runway lights in 850 then the GLSL changeover shouldn't cause any more fuss than a driver upgrade if you haven't done one rcently.

Also I should say that if I sound like I am dumping on ATI and nVidia for driver bugs, I shouldn't be; video cards are amazingly powerful, the drivers are very complex, and the technology jumps by huge amounts in a very short time period. I believe the level of driver bugginess we see is a function of fast technology rollout and not the competence of the driver teams, who I am sure are working as hard as they can.

So we, the developers who write programs that use these cards, and you, the users who enjoy these cards, have to ask whether we'd rather have faster framerate and more eye candy or less chaos from our drivers.

*ATI drivers are numbered by ATI to match ATI's internal versioning scheme. But X-Plane can't really see what the ATI driver version number is (e.g. the catalyst version number). So when I say 1.5 or 2.0 I am really talking about the OpenGL specification number that the driver implements. ATI implements newer specs in newer drivers, so we can tell that an ATI driver that supports the 2.0 spec is newer than an ATI driver that supports teh 1.5 spec.

So while I have no idea of either which versions of the ATI drivers had this bug or which version it was fixed in, but we can tell from an X-Plane Log.txt file whether the drivers are going to have this bug.

**Hardware-accelerated shaders? Well, previously I've described a graphics card as either having shaders or not, but this isn't totally accurate. Technically a shader can include a non-programmable shader. Furthermore the driver can present software emulation of a shader. For example, the Intel GMA950 has programmable pixel shaders in hardware. On a Mac the driver reports that it has vertex shaders, but the vertex shadings is actually done by the CPU. (This isn't unreasonable -- all vertex processing is done by the CPU on the GMA950.)

So really when we talk about "cards with shaders" we mean: any nVidia card with a number of 5000 or higher (plus some Quadros, sorry I don't know the numbres on those), and any ATI card with a number of 9500 or higher, and any ATI card with an "X" in it, e.g. X850. At this point we've had shaders in cards for 3 generations, so if you buy a new computer and it has an ATI or nVidia graphics card, it should have fully programmable hardware shaders.

Of course now not all shaders are equal; the newest cards have even more powerful shaders. But this isn't likely to matter a whole lot to X-Plane for a while. But generally I'd recommend buying the mid-range latest generation cards over high-end obsolete cards at this point.

Monday, October 09, 2006

GIF is Dead!

(This one's gonna be a little bit political I fear. More scenery-related stuff in a few days!)

The last software patent on GIF expired October 1st 2006. It's very rare that I agree with Richard Stallman on much, but I think he presents some strong arguments against software patents in this speech.

X-Plane never used GIF; we've used PNG as our main graphics format for a while now...here's a history of PNG's development, relating to the problem with GIF being patented.

A few comments of my own:
  • One problem with software patents is the "landmine" effect. There's no way to know as a programmer when we've violated a software patent. (Try searching the patent database for an hour or so and I think you will agree with me on this.)
  • The bar for non-obvious patents is completely miscalibrated. Software engineering is all about building black boxes out of past work and rearranging them to do new things. Allowing the arrangement of past technologies to be patentable is like allowing a mason to patent a particular stacking of bricks; to most masons it should be obvious how to stack bricks for a certain job, and any good programmer should know how to generalize past ideas to solve new problems. This isn't invention, it's implementation!
  • Patents aren't based on natural law and human rights, they're based on fostering creativity. To this end patents are the exact wrong solution for software, where having basic interoperable technologies be free and cheap is good for common infrastructure. Software patents are like someone being able to charge a toll for driving at exactly 55 miles an hour. We want everyone driving the same speed because it's good for the traffic system; similarly we want people to all use the same file formats because it makes all programs more useful.
There are two cases of software patents I can imagine: short-lived ideas that will be obsolete by the time the patent is ever defended; these patents at best serve to help one company beat another over the head with lawyers; I think this is comparable to a SLAPP lawsuit.

The other case is when the idea is truly useful for its entire lifetime (see GIF, which became the only way to put transparent graphics on the web for a while). In this case the result is a stifling of interoperability and innovation and the patent is to the detriment of the industry and all of its users.

To this end I see libpng as a perfect success: a well-designed file format that's free of patents implemented in an easy-to-use high performance library that's free (X11/MIT license). This encourages and makes it easy for everyone to use PNGs which makes all programs work better. Would we be better off if Austin and I had to invent a proprietary image format (with our own inferior compression) because the major formats were patented?

(Would it be feasable to license such a format? I don't think so - see Stallman's comments on the number of components in a software program vs the cost of licensing.)

Saturday, October 07, 2006

Stupid Laptop Tricks

First a disclaimer: DO NOT SHAKE YOUR LAPTOP!!! If you shake or thrash your laptop and kill yor hard drive, do not blame me. Laptops are delicate complex electronic devices and should not be jostled, beaten, dropped, abused, or tossed around.

Okay with that out of the way, a stupid plugin trick. This is only for Mac users with a MacBook, MacBook Pro, or possibly some of the newer G4 laptops (although I haven't tested on these).

First, download "SMSHack.xpl". Unzip it and drag the .xpl file into your plugins folder.

Start X-Plane. In an external view, rotate your laptop about 45 degrees to the left and right and 45 degrees up and back. this calibrates "SMSHack" to know the orientation of your computer. You must do this calibration every time you use SMSHack.

Then: fly using your laptop like a yoke. Roll your laptop to roll the plane, and pitch the laptop to climb and descend. Disable the plugin to get normal joystick control back.



How it works: I use a library called Unimotion. (Hrm..it's LGPL...well, source is here then.) Unimotion reads the SMS (sudden motion sensors) on modern Mac laptops. These are three accelerometers that the Macintosh can use to detect it has been dropped; the operating system will try to park the hard drive heads to prevent a disk failure on impact.

Because gravity is a constant acceleration on the laptop, the accelerometers can be used to detemrine the roll and pitch of the laptop. This plugin simply shovels the relative accelerations into the joystick deflections.

Friday, October 06, 2006

The X-Plane 850 Framerate Test

Now that I've covered how to use X-Plane with command-line options and how to write up performance bugs, we can discuss the framerate test, why it exists, who should use it, etc.

The X-Plane built-in framerate test serves three purposes:
  1. To let us compare our current performance to past performance easily (so we can detect code that hurts sim performance early in our development cycle). This also lets us rapidly determine whether bug reports of "my framerate sucks" are valid or not.
  2. To allow graphics-card driver writers to use X-Plane to benchmark and regress changes to their drivers.
  3. To give us an easy way to get "hard numbers" in-field - that is, when a user emails us with a tech support request saying "my sim is slow", the fps test allows us to determine whether the problem is based on configuration.
I've spent a lot of time in the X-Plane 850 release cycle looking at performance, both with the help of users (e.g. instructing users on how to look at their own machines) and my own. For all the complaining I've done I must say: THANK YOU to all of the users who have helped with performance analysis. These users put in a lot of hours doing mundane test after test and they did a great job of emailing me back information, fps reports, screenshots, and even a Shark profile or two! Even when the result is "hrm - everything is normal", this kind of information is valuable in helping us prove that our release is solid. (And all of the indications I've found indicate that 850 is solid.)

But the process was very time consuming and error-prone. The frame-rate test simplifies things for everyone; the test is standardized and requires no user intervention; it runs the exact same settings every time and is not subject to software configuration issues. The reports are automatically printed out and require no observation.

We are adding the test into 850 so that in the next release we can compare to 850 and be sure we're on track. I only wish we'd have the test in 840!

Should I Be Using the Framerate Test?

If you are not a developer/programmer and you are not asked to use the framerate test by a programmer (for example, in response to a bug report or after emailing tech support) there is no need for you to run the framerate test. You can run the test and email your friends (especially if you have higher framerate than they do) but if you have problems with the framerate test and you are using it "recreationally" please do not file a buf report or query tech support for help. The framerate test is an internal development tool; X-Plane is meant to be used to fly!

What the Test Does:

The framerate test runs X-Plane with preference reading/writing disabled, and it changes the 'default' configuration (e.g. X-Plane's configuration without preferences) based on command-line input. This gives us a specific setup of the sim regardless of how the sim was last used. The preferences are not saved to disk when the test is done, so there is no need for a user to delete preferences to get solid test numbers. User alerts are not shown (just logged) so that the test can be run from a shell script automatically. The sim logs info and quits when it finishes.

The performance test can run in two modes: analysis mode and pass-fail mode. In analysis mode, the sim is run in three 30-second tests: panel view, forward view, and forward-view paused. These three numbers help us tell the relative framerate loss due to the panel and the flight model. The fps-test is primarily aimed at the 3-d rendering engine, but on a CPU-limited machine the flight model can have a huge impact, and on a PCI/AGP bandwidth limited or VRAM-limited machine the panel can cause a noticable slowdown. (The panel also hurts if a machine is extremely blend/fill-rate limited, like a Rage 128, but you shouldn't be using X-Plane 8 on a Rage 128!)

The pass-fail test runs a single test, paused with the panel to gauge pure framerate, and returns 0 or 1 (as a command-line shell app) to the calling script based on whether the sim passes a minimum framerate. The pass-fail test is designed for automated testing; you can put X-plane into a series of standardized tests and automatically send an email if the sim's performance falls below a certain minimum.

How to Use the Framerate Test:

First, see my instructions on how to use X-Plane with a command-line option. In these examples I will simplify the X-Plane executable name; refer to the instructions for your specific operating system.

To run the frame-rate test, use this:
X-Plane --fps_test=2
Where the number is a fps-test "test number". (I will explain the numbers in detail below.) This will run the 3-part analysis test and quit. You can add other command-line options as well; for example, to compare performance with and without VBOs you can do this:
X-Plane --fps_test=2 --no_vbos
(Side note: on fps-test 1 pass-fail I see 71 fps on my MacBook Pro with VBOs and 59 without. Turning off VBOs definitely hurts performance, so only users with serious driver bugs should be using the --no_vbos option.)

To run the pass-fail test, you add a second command-line option:
X-Plane --fps_test=3 --require_fps=20
This will run the pass-fail test and return a positive result if the frame-rate is at or above 20 fps. For example, you could write a test like this:
X-Plane --fps_test=2 --require_fps=20 || echo We were below 20 fps!
Test Numbers:

The framerate test number is up to 3 digits controlling various aspects of the sim:
  • The ones digit can be 1-3 and selects the rendering settings; 1 = very low and 3 = very high. You can view the rendering settings while the fps test its running (it will ruin your test results of course to put up dialog boxes).
  • The tens digit can be 0-6 and programs in a variety of weather and visibility conditions.
  • The hundreds digit can access a few special features: 100-series tests use a far view angle and 200-series tests run at night.
We may invent more tests later on but this initial set lets us run the sim in a wide enough envelope to gather the data we need.

Thursday, October 05, 2006

A Tale of Three Operating Systems

In a vain and foolish attempt to prove that I am the uber-nerd, I have configured my MacBook Pro to boot Mac OS X 10.4, Windows XP Home SP2, and Ubuntu Linux 6.06. It took a while to get everything set up, but all three now run X-Plane with hardware acceleration.

This provides a unique chance to compare the performance of the sim varying old operating-system factors (the OS, the drivers, and the compiler). The machine is a 2.16 ghz DuCore MacBook Pro with 2 GB of RAM and a 256 MB ATI X1600 card.

So without further delay, here are the numbers. Speed is in fps for frame-rate tests 1-3 (1 is lowest settings, 3 is very very aggressive). Each set of fps is for panel view, forward-no-HUD view, and the same view paused. Load times are in seconds for the KSBD demo DSF. The second load time is to reload the same scenery - the times are much faster on all 3 OSes because of the disk cache.

Drivers are not tweaked; this is simply the ATI binary drivers for Linux, whatever Apple ships in BootCamp (some 2.0 series ATI drivers) for Windows, and the 10.4.8 drivers for Mac, none tweaked in any way at the OS/control panel level. For Linux I disabled VBOs because they cause graphic corruption in some cases and slow frame-rate. This is probably a Linux/ATI driver bug.
PLATFORM      Mac         WIN        LINUX
Load/Reload 2.77/1.31 5.02/1.33 3.05/1.04
FPS Test 1 65/71/80 64/69/88 56/62/62
FPS Test 2 49/55/54 50/56/56 34/37/37
FPS Test 3 15/15/15 16/16/16 4/4/4
Analysis:
  • The Mac has the fastest disk performance; both Mac and Linux are significantly faster than Windows in raw loading. For reloading a file all operating systems are about the same, but it's the load-without-cache case that counts.
  • Windows has the highest frame-rates; slightly faster than Mac but quite a bit more than Linux. The lack of safe VBOs on Linux could account for this.
  • In the case where the fps didn't rise when the sim was paused, the limitation is with the video card - not surprising for tests 2 and 3 where there's a lot of antialiasing, anisotropic filtering, and objects.
Tomorrow I'll blog about how the fps test itself can be used.

HOWTO: Use Command-Line Options in X-Plane

Normally you just double-click X-Plane to launch the sim. But X-Plane 850 has some hidden command-line options. We provide these for in-field debugging; if you hit a problem such as a bad video driver you can trigger special options within the sim that aren't exposed in the settings dialog boxes.

Macintosh Users:

To run X-Plane using command-line arguments, you must launch X-Plane using terminal.
  1. Open the utility "Terminal"; it can be found in the Utilities folder (within the Applications folder). Terminal gives you a command-prompt.
  2. Drag your X-Plane application into the terminal window. The command line will list the names of all of the folders leading to your copy of X-Plane using / for directories. All spaces will be preceded by \ characters.
  3. Delete the extra space at the end and add the following to the command-line:
    Contents/MacOS/X-Plane
  4. After the word X-Plane you can include command-line options.
Here is an example from my Mac:
/Volumes/GIS/X-Plane\ 8.50\ RC-3/X-Plane\ 850\ RC-3.app/Contents/MacOS/X-Plane --no_sprites
This would launch X-Plane 850 RC-3 (in the X-Plane 850 folder of my hard drive "GIS") using the --no_sprites option.

Windows Users:

To Lauch X-Plane from a DOS prompt you will have to...
  1. Pick "Run..." from the Start menu. Type cmd (3 letters) for the name of the program and press return. This will open up a DOS prompt.
  2. Type cd and a space and then drag your X-Plane folder into the DOS prompt window (the full path of the file will be typed). Press return. This will move your command prompt to the X-Plane directory.
  3. Drag the X-Plane application into the DOS prompt window. You will see its full name in quotes including the hard disk and directories separated by back-slashes.
  4. You can then add any additional command-line options.
An example from Windows:
"X-Plane 850 RC-3.exe" --fps_test=1
(It is necessary to change directories on Windows to make sure that Log.txt and other files are put in the right place. On Mac these files always end up in the X-System directory.)

Linux Users:

X-Plane can be launched like any other command-line tool; you may need to prefix it with ./ if you don't have the current working directory in your search paths. For example:
cd /home/bsupnik/X-Plane\ 8.50\ RC-3/
LD_PRELOAD=/usr/lib/libalut.so ./X-Plane-i586 --fps_test=1 --require_fps=20
On my distribution (Ubuntu with GNOME, stop your snickering!) it is not possible to simply drag the application into a terminal because the spaces in the file paths will not be properly escaped.

Command Line Options

Generally X-Plane command line options have full names and two dashes. Some require parameters, as in =1. Order does not matter and you can use as many options as you want. Some examples (simplifying the application name, which varies by version and OS):
X-Plane --no_sprites
X-Plane --fps_test=2 --no_pixel_counters
Rather than document the options here, use the --help option to list all command-line options in the current version of X-Plane.

Some Typical Examples

A number of drivers crash when X-Plane uses VBOs, particularly on Linux. If you can run every application except X-Plane itself, you may want to try:
X-Plane --no_vbos
Some drivers cause texture corruption when hardware-accelerated runway lights are used; you can work around this with:
X-Plane --no_sprites
EDIT: the Windows version won't show the --help string in the DOS window by default, but StormRunner pointed out to me that you can do this:
"X-Plane.exe" --help | more
which routes the output to the DOS window.