Blog

If Your Framerate Gets Slower Over Time, It Might Be the Cars

Just a quick tip on tuning X-Plane’s rendering performance: if you see your fps start off strong and then drop over time to a crawl, with low GPU, turn down the cars.

Here’s the problem: cars are spawned over time.  The way the car engine works is that X-Plane comes up with a budget for cars based on rendering settings, and adds a few more every frame as long as it’s under budget; if it is over budget it simply doesn’t replace cars that are killed by being too far from your plane or reaching a dead end.

It can easily take several minutes for car traffic to build up.

And the thing about the car traffic is: it’s incredibly CPU intensive.  This is something that I am working on and it may get better for future patches, but for now just consider this: a reasonable setting for cars (for your computer) should be based on the framerate after several minutes, not the one you instantly get when there are virtually no cars!

Posted in Development, Hardware by | 8 Comments

Austin Meyer Fired!

FOR IMMEDIATE RELEASE: Columbia, SC.  Laminar Research announced today that in a surprising board room coup, the company is terminating owner, CEO, president-for-life and benevolent dictator Austin Meyer’s employment, effective immediately.

Randy Witt, VP of marketing, stated: “We couldn’t actually fire him because he owns the company, so instead we locked him in the first floor bathroom of his house.  As far as we know the bathroom doesn’t have net connectivity, so he should be out of our hair.  We left him some magazines.”

While many long-time X-Plane users were surprised that Mr. Meyer, who has worked on every version of X-Plane since version 1 and was the only X-Plane developer for the first 7 versions of the product, would be terminated so swiftly, others saw it coming.  “We knew we had a problem a year or two ago when Austin started talking about plausibility all the time,” recalls Alex Gifford, Laminar’s resident mad scientist and autogen developer.  “I had a really wonderful pig with a camera mounted on its head, but we couldn’t use it because it isn’t ‘plausible’ that such a pig would walk down the streets of New York.  I thought to myself: the X-Plane I knew and loved would never have shied at putting random animals, some perhaps heavily armed, all over the sim.  Just look at X-Plane 9!”

Senior grumpy software engineer Chris Serio concurs.  “He wanted to remove the deer that randomly run across the runway at major class B airports.  We begged him not to.  We just looked at each other and said ‘who is this guy and what happened to the Austin we once knew?'”

But the final straw was Mr. Meyer’s early April 1st prank, stating that X-Plane would become a casual flying game similar to Microsoft’s recently released “Flight” product.

Barista-in-chief Ben Supnik describes the scene: “We were just appalled.  I mean, publicly mocking our competition, preferably without using their actual products, while our own product has serious known bugs is standard operating procedure for Laminar Research.  But the early release of the announcement was just unacceptable.  Laminar has always been about missing deadlines, sometimes by several years.  The notion that such a statement would come out over a full week early was just too much for us to bear.”

When asked how X-Plane might change in Mr. Meyer’s absence, Mr. Supnik hinted that the company would move to a table-based flight model with “at least four or five data points”, and that, with plausibility no longer a necessary design goal, the company was looking to license Skyrim as its rendering engine.

Posted in News by | 44 Comments

Three Plane-Maker Tricks You Should Know

Here are three obscure Plane-Maker/X-Plane features that can save you time if you developer complex aircraft.

Plane-Maker Will Copy Your Instruments

You may know that in Plane-Maker, you make your own copies of X-Plane’s PNG files to customize the look of the instruments.  But did you know that Plane-Maker will copy the images for you?

Select an instrument and type Control-P (which is the default for the command binding “pln/panel/copy_instrument_png”).  Plane-Maker will copy all PNGs for that instrument into your aircraft’s cockpit or cockpit_3d folder.  This can save you the time spent wading through X-Plane’s cockpit folder to find the right PNG files.

X-Plane Can Make a Panel Image for UV-Mapping

When you are making a 3-d cockpit, you use the 3-d panel as a texture.  But how do you know how to UV-map this texture in your cockpit?  Often the panel background (panel.png) is blank.

