Blog

DDS and Gamma

Sigh…I think the DDS gamma mess is now fixed.  This mess had two parts:

  1. Since X-Plane treated DDS as having a gamma of 1.8, all DDS material had to be gamma corrected.  As it turns out, the error from gamma correcting a DXT-compressed texture is surprisingly small, but it was still silly to use anything other than sRGB given today’s computing environment.
  2. In investigating this, I discovered that XGrinder/DDSTool from the scenery tools distro are inconsistent; they write out DDS using a gamma of 1.8 on Mac and 2.2 on Windows, resulting in overly bright DDS for authors using Windows.

This is now all fixed in the new DDSTool/XGrinder:

  • A bit in the DDS file is used to specify what gamma the file was written with: 1.8 (v9) or 2.2 (good for v10).
  • X-Plane 10 will look at this flag and correct gamma accordingly.
  • The choice of gamma is a menu setting, and is selectable on both Mac and Windows.

I’m not sure when we’ll have a binary distribution, but the code is in the public GIT repo if anyone wants it.  The new tool should be better for both authors targeting v9 and v10.

(begin rant)

And for those who want to know why we aren’t communicating more, this is the reason why.  A release is made up of a huge number of small details all of which have to be made right, none of which is particularly sexy, and all of which have to be fixed to create an overall effect that is immersive and beautiful.

The saying in aviation is: “aviate, navigate, communicate”; that seems like a good policy for X-Plane 10 too.  I’m going to try to fix as many of these small issues as possible so we can have a functional beta, then we can talk about it.

(end rant)

Posted in Development by | 10 Comments

X-Plane News Feed

While I’m sure you all enjoy this blog…and perhaps even read and re-read it before bed because it’s life altering, it tends to be a bit….um….nerdy? Come on, it’s safe to admit it, even my wife makes fun of me when I mention the blog. Anyway, if you’re looking for NEWS about X-Plane in addition to the nerdy/geeky/dorky details that we post here, we now have a news “blog” at http://www.x-plane.com/news. You can subscribe there, follow the RSS feed or do whatever you normally do. That’s where we’ll be posting updates about all of our products.

Yeah I know it’s a bit dusty and stale but we’re doing our best to clean off the dust and use it now that it’s a wordpress site and not a pain-in-the-butt-to-edit-html-site.

Posted in News by | 14 Comments

X-Plane 9, X-Plane 10, and Free Updates

There was a lot of confusion in the comments from my last post regarding X-Plane and free updates.  Let me try to clarify.

First, here’s how updates have worked historically:

  • Users get free patches for the life of a major version run.
  • These patches include bug fixes, performance improvements, and sometimes substantial new features.
  • No new patches once a major new version is released.
  • The old patches are available and hosted indefinitely while the new version is out (at least for versions that use our updater).
  • There has never been any kind of guarantee as to what features will be released as patches, or how long a version run will last.  Users who buy X-Plane buy the new version because historically the sum of a major version release plus its patches has been substantial.
  • The global scenery doesn’t change for a major version run, and therefore there are no automatic updates to the global scenery.

That’s how version 9 has worked, that’s how version 8 worked more or less, and it is how I expect version 10 to work in the future.

To address specific concerns: yes, the version 10 run will have free updates to the core sim, just like before.

The point of my previous post is this: in the past, we have not done any updating of the global scenery, and I am not committing to anything more now.  OSM gives us a sane way to collect new data, but it’s too soon to talk about distribution.

Posted in Development by | 6 Comments

The Reports of My Death Are Greatly Exaggerated

So the problem with this blog thing is that if I go radio silent for a few daysweeks you all think I’ve been abducted by aliens.  Let me first set the record straight:

  • I have not been abducted by aliens.
  • Austin has not been abducted by aliens.
  • Chris was abducted by aliens, and they may have done some experiments, but he seems about the same as before, so we’re not worrying about it.

