Tuesday, June 09, 2009
Multi-Threading Is a Weird Feature Request
Monday, June 08, 2009
Masks for Glass Instruments
Sunday, June 07, 2009
I'm Back
Friday, May 15, 2009
Per Pixel Lighting Isn't Free
Thursday, May 14, 2009
Who Are You?
Monday, May 11, 2009
X-Plane 930 Performance and Crashes
- We communicate with the video card driver in a way that is fast on our systems but astoundingly slow on other systems. We discover this from slow performance in a particular piece of the code on other hardware.
- The new beta does something new that is more expensive than what the old build did, and users have not figured out how to (or do not have a way to) turn this more expensive option off.
Saturday, May 02, 2009
Viva La France!
The conference is officially French, and I must admit, I don't speak a word of the stuff. Fortunately, my beautiful and very patient wife will be there, and she speaks French quite well. So I have asked her to translate the rest of this blog post - a greeting to my French readers.
Bonjour. Ecoutez: Ben croit que je traduis le reste de son article sur ce blog, mais il ne parle pas du tout le français. Lorsqu'on était à Cannes, il a essayé d'apprendre à dire "Le chat est sur la chaise" - ce qui lui a fallu deux semaines! Donc il n'a aucune idée de ce que je suis en train d'écrire, et il ne saura pas non plus si traduis sa présentation correctement ou non.I am a very lucky man! I will see you all there.
Lorsqu'il commence sa présentation, je vous expliquerai toutes ses mauvaises habitudes. Est-ce que vous l'avez vu travailler? C'est tellement bizarre! D'habitude il ne porte pas de pantalon. Il s'asseoit devant l'ordinateur en buvant du café et en maudissant les "DSFs" - qu'est-ce que c'est? Je lui ai dit qu'il faut porter un pantalon à la conférence.
Friday, May 01, 2009
I Lost My Objects