X-Plane can make a snapshot of your panel for you, in the exact size you need to UV map.  Use Control-Alt-Shift-Space (Command-Option-Shift-Space for Mac nerds) to run the “sim/operation/make_panel_previews” command in X-Plane.  It will make a PNG file in your aircraft called Panel_preview.png – it’s just like Panel.png but with the instruments drawn in – perfect for UV mapping.

Plane-Maker Will Tell You What’s Wrong

That sad face icon in top bar of the Plane-Maker panel editor enables “warning” mode.  In warning mode, every instrument that has a potential problem gets a red outline.  Select one instrument with a red outline and in the upper left corner of the panel you’ll see a description of what’s wrong.

This picture on the left is from Plane-Maker editing a 3-d panel. (That’s why it is just a “packed” set of instruments with no background; this panel is used as a texture for a 3-d cockpit – each instrument is UV-mapped into the right location.)

The air-speed indicator has been flagged as having a problem, and the text shows it.  In this case, the lit texture has an alpha channel, which causes the lit texture to draw incorrectly.  Fix the texture and the warning will go away.

I strongly recommend checking all Plane-Maker “red boxes” on your plane – most of the warnings will tell you about problems that would otherwise be very hard to detect.

Posted in Aircraft, Aircraft & Modeling, Cockpits, Panels, Tools by | 1 Comment

X-Plane 10.05 Release Candidate 1 – A Tiny Patch

X-Plane 10.05r1 is now available – click “get betas” and run the installer’s update function to get it.  This is a really tiny patch; we needed to fix language on the 32-bit Windows warning, and we took the opportunity to fix hard cockpit walls and the carrier landing while we were at it.

Everything we’ve discussed on this blog for the upcoming beta is coming – but for a future patch in a few weeks.  That will be a major patch with a multi-week beta period and real enhancements to the sim.  We’re already deep into development on this work; the 10.05 micro-patch is just a quick build to fix a few tiny bugs.

I expect us to go final with 10.05 in a day or two – there are only two code changes, so it should be quick to find any possible problems.

Posted in Development, News by | 22 Comments

Conditionals, Shadows, Big Textures, Etc.

It looks like, for the next major patch, we’ll be able to get a few features in that authors have asked for:

  • Exclusion of scenery elements from shadowing for pretty much all scenery elements.
  • Use of “conditionals” (see the OBJ8 spec or previous post) to use different textures when HDR is on or off for facades, ter and pol files.  (This is available for OBJs since 10.0 – this is an extension to other scenery formats.)
  • Texture size limit bumped up to 4096 x 4096 max.  (The max panel size will remain 2048 x 2048.)

The one other authoring request that we heard loud and clear in Mallorca but will probably not get to in the next major patch is an option for seasonal textures in third party add-ons.  It’s a slightly more complex  change and will have to come in a later patch.  (But we have moved the priority of this feature way up in response to developer feedback.)

Posted in Development by | 32 Comments

What’s New in OBJects?

I finally finished up an update to the OBJ8 specification, as well as the forest specification – see here for the documents.  These specifications are mostly of interest only to developers who are working on scenery exporters.

The OBJ specification is very thick – here are some of the hilights of what’s new.

Global Lighting

In X-Plane 10, you create global spill lights by attaching a light to an object.  (Thus, spill can come from any object-bearing part of the sim – an airplane, custom scenery, etc.)

One way to do this is with the existing named and parameterized lights – these features existed in version 9, but in version 10 there are some spill lights added to the light list.

What may be of more interest to custom authors is the new LIGHT_SPILL_CUSTOM command.  This lets you build a completely customized spill light. You control its size, color, shape and direction.  You can even optionally run the light through a dataref, giving a plugin custom control of the light.

Draping

In X-Plane 10, an object can contain geometry that is “draped” on the ground – that is, X-plane will subdivide, bend and modify part of your object mesh so it sits perfectly on the ground even if the ground is sloped.  ATTR_draped makes this happen.

This feature is a much better alternative to using ATTR_poly_os to make marks on the ground.  Draping produces objects with better performance, and the geometry always sits on the ground with no artifacts.