So what I have been up to?  Well, first, LR closed down the Westborough office and relocated scenery development to Grafton, MA.  Here’s the new home office, ready for action:

As you can see, the move was orderly and the new office is spacious and uncluttered.

(This post is going to get really nerdy really fast – a lot of what goes into X-Plane isn’t easily observable – a lot of the work I do is engineering that goes in under the hood.  It’s a long post, but coffee will help!)

Besides reassembling my office I have been working on global scenery DSF creation.  In particular, I’ve been trying to kill off the remaining “wicked” problems – that is, the parts of DSF generation that require first-of-their-kind algorithms.

(More technically, a design problem is “wicked” if the only way to learn enough about the problem to solve it is to go through the act of solving it.  This chicken-and-egg problem is usually broken by trying to solve the problem multiple times – the first few times are “learning experiences” – that is to say, the first version of the code often has to be thrown out.)

Stuffing Your Luggage

Most of the problems with global scenery generation turn out to be “knapsack” problems.  The knapsack problem is basically this: let’s say you have one suitcase (or knapsack) and you want to fill it as much as possible with your clothes.  All of your clothing are of different sizes.  What subset of clothing do you take that leaves the minimum wasted space?

Well, it turns out that if you want the best fit, with the minimum wasted space, the only way to answer that question is to try every combination of your clothing.  Yep.  You have to pack and unpack your suitcase approximately a gajllion times and just try every packing to see which one is best.

This matters to computer programmers because often we have to “stuff” a space as optimally as possible (or find some optimal combination within a set of combinations); what we learn from the knapsack problem is that the only way to find the truly optimal solution is to try them all.  The problem is that when you have a lot of things to try packing, it takes too long (even for a fast computer) to try every combination.

Just Shove The Biggest Things In First

I’ve put “best” and “minimum” in bold above because they are key to defining knapsack problems.  If you have to have the truly best fit, you have to try packing your suitcase or knapsack with all combinations of clothing.  But if a “pretty good” fit is okay, you can do something a lot faster.  You pick a heuristic (that is, a rule of thumb) and hope it works out well.

Let’s take a look at packing in action.  When you load an airplane, X-Plane packs all of the tiny instrument overlay textures into a few big textures to optimize frame-rate.  (This is called “texture atlasing” – authors have to do this by hand for scenery.)  Packing small textures into a big texture is a knapsack problem – to find the truly optimal packing we’d have to try every combination of instruments in each texture.  That would be very slow, so X-Plane instead uses a simple rule: we pack the biggest things in first, building rows.  As you can see from these pictures, the packing isn’t very good – a human could do a lot better.  But the packing isn’t bad, and it’s fast enough (a perfect solution would take days to run for each airplane load).

Pretty Heuristics

When we have a knapsack problem, and our solution is a heuristic (that is, rather than find the most optimal solution, we’ll find a pretty good solution) there is another question: are the particular kinds of solutions that we come up with nice looking?  Do we like them?  For panel textures, this is a non-issue; the user never sees the “pack” of the panel texture while flying.

But for global scenery, the look of our heuristics matter.  Global scenery generation is riddled with problems where the ideal setup of data would be too slow to compute, so we want our approximation to look “good”.

Here’s an example from global scenery of a knapsack problem where the look of the heuristic solution matters.  The map on the left is the OSM vector data for San Francisco.  The map on the right shows the same region broken into terrain zones.  Calculating terrain zones is a knapsack problem with a heuristic solution where the look matters.  Let’s break that down and see what that means.

First: what is a terrain zone?  A terrain zone is a set of adjacent city blocks in a DSF that all have the same base terrain.  If you recall Austin’s rantdescription of the way cities are created in version 10, he said some stuff about starting with grass and building cities on top of them.  Well, it turns out that if you build every block up on the same grass, you get something that starts to look like a mini-golf course.

