Blog

Virtual Memory – a precious resource?

Traditionally it always has been real memory – system RAM or VRAM – that’s been most important to the flying equation. But recently virtual memory has been a scarce resource. What happened?

To understand this situation, consider X-Plane 6 vs 8. Back in the X-Plane 6 days, a typical system might have 256 MB of system RAM, 16 MB of VRAM, and 2 GB of virtual memory* for X-Plane. That’s a ratio of 8:1 virtual to real RAM and 128:1 virtual to VRAM.

These ratios are actually pretty useful. At any given time only part of the loaded scenery is visible, so only part of it needs to be in real RAM/VRAM. So having that extra virtual memory lets us load a big chunk of scenery at a time, rather than having a lot of complex details to load tiny bits of scenery.

Today’s computers are a bit different. 2 GB of RAM is not uncommon…that’d be a ratio of 1:1! And most gamers cards have 256 MB of VRAM now for an 8:1 ratio with VRAM. 512 MB cards are coming out and nVidia’s monstrous 8800GTX comes with (gasp) 768 MB of VRAM! Insanity!

The problem is: RAM and VRAM are getting larger, but virtual memory is not! This means the ability to have the part of the scenery you don’t see in virtual memory is getting more and more difficult.

Why can’t we get more virtual memory? Well, the problem is to get more virtual memory we need 64-bit CPUs, 64-bit operating systems, 64-bit drivers, and 64-bit applications. That’s a lot of parts that all need to be 64 bit and means a full computer upgrade and motherboard upgrade. Of the 5 machines Apple sells right now, only one is 64-bit, so even some of today’s fastest machines aren’t 64 bit. That’s slow adoption.

So in the meantime we’re adjusting X-Plane’s strategy to deal with increasingly limited virtual memory. Back in X-Plane 6 it was acceptable to leave all objects their textures cached in virtual memory for later use (which sped up reloading of scenery).

X-Plane 860 (coming soon to a beta near you) will change this – unused textures and objects will be fully purged, which will hopefully address the problem of running out of virtual memory during long flights over lots of different custom scenery.

* 2 GB? Well, technically an application can have 4 GB of virtual memory, but the OS keeps some for itself. Some OSes take 2 and leave 2, some take 1 and leave 3, but even if we had all 4 GB of virtual memory for application use (and we don’t – the graphics driver steals some too) we’ll have 4 GB machines soon, so virtual memory is disappearing.

Posted in Development by | 6 Comments

Scenery Polygons – Part 1

X-Plane 850 introduced some new polygon features that are worth looking at. Polygons are always legal in overlays, which makes them particularly flexible.

A polygon is any DSF entity described by one or more rings of points. A polygon’s look is defined by its artwork file, which also constrains its properties. Polygons may:

– Be draped, meaning the polygon in the DSF does not have altitude information, but instead takes its height from the underlying mesh. A non-draped polygon has altitude information. (Only draped polygons should be used in overlays because a non-draped polygon might not match the base mesh correctly. You can’t know whether a user has the 7-DVD DSF scenery, or old ENV scenery, or the older US DSFs.)

– Be curved (via bezier curves). This is only legal in some polygons.

– Have holes: some polygons can have additional interior polygons cutting “holes” in them.

X-Plane 8 shipped with one original type of polygon: facades. Facades are draped polygons with no holes or curves. X-Plane builds a building along the perimeter of the polygon. Facades were used heavily in the original US DSF scenery, and are useful for airport terminals, and even possibly fences.

X-Plane 820 added two new types of polygons: beaches and forests. Beaches are non-draped, non-curved, no-holes polygons that add a strip of beach texture between land and water. As mentioned above, I don’t recommend using them in overlays because they are not draped. (They are legally allowed in overlays but the chance for ugly results is large.)

Forests may have holes and are draped, but cannot be curved; they fill in their interior with 1-4 polygon trees. We do not have any forest polygons in the current global scenery, but some users have built their own overlays to add trees to X-Plane using these polygons.

X-Plane 850 introduced the new apt.dat format with a number of new features. Rather than make the apt.dat file customizable (which would make the file format complex and change its fundamental purpose), we added new polygon types that let authors use the same facilities as apt.dat files have, but with a lot more control and flexibility. Three new polygon types implement some of the new X-Plane 8.50 apt.dat features:

1. Object chain polygons. You can make a polygon and X-Plane will string a series of objects along the polygon. The polygon is draped and may be curved, but may not have holes. X-Plane 850 uses this for taxiway lights, but this could also be used to plant trees along the edges of fields. (You could also use this to put streetlights along roads, but the road file format can do that already without adding extra polygons to the DSF.)

2. Painted line polygons. You can make a polygon and X-plane will drape a painted line along the ground. These polygons are draped and may be curved, but may not have holes. X-Plane 850 uses this for taxiway lines.

3. Draped polygons. You can make a polygon and X-Plane will fill it in with some kind of texture along the ground. These polygons are draped, may be curved, and can have holes. X-Plane uses these to make curved taxiways, but they have a lot of other possibilities since they provide a way to change the terrain.

I will comment more on draped polygons in a future blog posting, but one immediate note: before X-Plane 850 if you added an airport it was impossible to convert the terrain underneath to grass (from whatever terrain might have been present). With X-Plane 850 you can now make a draped polygon using a grass texture and a DSF overlay with the perimeter of the airport and thus “patch” the texture of the mesh to look like grass.

This technique is not as good as the grass in the native airports for four reasons:
– Draped polygon performance is slower than the mesh itself – I’ll comment about that later.
– Our DSF creation program flattens airport areas – a draped polygon doesn’t so there can be SRTM DEM noise that makes the airport area too bumpy to use.
– The DSF terrain grass can have a soft border, but right now draped polygons always have a very sharp border.

Draped polygons still represent a better option than putting the runways over the existing terrain though.

Posted in Scenery by | 4 Comments

DSF Object Order is Not Draw Order

The order objects are listed in a DSF file (either the OBJ definitions or the actual OBJ instances) is not the same as the order X-Plane will draw them! X-Plane will change the order to maximize frame-rate, and the way it organizes them has changed in 850 (and will change again in futur versions).

Until X-Plane 850 there was no way to control the order of objects (although some packages do rely on X-Plane 840’s behavior and now look funny in 850). But with 850 there is a clean way to control draw order that will work well into the future.

Starting with X-Plane 850, there is a new command ATTR_layer_group…it let’s you override what part of the rendering process your object is drawn in, which is useful in a number of cases. Here’s how it works:

X-Plane draws the scenery in a series of steps or “layer groups”. Because of the way OpenGL transparency and polygon-offset affect Z buffering, X-Plane must draw the terrain first, all decals over the terrain second, 3-d buildings third, and anything translucent (clouds, smoke puffs, etc.) last. Layer groups organize all of the scenery into these catagories.

Objects are normally drawn in the “objects” layer group, which is intended for 3-d buildings, static airplanes, jetways, and anything else you might model with an OBJ. However ATTR_layer_group will let you specify that some objects be drawn earlier or later than others.

The command’s syntax is:

ATTR_layer_group objects 1

Where the name (“objects”, but others are allowed – see the OBJ spec) specifies a group, and the number makes the object be drawn after (positive numbers) or before (negative numbers). Objects with the same group and number are drawn together (in an unspecified order), but X-Plane goes by the numbers.

So for example if you want to ensure that a transparent hanger is drawn after a static plane, use ATTR_layer_group objects 1 on the hanger to draw it after all other objects. To draw some apron lines before the terminal, use ATTR_layer_group objects -1 to draw before buildings.

A few other tips:

  • Try to use as few offsets as possible – e.g. try to put all “draw last” objects into the group objects/1 – rather than using a different number for each.
  • Avoid using layer groups when they are not needed – they inhibit X-Plane from optimizing framerate.
  • If you do not use a layer group, but do use polygon offset, X-Plane sets the layer group to objects with a negative number. This is inhibited when you specify the layer group yourself, so be sure to use a negative offset layer group for polygon offset!
  • Try to organize your textures so that one texture is not used in multiple layer groups. For example, if you have translucent buildings that must be drawn later, group them in their own texture.
  • Related – try to keep polygon-offset geometry (pavement markings) in their own texture and objects. Share one texture for all markings, but don’t put the markings and object together.
Posted in Development, Scenery by | Comments Off on DSF Object Order is Not Draw Order

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.

Posted in Tools by | 5 Comments

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!

Posted in Development by | 2 Comments

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.

Posted in Development by | Comments Off on High Altitude 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.

Posted in Development by | Comments Off on That was so fun – let’s do it again!

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.)

Posted in Development by | Comments Off on GIF is Dead!

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.

Posted in Development by | 6 Comments

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.

4 Comments