In this case, X-Plane couldn't find the object KSBD_example.obj - the sim is also listing all of the places it looked. Note that only the first location is a good location - the other 3 are legacy search paths that date all the way back to version 6. It is likely that in the next major version we will trim down our search paths significantly.Failed to find resource 'KSBD_example.obj' at 'Custom
Scenery/KSBD Demo Area/KSBD_example.obj'
Failed to find resource 'KSBD_example.obj' at 'Custom
Scenery/KSBD Demo Area/custom objects/KSBD_example.obj'
Failed to find resource 'KSBD_example.obj' at
'Resources/objects/KSBD_example.obj'
Failed to find resource 'KSBD_example.obj'
at 'Resources/KSBD_example.obj'
***Error with scenery file "Custom Scenery/KSBD
Demo Area/Earth nav data/+30-120/+34-118.dsf"
(/Volumes/RAID/code/design/HLutils/Files/io_dsf.cpp: 503.)
Unable to locate object: KSBD_example.obj
Authors, do not ignore error messages like the dialog box above - every one of them indicates a condition serious enough that we think you should fix it. Non-fatal errors like these may crash future versions of the sim, or your content may simply stop working.
If you file a bug against a future version of the sim saying your scenery pack used to work and is now broken, and we find that the old scenery pack had errors, we're not going to fix the bug - we're going to laugh maniacally and dance around you in a circle while singing "told you so".
Okay - we're very unlikely to do that - but if you have errors in your scenery pack, you're doing something wrong and you need to fix it - treatment of illegal data is not stable between versions of the sim!!
I was never very sympathetic to this whole bug report because X-Plane has never accepted a DSF with missing objects - this has been a fatal* error since X-Plane 8.0 when DSF was introduced. So I simply don't understand why there are any scenery packs floating around with objects missing. Why would you place an object if you don't want to see it? The whole issue strikes me as a total failure to check quality by authors, since even running your pack once would reveal this kind of problem every time!
The motivation to make missing objects illegal comes from version 7 and ENVs. When looking at ENV scenery, I found that a large number of ENV scenery packs were missing at least some of their objects (an error that was silently ignored in ENV). It seemed like we were hiding an error and the result was authors not noticing simple mistakes that might "lose" an object (e.g. renaming an OBJ file).
Hence the "harsh" policy for DSFs - it was in response to a real problem with existing scenery!
- You don't need to have missing objects just because you use library objects from another scenery pack (that might not be around). Use the EXPORT_BACKUP command in your library and a single blank OBJ as a place-holder for the objects you want from a library that might be missing. OpenSceneryX provides a stub library that authors can include so that their scenery will load without errors even if the OpenSceneryX library is not installed.
Tuesday, April 28, 2009
A Modern Cessna
- Real 3-d lighting in the 3-d cockpit. Note how the map light tends to illuminate only some of the cockpit as it fades out.
- 2-d back-lighting on all of the major steam gauges.
- A bunch of parts can now be dragged in 3-d, including the door handles. This is done via manipulators.
- Walls! In 3-d cockpit viewer mode you won't be able to leave the airplane until you actually open the doors. The cockpit viewpoint is constrained.
- The model has the glass parts separated out for correct shadowing, and the glass works correctly from all viewpoints.
- Panel uses cockpit regions for accurate lighting.
ATTR_light_level Changed!
In particular ATTR_light_level has changed slightly from beta 7 to beta 8. If you are using this feature in your objects, you will need to update your objects.
A new ac3d beta will be posted later today that supports the updated syntax.
You can read about the syntax here.
Friday, April 24, 2009
So How Big of a Mesh Can You Build?
Wednesday, April 22, 2009
ATTR_light_level vs. Generic Instruments
...is modifying the value of a batch of ATTR_light_level tris comparable [performance-wise] with toggling the state of a backlit generic instrument? Instinct tells me that you must have the latter more streamlined than the former, but maybe not?
- The generic instrument code is pretty tight.
- Right now ATTR_light_level sometimes has to adjust shaders, which can be expensive.
- In the future, ATTR_light_level has the potential to be very heavily optimized, while the generic instrument code will always be CPU based.
- Which is more useful: to be able to have several variant images and variant images that are not "lights" (this is only possible by generics) or the ability to vary the light level gradually and not just have on or off (this is only possible with ATTR_light_level)?
- Which is simpler to author given the rest of the panel?
Datarefs Vs. Commands IV: Duplication
- A dataref represents information. You can always read it, and you might be able to change it.
- A command represents an action. You can always invoke the action, but you can't tell if it worked without looking at a dataref.
- The
cockpit2/andflightmodel2/sections were added as a new, simpler, easier to use interface for authors in version 9. (Read more here and here and here.) - In some cases, the old dataref was a bit-field while the new one is a simple integer. While plugins can use bitfields, modelers cannot animate using bit fields.
- In some cases, the old dataref did not represent a clean view of the data. Some old datarefs exposed X-Plane internal structures that are not appropriate for long-term use.
sim/cockpit/autopilot/heading_mode. This is the original heading mode, and it is marked deprecated, because it exposes a bunch of internal X-Plane autopilot values.sim/cockpit/autopilot/autopilot_state. This is the ideal autopilot dataref for plugins. It provides all functions, but since it is a bit-field it is not useful for authors.sim/cockpit2/autopilot/heading_mode. This is a clone of the original heading_mode into the cockpit2 domain. Honestly I am not sure how it got there - I know it was me who put it there, but it sure is a dumb idea; the original dataref is deprecated, so it was stupid of me to duplicate it!sim/cockpit2/autopilot/heading_state. This is coming in 930 and provides a heading-state enum set appropriate for authors...basically an enum that matches the two heading bits of the autopilot_state dataref that programmers were using.
- Try to use
sim/cockpit2andsim/flightmodel2when possible. - More recent datarefs are usually better.
- Use the most useful dataref you can find.
sim/engines/carb_heat_on Carb heat on.
sim/engines/carb_heat_off Carb heat off.
sim/engines/carb_heat_toggle Carb heat toggle.
- The command is needed to let users set up their joystick and keyboard.
- The dataref predates version 9 - writing it was the only way to invoke an action.
sim/autopilot/heading that lets us arm heading mode. This command is probably preferable to any of the datarefs for changing the autopilot state.Tuesday, April 21, 2009
Datarefs Vs. Commands III: What Is My command Doing?
- Commands have duration, and that duration is the amount of time you "hold down" the button or key that actuates the command.
- Not all commands do things for the entire duration.
- When you press and hold down the 'p' key to pause the sim, the sim pauses (or unpauses) instantly the moment you press the p key. Holding the p key down for a long time does not change this. Pause is a "momentary" command.
- You have to keep the starter button/key held down for a few seconds to start an engine. If you press it and release it, the starter motor will only run for a fraction of a second, which is not enough time to start an aircraft engine. Engine start is a "duration" command.
CMND=some/command/nameCMND=sim/starters/engage_starter_1 (key framing the animation to be "out" when the virtual dataref is 0 and 1 when it is in) then you will have a button that appears to be pressed whenever the starters are engaged. This will happen no matter how the starter is engaged - your animation will happen whether the user presses a joystick button, holds down a key, clicks on a manipulator, or a plugin runs the command.- The command
sim/operation/pause_togglewill change the sim's pause state. The instant this command is pressed, the sim will pause (if it is runnning) or unpause (if it is paused). - Holding down the
sim/operation/pause_togglecommand has no effect beyond its initial press. Hold it down for an hour, it doesn't matter. - The virtual dataref
CMND=sim/operation/pause_toggletells you if the pause command is being held down at any instant.
- The dataref sim/time/paused is 1 if the sim is paused, 0 if it is not.
- This dataref cannot be written!
CMND=sim/operation/pause_toggletells you if the pause button is being held down.sim/time/pausedtells you if the sim is actually paused or not.- They are simply not the same!
- You would use a read-only dataref for the autopilot state to turn on the indicator light. (There are two ways to do this: use ATTR_light_level to turn a _LIT texture on and off, or use panel texture and map a generic instrument like a rotary or an annunciator.)
- You would use a command to make the button work. Probably you'd use a command manipulator on the button mesh.
- You would key frame the button's animation based on the virtual dataref wrapped around the command you are using with the manipulator.
Monday, April 20, 2009
Datarefs Vs. Commands II: Which One Should I Use?
- If you want to set up a joystick or keyboard, you have to use a command. The joystick and keyboard configuration dialog box lets you associate actions with a keystroke or button press, not information!
- If you need to show the status of a system (E.g. "is the landing gear down") use a dataref. I will cover this issue in more detail in part 3, but basically only datarefs show you information.
- If there is a command that exactly does what you want to do, prefer the command over the dataref. For example, it is better to arm the autopilot using the commands than the datarefs. Changing the autopilot state often involves changing a lot of variables at once in complex ways. When you issue the command, that work is done for you, correctly, every time.
- If the command is not really suitable for your purpose, use a dataref. For example, to change the engine throttle position, do not use the command
sim/engines/throttle_upto move it up "a little bit." Use the datarefsim/cockpit2/engine/actuators/throttle_ratioto set the throttle to the precise position you want. The throttle-up command exists so that users with no joystick or mouse wheel can fly with the keyboard by pressing the F1-F2 keys (bound to throttle-up, throttle-down). It is not meant to precisely control the throttle position!
DataRefs Vs. Commands I: What's The Difference
- Datarefs are information.
- Commands are actions.
Datarefs have names that do not change. Datarefs made available by X-Plane start with sim/ while datarefs made available by plugins start with another prefix. Datarefs have been in X-Plane since the release of the plugin system in version 6.70.sim/cockpit2/gauges/indicators/airspeed_kts_pilot
You can always read a dataref, but sometimes you can change it. Trying to change a dataref usually has one of three actions:
- If the dataref is not writable at all, nothing happens.
- If the dataref is writable, it will change.
- Sometimes a dataref may be writable, but only after changing some other sim configuration. For example, you can only "write" to the control surface deflection datarefs after setting the control surface override dataref to 1. (If you don't set this override, X-Plane will constantly write its own ideas of the control surface positions to the control surface datarefs and your changes will be lost.)
- With the DataRefEditor plugin (if you just need to find some information).
- Via generic instruments.
- Via OBJ8 animations and manipulators.
- Via a plugin via the XPLMDataAccess APIs.
A command is an action that the sim can take on your behalf. For example, the command
arms the autopilot for altitude hold.sim/autopilot/altitude_arm
Like datarefs, commands have permanent names, starting with sim/ for X-Plane or other prefixes for plugins. Commands have been available in X-Plane since version 9.0.
You can always actuate a command, but there is no guarantee that it will do anything. For example, the engine starter command won't start the engine if the plane has electrical starters and the battery is dead.
You can use commands by:
- Binding them to your joystick and keyboard, in the joystick settings dialog box.
- Using a generic trigger instrument.
- Using a manipulator in an OBJ.
- Using the XPLMUtilties APIs - these are SDK 2.0 features.
Plugins can add both new datarefs and new commands to the sim. Plugins can also change the behavior of all built-in sim commands, and can change the information in some datarefs.
Where Do I Find Datarefs And Commands
X-Plane's default commands and datarefs are listed in the text files Commands.txt and Datarefs.txt in the Resources/plugins folder. (Note: providing the command list is new to X-Plane 930.) The dataref list is also available on the X-Plane SDK Wiki.
Friday, April 03, 2009
The X-Desktop and iPhone Are Not Zero-Sum Games
Someone pointed me at this post. Before I go into my geeky diatribe about leveraging code, a quick note: it is true that at this point Austin is working heavily on the iPhone - probably more on the iPhone than the desktop. It is also true (but not mentioned) that Laminar is investing more man power into X-Plane for the desktop now than it ever has in the past. (With the iPhone we've grown our workload with a second "front" for products, but we've increased staffing a little bit too.)
It is also true that X-Plane 9 free updates have been less frequent. This doesn't mean there's less code going into them - it just means that we're doing 4-5 months of coding and 3 months of beta instead of 2 months of codindg and 1 month of beta. I'm not sure if this is better or why it is happening (each release has to be individually planned for the circumstances) but one observation:
Given how many video cards and drivers are out there and how they react differently to the X-Plane code, I wouldn't want a beta process less than 2-3 months, because I want to know that it's had time to run on a wide variety of hardware. If our beta has to be at least 2-3 months, then a 3-month release cycle would have us in beta all the time!
My whiny rant (the short version) is this: Laminar Research isn't in a position (as a company selling a product) to post all of the details of how our business operates internally. So posts that say "Laminar should do X" (where X is a business decision) drive me a bit nuts, because I can't post a reasonable reply.
Now here's my real point: development for the desktop and the iPhone are not a zero sum game. Clearly we leveraged the desktop sim to create the iPhone app. But it goes both ways; work on the iPhone also benefits the desktop.
Here is one example: when beta 8 comes out, Plane-Maker's "export to object" will a much more complete OBJ, in OBJ8 format, with animations already in place for things like wing controls surfaces!
That's a feature that people have been asking about for a while - both to make CSL objects* and as a way to save time when moving from a Plane-Maker drawn plane toa custom one. (You would first export an animated OBJ8, then start adding details in a 3-d modeling program. With beta 8, you won't have to rebuild your control surfaces from scratch.)
But...it's also a feature that is critical to the iPhone! The iPhone version of X-Plane uses animated OBJ8 files as well; this feature helped us internally to prepare planes for the iPhone version, but it's also a requested feature from our authors.
So my response to those who say that the iPhone has taken away from X-Plane development is that it is not true - not only because we are developing more heavily for the desktop, but because sometimes iPhone development is for the desktop.
* I do not remember whether the current compiled versions of libXplaneMP use OBJ7 or OBJ8 objects. Since libXplaneMP uses the OBJ code from XPTools, it should be (relatively) straight forward to update libXplaneMP and the clients that use it to use OBJ8 directly. In the meantime, you can use ObjConverter to convert an exported OBJ8 back to OBJ7 for CSL use.
Wednesday, April 01, 2009
Scenery Tools Progress? Yes.
- WED could develop base mesh editing. Under this scheme, you would be able to draw land use polygons in WED and create a "DEM" object for the elevation.
- MeshTool could be an output option for QGIS (via some kind of plugin or script).
Tuesday, March 31, 2009
The New Ac3d Export Plugin (Beta 1) - You Must Update Your .AC file!
Please read the README that comes with the download completely!
An important note for anyone using an existing .ac file to make airplanes with panels:
The new plugin gives you direct control over manipulations. But older .ac files don't have the manipulator set on any of the objects. Thus if you export your airplane, your panel texture will work, but the panel will not be clickable.
To fix this, for each object in the hierarchy that has panel texture, select the object, open the X-Plane Object Properties... dialog box, and change the manipulator from "None" to "Panel". (If you don't see this option, make your properties window a bit taller.)
Note that if you don't need your panel to be clickable, setting the manipulator to "none" is slightly faster in X-Plane 930 and a lot faster in X-Plane 922.
Other details: you'll need the Commands.txt and DataRefs.txt file from X-Plane's Resources/plugins folder.
Panel sub-regions are now handled quite a bit differently - please be sure to read the README completely. If you were using the 3.1 plugin with panel regions, you may need to update your .ac file a bit.
Friday, March 27, 2009
A Bit More Open Source
- The master code is actually in CVS, but this public GIT repository is updated from CVS once an hour, so this code is very close to the latest we have.
- The full version history, tags, and other information that might be useful to a programmer are all present.
- The web interface supports online browsing of the code, as well as downloading a "snapshot" of the entire tree (as a zip, gz, or bz2 file).
Thursday, March 26, 2009
Standards Aren't Standards During Beta
Wednesday, March 25, 2009
Why Can't I Mark My Object As "Extreme Resolution"
- If the attribute on the content is request for a relative improvement in resolution (e.g. set my object to one texture res higher than the rest of the world) then what we'll have is an arms race - every author will set their content with this flag, and the result will be that the entire sim tends to run at one res setting higher than expected. The result: users without enough VRAM will turn their res settings down another notch and all the content will look like it did before.
- If the attribute on the content is a request for an absolute setting (e.g. load this texture at the highest resolution possible) some content will simply not run on some computers that do run X-Plane.
Friday, March 20, 2009
The Mathematics of Field of View and Vanishing Points
- If there is a 3-d cockpit object, the vanishing point will be the center of the screen, which is almost certainly the right thing to do for a real fully 3-d view.
- If there is no 3-d cockpit object (but instead X-Plane's default of the 2-d panel floating in space) the vanishing point will match the 2-d view, but taking the default scroll position into account. This should keep the horizon at a reasonably sane point.
Thursday, March 19, 2009
Beta 6: Cockpit Chaos
Object Materials - The Crayon Rule Lives On Forever
Objects will continue to require texture atlasing (that is, the use of one texture set with the individual images combined). Inside the company, we call this the "crayon rule" - Austin's original analogy to explain atlasing to our art team was that you draw slower if you spend all your time putting a crayon back in the box and taking a new one out.
So materials will let you change some macro-parameters of how the object is drawn, but not swap out the texture.
Wednesday, March 18, 2009
Object Materials - Some Rough Thoughts
- Materials will be controlled on the "batch" level, that is, by using ATTRibutes. You'll be able to change materials mid-object.
- Materials will be grouped into "material classes" - the material class will be mutually exclusive. So if we have a metal material class and a "plastic" material class, you won't be able to combine them.
- There will be some kind of material class that corresponds to the current behavior, and all of the existing attributes will keep working; probably there will be a newer, cleaner way to state in an OBJ what you can already do now.
- You will set all material class parameters at once. This simplifies the syntax and assures that we don't have any strange mix & match combinations.
Wednesday, March 04, 2009
Back-Lighting For All Instruments
Thursday, February 26, 2009
Separate Specular Hilites and Per-Pixel Lighting
- Separate specular hilights. Specular hilights are bright areas on the plane that simualte the refelction of the sun on a shiny surface. X-Plane has had specular hilights for a while (available by the "shiny" check-box in Plane-Maker or ATTR_shiny_rat for an OBJ). What's new is: while previously the hilights were modulated by a texture, they are now independent of the texture. This change means that even a black surface can look shiny now. Before the black surface would "tint" the hilight black, making it invisible. Now we can have a white hilight on a black surface for a glossy look.
- Per-pixel lighting (when shaders are on). Before the lighting calculations were performed on each vertex on a model, then the color from the lighting was interpolated. The problem with this is that if there is a very local lighting effect (like a specular hilight) that is smaller than one triangle, you can't see it (since we can only see the lighting at far apart vertices). With 930, the lighting calculations are done per pixel, making the lighting effects look smoother.

Next we have the same plane in 930 without shaders:

Note the increased brightness on the nacelles and fuselage. What's happening is the hilights are no longer modulated by the texture, so they show up a bit more.

Finally, the plane in 930 with shaders. Now the hilights look smoother and much brighter. This is because the hilights are calculated on a per-pixel basis. Note how the hilights are small - smaller than the triangle size on the engines. We didn't get the full "glare" effect before because the brightest part of the hilight did not land on a vertex at all, and was thus never seen.
Note that the change in specular hilight handling (moving to separate specular hilights) is a bit of a compatibility break. Previously authors could count on not having specular hilights on dark parts of a plane, even if they set the plane to be shiny.
I am not sure how we will ship the final version of 930. I have received very few (none, to be exact) complaints about dark surfaces appearing "too shiny", and a lot of users like the new shiny look.
The alternative to the current scheme (specular hilights are separate by default) is to have this be a selectable feature. Older planes would look the same as they always did, but planes would have to be modified to make them look truly shiny.
Tuesday, February 24, 2009
Hard Object Weirdness (or Don't Count On Bugs)
- Before X-Plane 815, hard surfaces acted horizontal regardless of the actual OBJ geometry.
- From X-Plane 815-922, sloped hard surfaces work as expected, but vertical hard surfaces do not work. Animation is ignored for hard surfaces.
- Starting with X-Plane 930, animation commands affect hard surfaces. However, vertical surfaces still do not work, and an animated surface does not create friction under the plane.
- In some cases a more correct implementation might take significantly more CPU power. It is important that we not raise the CPU requirements of X-Plane mid-version run.
- In some cases, we simply don't have a better implementation coded yet. Remember that X-Plane is primarily a flight simulator. My pilot friends tell me that it is bad form to collide the airplane with anything during flight. So the goal of OBJ collisions is more to detect poor flying than to correctly model the resulting aftermath. X-Plane is not GTA4!
- There is no friction. If you move a platform horizontally, the plane is not dragged along. So you can't really build horizontal elevators. (You can build a platform that moves vertically and move the plane around that way.)
- There is still not support for vertical hard surfaces. Like before, to make a solid "wall", make the wall thick and make the top of the wall hard. But bear in mind that the collision detection in this case is catastrophic; your plane will be heavily damaged by even minor contact with the wall. X-Plane doesn't support horizontal collisions right now.
- Hard surfaces are ignored for vehicles. If you are replacing the car set, don't add hard surfaces - it might turn out that some future implementation does look at them - if that happened, how would you know what the CPU hit is?
Monday, February 23, 2009
VOR Range
Wednesday, February 18, 2009
When To Cut a Beta
- Any beta that doesn't have known bugs fixed is just not as good as it could be, and is putting buggy code in the field, where those bugs take away from testing.
- Sometimes bugs are severe enough that they occlude other testing (particularly if there is a crash bug).
Sunday, February 15, 2009
The Dangers of Wandering in the Desert
I am a huge fan of incremental software improvement. That's the subject of another blog post (perhaps on another blog), but for now I'll say this: all changes to the rendering engine since version 8.0 have been incremental ones, and yet if you were to look at the code, you wouldn't see a series of band-aids taped on top of each other. Each incremental change leaves the rendering code "fully updated", as if it had been written yesterday. I start each new scenery feature by first reshaping the existing code into the most useful form for what we want to have in the future, and then coding the new feature is relatively simple.
But this strategy has an Achilles heal; if the code being refactored has a public interface (whether it is a file format or programming API), then all of the intermediate steps in the journey become requirements for future products in order to maintain backward compatibility.
This is not a problem as long as the programmer knows where he is going. The danger comes when one of the intermediate steps is actually a step in the wrong direction, and becomes dead weight around a future design.
A Reasonable Progression: OBJ
The OBJ 800 file format has had a reasonable progression* since its birth in version 8. It has gained a number of new features, but each one has generalized and made more powerful previous ideas, such that "legacy behaviors" are not so painful. Some examples:
- Hard surfaces may now be decks (e.g. you can fly under them) or not, and you can specify what kind of hard surface you have. The original hard surface command was simply "it's hard" or "it's not". But viewed under the lense of the new scenery system, that old hard surface command implicitly implied "the surface is smooth" and "the hard surface is not a deck". So the new hard surface command is a more general version of the old one, which continues to work under the new system.
- Animations in version 9 can be key framed; in version 8 you simply specify start and end values. But start and end values are just like having two key frames. So viewed under the lense of the new scenery system, all animations are key framed; older objects always just have two key frames. The new key framed commands are a more powerful, more general version of the old ones.
I have a scenery system to-do list that will last me at least another four years; most of it is filled with things that Sergio has asked for. This to-do list acts as sort of a road map for future scenery system extensions; for any possible OBJ change, I can look at it relative to the other todo items and ask: "is this extension going to play nicely with things to come?"
(As a side note, this is one of the reasons why there are not light maps in any of the X-Plane modeling formats. Light maps don't play well with a number of other scenery system extensions. I want to resolve the conflict between these future additions before they go into the sim.)
Wandering In the Desert
By comparison, the evolution of the panel system in version 9 has been more like wandering in the desert than a straight line toward a goal. Repeatedly, I put features into the panel system without a clear roadmap of where we would end up or how they would work together. The result is what you see now when looking over the panel documents: complexity and chaos.
Basically there are several major changes to the panel system that affect each other in strange ways:
- A more complex lighting model on the 2-d panel in version 920. (That is, the 3 2-d spot lights, and generic instruments with back-lit, mechanical, or glass lighting.)
- A more complex lighting model in the 3-d cockpit in version 930. (That is, 3-d spot lights, ATTR_cocpkit_region and generic instruments with back-lit, mechanical, or glass lighting.)
- A separate panel used only to provide texture to the 3-d cockpit. (That is, the 3-d panel.)
The result is two sources of confusion:
- Some combinations of features simply don't work together. Since all of the features appear to be independent, I sometimes get bug reports on these. For example, you can't use the 2-d spot lights on the 3-d panel. This is not a bug, it is by design! I will explain why some of these limits exist in future blog posts.
- Among the remaining combinations that do work together, there are a lot of choices about how to structure a plane - too many choices!
I am open to ideas on how to solve this. I intend to document a "correct formula" for a modern plane, perhaps with tutorials, on the Wiki. I am also considering programming Plane-Maker to flag unusual combinations of features as a warning when saving 930 planes.
Either way, I fear I've learned my lesson from the panel system: incremental improvement of code is only a good idea if the programmer knows where he is going! Next time I will use Google Maps. :-)
* I suppose that whether you think the OBJ 800's evolution has been reasonable depends on your standards for file formats. OBJ 800 absolutely does show growing pains. I would only say: consider the number of revisions and the change in the hardware platform OBJ 800 feeds when you consider its stretch marks.
Saturday, February 14, 2009
Scripting: A Line In the Sand
I get a lot of requests for "more power" in the OBJ or generic instrument system - the ability to play sounds, to do simple math operations on datarefs, more show-hide filters, the ability for a generic instrument to change a dataref in response to another dataref instead of a mouse click.
And invariably I say "No! Go write a plugin!", which I realize is a fairly rude thing to say to a non-programmer. First, let me explain why I say no, and then what we can do about this.
Keeping Systems Separate
These feature requests fall into two broad categories: "systems programming", which is really anything that has a side effect (play a sound, change a dataref, apply some logic), and "visualization" (e.g. a user needs more flexibility to better visualize the sim's state.
I definitely do not want any kind of "systems modeling" code inside OBJs or generic instruments. To give a trivial example: imagine that you could make a generic instrument that would set the generators to on when the landing gear is raised.
What then happens if this generic instrument is off the bottom of the screen when the landing gear is raised? Does the generic instrument get to perform its logic? Both OBJs and generic instruments are fundamentally "visualization" systems - both will short-circuit for performance when they are not visible. If we put systems modeling code into them, then the sim has to evaluate a potentially large number of otherwise unimportant (non-visible) objects and instruments to do system behaviors.
In computer programming, there is the notion of a "model-view-controller" design. The basic idea is to keep the code that changes the model, the model itself, and the code that lets the user see the data model, all separate. Keeping them separate keeps operation consistent - the model does not change its behavior depending on how you look at it, which is very important for consistent simulation.
So for all systems modeling, my answer is always the same: not in viewing code!
Expressions and Visualization
Some requests are simply requests for more visualization complexity - there is only so much you can do with key frames, animation, and a few filters.
I do have to admit that on some level, it is perfectly reasonable to ask for infinite power to visualize data in OBJs and generic instruments.
On the other hand, there would be a real cost to having programming-language complexity in what are otherwise relatively simple-to-use parts of X-Plane (e.g. the simplest model is just an export from ac3d...). My solution for both problems (systems and visualization) is a scripting system, but in the case of visualization, it is about not reinventing the wheel and keeping complexity limited to one place (the scripting system).
Scripting
Plugins have the power to solve all of these problems - they can change almost any aspect of the sim. But they are also very difficult to create; you need to be a programmer who knows a language like C or Pascal, and you need to know how to use the development tool for each platform you want to support. That's a huge amount of specialized knowledge just to customize a few systems.
Basically we need to have a line in the sand. At some point, when the systems to visualize information (OBJ, generic instruments) are not powerful enough, we need to make programming easier, rather than make modeling and authoring more complex.
What we need is a scripting system. The scripting system would provide a relatively simple text-file syntax to do simple scripting of systems and instruments for airplanes.
Such a scripting system should be implemented as an open source plugin; it should not be built into X-Plane. The advantage of this would be:
- Anyone could improve or add features to such a scripting system, not just Austin and myself.
- People could freely customize the scripting system as needed for specific projects.
- By having the code be part of a plugin and not the sim, backward compatibility would be improved - even if the "official" version of the scripting plugin changed, you could always include an older version with your plane that worked exactly the way you want.
When a user requests that I add a feature to the generic instrument system, there is an implicit request - that Austin or I take programming time to do the feature. So for now I can only say that if/when I take time to do some of these feature requests, it will be in the form of a scripting system, not as extensions to the generic instrument and OBJ systems. This will give us better long-term compatibility and extensibility (via an open source plugin) and will keep systems modeling code separate from the visualization system.
Wednesday, February 04, 2009
X-Plane 930 Beta
- X-Plane betas are open to anyone who wants to participate. You don't have to sign up, you don't have to be approved.
- If you would not be happy with a buggy, broken, weird, freaked out version of X-Plane, do not get the beta! Just wait and enjoy 922 - when 930 is debugged, it will be free for everyone.
- If you make a third party add-on for X-Plane and 930 breaks it...report it, don't fix it! Give us a simple report about how your add-on used to work in 922 and is hosed in 930, and show us where to get the add-on. None of the new features in 930 should break 922 content. Pretty much all of them do nothing until you choose to use them.
- If you make a third party add-on, get on the new betas early; the earlier you report it, the earlier we can fix it.
- Don't release third party add-ons for 930 until 930 goes final. Until 930 is final, all datarefs, SDK features, etc. are subject to change.
- Keep a copy of 922 around if you want to fly during early betas.
- Don't use early 930 betas on critical files - make backup copies!
Tuesday, February 03, 2009
Catalyst Drivers - Get 9-1
Sunday, February 01, 2009
Stuff I'm Looking At
- An airport art asset library. Sergio already started this process by making some aircraft OBJs and other elements (like custom pavement types) available in the libraries that ship with X-Plane. We are looking at extending this over time to include more useful elements for building airports.
- Sharing airport building placements the way we do airport layouts. Right now, airport layouts are shared in a communal database under the GPL license. An airport building database would work the same way - it would be a collection of placements of airport buildings, GPLed and redistributed with X-Plane. The idea would be to make it easy for people to add simple buildings to their local airport and share the results with everyone.
- Using OpenStreetMap (OSM) for roads. We've been looking at OSM for a while, but it's too soon to announce a plan.
- Sharing obstacle data with FlightGear. We already share airport layout data with flight-gear; this would be a similar initiative. We looked at OSM for this, but FlightGear's data needs are a lot closer to ours. This is still in discussion; the FG guys are a sharp bunch, so I think we'll able to work something out.
Another common thread is that these are all open data sharing initiatives. Collaborative data sharing has come a long way since we redesigned the scenery system, starting in version 8.0. My hope is that over the next several months we can make some of these ideas a reality.
But first I have to fix my 930 beta features. :-)