As an added bonus, you can optionally use a second, different texture for the draped part of your object from your regular object.  (Internally the draped geometry actually becomes something like a .pol file – this is why it can have its own texture.)

Draped geometry makes it much easier to make airport markings.  If you want a parking spot, simply draw it on a quad, make it draped, and drop it into place with WED.  Tom uses this heavily in our airport library.

Draped geometry also makes it easier to have ground markings that match the object they come with.  For example, if you want a house and the house comes with a driveway texture, you can make the driveway texture a draped quad and when you place the object, the draped driveway is always in the right place.

Global Attributes and Instancing

In X-Plane 10, it is possible to set a few key attributes (blending and shininess, among others) globally for the entire OBJ, rather than using an ATTR_ to change part of the object.

These global attributes make hardware instancing possible.  In hardware instancing, X-Plane draws many objects with a single instruction to the CPU.  In order for this to happen, X-Plane must be able to draw the entire object without needing CPU intervention mid-object.  This means an instanced object has to be free of animation, attributes, and a few other features.

The global attributes let you set things like shininess and still have a single-call draw object, ready for instancing.  Alex uses these heavily in the urban autogen, and it really helps performance.

My fear is that global attributes are going to be a source of confusion for authors.  When should you use them?  How do you add them?  This is my thinking:

  • Modeling program exporters should allow an author to identify an object as “for instancing” or not.
  • Authors should check “for instancing” for any object that is heavily repeated.  (A car or a single tree or a static airplane, for example.)
  • The modeling program can then try to prefer global attributes for instancing objects but not for regular ones, which should come very close to optimal behavior.

Conditionals

Conditionals are simple logic statements that include or ignore parts of an art file based on the rendering settings.  In particular, they let you change an OBJ based on whether HDR is on or shadows are on.  For example:

IF GLOBAL_LIGHTING
TEXTURE_LIT my_airplane_hdr_LIT.png
ELSE
TEXTURE_LIT my_airplane_LIT.png
ENDIF

In this example, which LIT texture the OBJ uses will depend on HDR.

Because the conditionals can be used anywhere in the OBJ, you can change any aspect of the OBJ to customize for HDR.  You can replace a texture, remove lights, add more geometry, etc.

I don’t know how heavily people will use conditionals, but they give authors the option to make one file tuned for both HDR and non-HDR, shadows and non-shadows.

I think the two most common uses of conditionals will be:

  • Providing alternative LIT textures when HDR is on or off.  Note that only one texture is ever loaded (when the HDR rendering setting is changed, X-Plane unloads one and reloads the other) so this does not increase VRAM.
  • Removing drop shadows that are baked into a model when shadows are on.

That second case would look like:

IF NOT GLOBAL_SHADOWS
ATTR_draped
# This is the shadow geometry
TRIS 300 6
ATTR_no_draped
ENDIF

When global shadowing is turned on, the entire set of draped geometry disappears, removing baked vs. real shaodw conflicts.

Posted in Development, File Formats, Modeling, Scenery by | 31 Comments

10.04 is Final 10.05 Will Be a Micro-Patch

X-Plane 10.04 went final yesterday – as always there’s one bug that gets by you.  In our case, “solid” cockpits (cockpits that constrain the camera so you can’t move through walls) are inoperative.

At this point it looks like we will do a tiny micro-patch to make 10.05 that fixes this and puts some new strings into the app. Honestly if we didn’t have string changes, I’d probably wait for the next real patch for the cockpit fix, but I believe that it is a low risk change if we must cut the app anyway.  The main goal of 10.05 is to get the language just right in some of the dialog boxes for the next set of DVD masters.

The amount of change from 10.04 to 10.05 will be very tiny – comparable to 10.04 rc2 to 10.04 rc3 – literally one or two lines of code changed total.

In the meantime we are working in parallel on the next big patch.

Work on 64 bits is underway – I do not believe it will be available in the next big patch, and we have not specified any date (soon or far away).  Simply put, I am staying out of the business of release dates for work like this.  Our internal estimates have huge margins of error, due to the many unknowns of the process, and I don’t think we make anyone happy by saying when the feature will be available and then being wrong.