We have a lot of ways to cope with that, but one of them is terrain zones: several city blocks are grouped together with one base terrain – but then, at a road boundary, we change to a different base terrain to “break up” the landscape along road boundaries.  The look is a lot less monotone in the far view – at least we think; the picture on the left is San Diego (terrain only) with the urban terrain zones set to primary colors for easy examination.  (When the real artwork is in place, the terrain will be similar and color, with roads dividing the various zones.)

The packing problem is: which blocks get grouped together, and which are kept separate?  Some groupings produce a more efficient final mesh, which results in better framerates.  Like the knapsack problem, it would take too long to find the best grouping for framerate, so instead we try to come up with a pretty good grouping.

If you look at the groupings the above maps and diagram, you’ll see there is sometimes a “tooth” pattern where the boundary beteween blocks jumps up and back.  That’s not so good looking; the algorithm that produces the groupings sometimes picks ugly block combinations, and we can’t just tell it “don’t do that” because it doesn’t check every combination to find the best one.

What Have We Learned?

Putting it together, you can see why global scenery generation is tricky.

  • We want to combine city blocks to make moderate sized areas of similar terrain, preferably in clumps that look nice.
  • We can’t just try every combination of block groupings; that would be too slow (it’s a knapsack problem).
  • Instead we have a heuristic – a simple strategy to try that produces “pretty good results”.
  • That strategy is tricky to develop because it has to come close to optimal results (for fps) and we don’t want the groups of blocks to look silly (which is hard to quantify).
  • Therefore, calculating the terrain zones is a “wicked” problem – only by implementing a heuristic do we get to see how it “looks” and decide if it is acceptable.
  • My office looks like a bomb went off.

 

Posted in Development by | 25 Comments

New Scenery Tools: WorldEditor 1.1 Beta 3

Edit: the original post listed the version as 2.0 – the new WED beta is 1.1, MeshTool is 2.0, and my brain doesn’t work in this heat.

More scenery tools: I have posted a new beta for WorldEditor 1.1:

Like previous betas, this build mostly fixes bugs around import and export, which was the area that caused the most trouble.  Please file WED bugs via the scenery tools bug base; I don’t often get to work on WED, but when I do, I can kill off a bunch of  bugs at once if there are good reports.  Thanks to all of the users who have submitted good bug reports with example scenery packs to help reproduce the problems.

Future WED Versions

Simultaneous to bug fixing on the WED beta, we are adding new features to support X-Plane 10 ATC: WED will be the tool you use to edit taxiway routing diagrams and airport layout flow information for an airport.  (This means that you’ll have your physical pavement, your routings, and your custom scenery all in one environment.)

These features are disabled in the WED 1.1 betas, but once version 10 is released and WED 1.1 is final, we should be able to rapidly go to beta on the new features; since we use WED to build our test layouts now, it should be in reasonably good shape.

In the long term, I’d like to see WED provide a visual front-end for MeshTool*, but I won’t let this hold up a release of an ATC-ready WED; so far having “future features” floating around in the code (disabled for release) hasn’t caused any bug reports or stability problems for the existing 1.1 beta candidates.

WED also needs a file format change; my original decision to use an sqlite3 database was the wrong one; when the file format change happens, there will be full backward compatibility for reading old projects, so you’ll be able to bring your old projects forward just by opening them; you won’t have to reimport the DSFs and you won’t lose your groups and other WED-specific information.

* There’s no reason why WED has to be the only front-end for MeshTool, and it may not even be the first one released.  One option might be to make a MeshTool export script for qGIS.

Posted in Air Traffic Control, Development, Scenery, Tools by | 28 Comments

New Scenery Tools: MeshTool 2.00r6

First, two quick notes on comments: all comments are moderated, so if you post a comment and it doesn’t appear, please don’t repost.  Sometimes Chris and I are both out for a few days, and the comments sit there.  Without moderation, WordPress-based blogs get the hell spammed out of them.  Chris has also turned off commenting on very old posts.  We’ve had a few cases of people digging out old threads to try to jump in to a discussion after the fact, but a lot of what goes onto the blog is time-sensitive – by the time a month is up, a newer post covers the topic in more detail.

Now on to tools: I have posted new release candidates for MeshTool, version 2.0 release candidate 6:

MeshTool has been in a “perpetual release candidate” state for a while.  I think this is partly because we don’t eat our own dog food when it comes to MeshTool – the tool shares a lot of code with our default DSF generator but they’re not the same thing.  Not surprisingly, the MeshTool code that is specific to MeshTool and not used for global scenery is where the bugs crop up.

So my thanks to those MeshTool users who have patiently sent me bug reports and reproduction cases – I’m hoping that this release candidate is final.

What’s Next for MeshTool

I think MeshTool will go in a few different directions over the next year:

  • The scenery tools code is “branched”, with two forks.  The older fork targets X-Plane 9, and the newer one targets X-Plane 10.  I suspect we’ll eventually have to have two MeshTool versions, 2.xx for X-Plane 9 scenery, and 3.xx for X-Plane 10 scenery.*
  • One logical next direction for MeshTool is to add “processing” features. For example, we have code to roughly flatten an airport area – useful when using SRTM data (where concrete runways make false radar returns that turn into tiny hills).  This code could be made available from MeshTool.
  • The other logical direction is to put a real user interface in front of MeshTool.  Just like WED and OE provides graphical ways to place objects (where-as DSF2Text is low level), it would be easier to work with a mesh scenery if you could see your work, and have MeshTool run automatically in the background.

I don’t know what the time frame for future MeshTool work will be; future MeshTool work isn’t necessary to ship X-Plane 10 so it may have to wait a while.

* This is really not ideal, and it is not the way that most other compatibility will work.  Wherever possible, I’m trying to make the tools simply work for both X-Plane 9 and 10 in a single tool.  It’s less code for me, and more useful for you (because when we need two tools for two sim versions, inevitably one of the two tool versions will be less feature-filled than the other).

Posted in Scenery, Tools by | 12 Comments

Scenery Tools, Dog Food, and X-Plane 10

We eat our own dog food” is a term in software development for a company that uses the product it sells for its own operations.  The idea of “dogfooding” is that developers who use their own software will have much stronger incentives to make the software usable, productive, and reliable.

Laminar Research practices a form of dogfooding with the scenery tools:

  • All of the scenery tools are open source, so we don’t have any “special secret magic tools” that you don’t have.
  • Our art team uses the same set of tools that third parties use.

Dogfooding does have an effect on development: when the artists get on my case about the usability of a scenery tool, it gets my attention.  We pay those guys to churn out a lot of artwork; if they aren’t productive, we can’t get the sim out.

However, there is an Achilles heal to dogfooding: you can only dogfood software that is useful for your company’s business.  We have this problem with MeshTool: since we don’t make our own orthophoto sceneries, MeshTool doesn’t get heavy internal use, and as a result I think it’s been a lot slower to become usable.  The MT users who have filed bugs have been very helpful, but I feel for their suffering with a very raw tool.

Dog Food and Version 10

For  version 10, we are producing art assets that use new rendering technology for the very first version.  This means we’ve had to build the tools to support new version 10 technology early on, and that’s good news for third party developers.  When version 10 is released, I’ll package up the various version 10 tools we’ve created for public consumption.

In most cases, the tools need additional polish – our artists often use tools in very early, buggy, raw form.  But what we already have is a big head start, which should shorten the time from version 10 release to a full set of tools.

I’ll post more over the next few days regarding some of the specific tools we have and what we will do with them once version 10 ships.

Posted in Development, Scenery by | 9 Comments

Bug or Hurricane?

The billboarding scheme for cloud puffs has been rewritten for X-Plane 10; for the most part you should not see puffs spinning or reorienting themselves as you move the camera.  However, while poking at the cloud puff shader, I managed to induce this picture on the left.  The weather system makes some of the best bug screenshots.