Who Will Use 64 Bits

When X-Plane or the installer checks for updates, it sends an identifier (called a “user agent”) to the server.  This is a standard part of HTTP and all web browsers and web-communicating programs do this; our servers (we use Apache, like most of the universe) keep a log of the “user agents” calling in, which can tell you what web browsers and other programs are requesting web pages.

Here is an example of two user agent strings from a real access to our web page:

Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3

Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2

As you can see, Safari and Firefox are both identifying what version they are and what operating system they are running on.  This means the website owner can tell how many people are viewing with older browsers or tablets/mobile phones, and optimize the layout of the site accordingly.

Here’s what X-Plane looks like when it calls up our web server:

X-Plane 10.04r3-3-IBM6.1_64

For as long as we have had auto-check-for-update, X-Plane has include the operating system in its user agent string, just like web browsers do.  This means that we can tell the approximate operating system split by looking at the user agent strings on the server.

With X-Plane 10.04 we have moved to the more complete string you see above – in particular, it includes whether the version of Windows is a 32 or 64 bit edition.  (The above string comes from Windows 7 64-bit.  Why Windows 7 is versioned 6.1 is beyond me.  The extra “3” is an indication that the user has a full global edition of the sim – this is a paying user running on Windows 7 64-bit.

So I can tell you that at least for users who have updated to 10.04r3:

  • The platform split for full copies of X-Plane remains about 63% Windows, 32% Mac, 5% Linux.
  • Among full-copy Windows users, about 85% are on a 64 bit Os – that is a surprise to me, but a good one – it means a lot of users will be able to utilize the 64-bit port.  (Among demo users it’s about 75% 64-bit.)

Uh, What Do You Guys Do With This Information?

Not much.  We didn’t actually set out to do a hardware survey – rather we put a user agent string into the installer when we first wrote it, because it’s required by the protocol.  Apache logs user agents by default, so it was only after running the installer a while that we realized that we could “mine” the log for platform information.

We do not:

  • Try to correlate these user agent logs with customer information in any way.
  • Archive the logs permanently – as anyone who admins a web server knows, the logs get very big, so the server keeps a few weeks of records, then throws them out.  Our only change from the default Apache config is to cut down the retention time because our server gets a lot of traffic.
  • Send any personally identifying information in the user agent string or otherwise.  The server logs incoming IP addresses, but this is not part of our installer – all web servers know the IP address of the incoming requests; logging them at least temporarily is necessary to be able to identify the source of a web attack should one occur.

 

Posted in Development, News by | 32 Comments

No Shadows For You!

Among other things, I am working on more file format documentation for X-Plane 10.  Most of the tools you need for scenery are right there in X-Plane 10.0r1, because our art team needed them.

But there is one feature that slid by: a global shadow disable for an object or art asset.  I am adding this directive (it will be called “NO_SHADOW”) to a bunch of places in the scenery system.  Typical use would be to completely exclude geometry from shadowing, which will also improve performance (less work for X-Plane to do).  The directive will be available in 10.05.

There is one exception: you can disable shadowing in an airplane by disabling the “shadow” check box in 10.04, and “glass” tagged objects from v9 planes are not shadowed.

Posted in Development, Scenery by | 9 Comments

Plugins: Check the OpenGL Error (in Debug Mode Only)

A quick OpenGL note for plugin authors: if your plugin uses OpenGL to draw (e.g. for a plugin in an airplane that draws a custom glass display) you should:

  • In debug mode: always check the OpenGL error state (using glGetError) at the end of each draw callback that you handle.  X-Plane will not leave OpenGL errors around, so any error is yours.  (To verify that it’s not another plugin, just add a glGetError at the beginning of the callback.)
  • In release mode: never check the OpenGL error state, as it can slow down the driver.

An OpenGL error often implies that an OpenGL command did not complete as expected (because a param is bad, etc.) and this can mean that you are not cleaning up OpenGL state for X-Plane!

(And of course you should always use XPLMSetErrorCallback in debug mode to catch plugin errors. Set a break point in your callback to see exactly where the error occurred.)

Posted in Aircraft, Development by | 2 Comments