(The post was originally labeled “bug or tornado”…I changed it because it seemed obnoxious after what happened in Joplin, MO – just me being a jerk from the East Coast.  A few days later we were hit by a series of Tornadoes fairly close to home.)

Posted in Blooper Reel by | 11 Comments

The Cult of Bad Preferences

Bad preferences have become a superstition in the X-Plane community.  If anything goes wrong, the first thing anyone says is “delete your preferences”.  This often “fixes” the problem – in that it undoes all of your careful settings and changes about 100 different things, one of which changes enough behavior to fix the problem.  It’s the medical equivalent of curing the common cold by transplanting every single organ.

Of course, every now an then the preferences file is the problem.  It turns out that X-Plane 9.6x and 9.31 use the same version ID for the binary preferences file, and yet they use different binary preferences file formats. This was a screw-up on our part, and the result was a hang on start for 9.6x users if they had their old 9.31 preferences laying around.  In this case, nuking preferences really was the problem.  (Thanks to Andy for getting me the files to see this “in the lab”!)

Send Me Your Preferences!

What is frustrating about the 9.31/9.61 preferences bug is that people have known about it forever, and yet I only received a real bug report about it this week.  Part of the problem is how people cope with these bugs: by deleting their preferences.

Don’t delete your preferences! Once you delete the preferences files, they are gone!  If there was something wrong with them, we’ll never know.

Deleting your preferences is like burning all of your belongings when you get a cold: the Doctor won’t know what bacterium or virus you have because you destroyed every instance of it!

You don’t have to delete your preferences.  You can simply move them out of the preferences folder onto your desktop. This has the same effect as deleting them: X-Plane will not find them in the new location, and will start up with its default settings.

What if moving preferences fixes the problem?  Well, now you have two sets of preferences: the old “sick” preferences on the desktop that cause a problem and the new “rebuilt” ones that X-Plane made when you re-ran.

At this point you can now send me a bug report.  It might go something like this:

You: Hey Ben, I was getting a crash on start.  I moved my preferences files out to the desktop and it fixed it.  Here are the bad preferences and here are the good ones, in two zip files.

Me: Thank you!  That’s great!  I will look at the two sets of preferences to see what changed.  If there’ a sim bug I can identify it and find it.

You: So…do I get any kind of reward?

Me: Only the good feeling of knowing you’ve helped your fellow X-Plane users.

You: Screw you! I’m going to go use Google Earth Flight Simulator.

Okay, that didn’t go quite as well as I had hoped.  But my take-away point is this: if there is a real problem with the preferences system, such that deleting preferences is necessary, we want to look at the files and fix it in the sim!  In the long term this will lead to less need to delete preferences, which will save a lot of users a lot of re-doing settings.

Why Do Preferences Files Matter?

Why does moving your preferences files out of the way (so X-Plane can’t find them) sometimes help?  There are a few causes that I’ve seen:

  1. Incompatible or corrupt binary files.  Sometimes the preferences files actually contain junk, although this is rare.  In some cases, we don’t handle the preferences file version change and we need to fix the version check code (this is what we’re fixing in 970).
  2. Sometimes a single particular setting is problematic for a particular machine.  For example, your machine might have a driver problem that causes it to crash when “per pixel lighting” is on.  If you remove the preferences and the default is to have that setting be off, then you “fix” the problem.  In this case, a comparison of the “bad” preferences with the default ones can reveal settings that might be the problem.
  3. Sometimes settings can be set while you fly, but cause problems when the sim starts with the settings turned on.  This is rare, but with tweaky graphics drivers we sometimes do see this behavior.  Sometimes a setting takes effect on restart, so it’s not until you restart with the new setting that the preferences file causes problems.

Either way, having the “bad” preferences to inspect is critical to catching any one of these cases!

Posted in Development by | 3 Comments