Where Am I?

A thread on FlightSim.com’s FSX forum caught my attention recently. In short the person was frustrated that when you drift off the runway while using ATC in FS2004 you get told to “contact ground”. In this user’s case he was doing pattern work and likely just got a little sloppy. He wanted ATC to be smart enough to recognize this and let him straighten out and take off again. It got me thinking.

 

First off, though, I know from personal experience this would not be “as real as it gets”. I’ve been (mis-)fortunate enough to “depart the paved surface” 4 times in my flying career. Three of those were in my own aircraft (a Maule M7-235-C) at my home airport, which is uncontrolled. The other happened in my instructor’s J-3 while I was a student pilot and returning from my first solo long cross-country flight. My route took me from Seattle to Bellingham with a stop in Arlington and I had been fighting strong headwinds on the return leg (watching traffic on I-5 outpace me). All in all I’d been flying for almost 3 hours when I started my final approach. Exhausted, I committed the cardinal sin of tail wheel landings by relaxing my concentration (as well as my “dancing feet”). I don’t remember whether I caught a gust or was just not tracking straight but immediately after touching down the tail bounced and started to wander around toward the nose. Luckily I kept the tail behind the nose but did wander off the runway a few feet before coming to a stop. The tower controller was kind enough to ask me if I was alright (after which he asked if I had run over any runway lights) before giving me my taxi clearance. So, even a few feet off the runway is enough to get the attention of ATC.

 

But I digress. (Yes, I know. This shocks you.) Anyway, to understand the problem it helps to know a little about how ATC works in Flight Sim, specifically that ATC does not store very much information about your intentions. Instead it tracks and continuously computes your state. What do I mean by state? In the case of ATC state is information such as: are you on the ground or in the air? Have you requested flight following? Do you have an active flight plan? Do you owe ATC a response to a clearance?

 

Why does it work this way? Because you can do things in the game that you can’t do in the real world. For example, consider what happens when you first launch a flight. You’re sitting at the end of the runway and the ATC menu options (at a controlled airport) are to contact ground or tune ATIS. Suppose you then enter slew mode, jump up to a thousand feet, and switch back to flying. If ATC simply thought you were about to contact ground it would be pretty confused to suddenly see you in the air! Instead it re-computes your state and offers you a set of appropriate options. In this case it shows you the nearest airport list so you can contact the tower and ask for landing clearance if you’d like. So the moral is that just because you tell ATC what you intend to do doesn’t mean ATC can trust you!

 

One suggestion in the thread was to have more tolerance in FlightSim for where the aircraft is in relation to the pavement. This got me thinking about how the game engine determines where the aircraft is in the world. It’s a far more interesting and difficult problem than I thought it was the first time I had to consider it.

 

Ignoring the third dimension for a second let’s think about an aircraft sitting on the ground at an airport. Where is it, really? Is it on the runway? How do we know? In this case we can simplify things by reducing the aircraft down to a single reference point and perform a point-in-polygon computation against the rectangular runway. Point-in-polygon queries are very common in any 2D or 3D game and by themselves they are very fast math operations. But you need to be careful not to make too many of them or make them too often otherwise you might drag down performance. The “is the aircraft on the runway?” calculation is nice because the runway is a simple polygon. Extend the same logic to taxiways and aprons and the number of calculations explodes. That’s why it’s much easier for ATC to ask “is the aircraft on the runway?” than “is the aircraft on a taxiway?” or “is the aircraft near a runway?”

 

Another issue is where the data for these polygons is stored. The game engine in Flight Sim is made up of a number of independent but related systems. In order for ATC to know whether the aircraft is on the runway it needs to have access to data structures that represent the aircraft and runway in 2D space. Some of this data is also needed to do things like render the runway on top of the terrain—a completely different system. Where should this data be stored? The simulation system? The terrain system? Some other system? It doesn’t make sense to duplicate it yet each system needs the data for different reason. For example, taxiway data (a network of nodes and lines) is passed to a system that constructs 2D polygons used to render the airport but the elements significant to ATC aren’t retained. Furthermore, the airport renderer may do things like add extra polygons at intersections to create smooth curves. ATC cannot query for this information. The sim engine can, since it needs to know whether the aircraft is on a hard surface or not, but it doesn’t distinguish a hard surface taxiway from runways, apron, roads, helipads, etc.

 

And, hey, let’s not go into having a third dimension to deal with complicates things!

 

In summary, a lot of effort goes into designing interdependent systems and data structures in order to find the right balance of functionality and performance (as defined by memory usage and CPU cycles). As long as we need to make tradeoffs to find this balance there will always be situations where the game doesn’t behave like you would expect or desire. But do trust that with every version we try to take advantage of greater hardware capabilities and programming techniques to make Flight Sim more and more like the real world.

Comments

  • Anonymous
    January 27, 2006
    Thanks for the explanation, Mike. I'd never thought of it as related to a polygon, rather more like distance from the centerline. While I'd figured there'd be some performance penalty for changing the algorithm, I didn't realize it'd be that large. Since performance is very important... Larry N.

  • Anonymous
    January 28, 2006
    Having different voice accents throughout our beautiful planet would be great and would increase the "travel feeling".

    A better acft separation in order to avoid GA's would be nice too.

    Good luck

  • Anonymous
    January 28, 2006
    The comment has been removed

  • Anonymous
    January 28, 2006
    I love the way you give me insight in the game I've been enjoying the last couple of years...great stuff!

    Keep it up please!

  • Anonymous
    January 30, 2006
    Mike, Thanks for the info, the one update I would like to see with the ATC is spacing out the planes. The other day at BOS with in about 3 miles there were 2 737's and my 747-200 coming in. It would just be nice.

  • Anonymous
    January 30, 2006
    mike, i´m playing that great game since fs4, and i´m in love with it.but please! is it possible to realize that atc is able to make a pushback conversation, and the fs is able to do an pushback automaticly, not by using the "y"?PLEASE!PLEASE!PLEASE!

  • Anonymous
    January 31, 2006
    The comment has been removed

  • Anonymous
    January 31, 2006
    I would like FS ATC to talk to me only. When I'm flying or on the ground, I hear all of the ATC chatter from the other planes too. It would be nice to only have MY conversation with Control. When ATC is talking with other aircraft, I can't respond until they are finished, which can be some time if the area has a lot of planes. This blog site is great.

  • Anonymous
    February 02, 2006
    Well, I for one don't mind then asking to contact ground if I hit wrong polygon by mistake.But what I do minda) they do not use SIDs nor STARsb) mentioned above - transition alt is often wrong (fixed at 18000 ft)c) ATC do not use speed to separate aircraftsd) they do not use holding patters at allIf you can check addon called Radar Contact (v4) - this is what FS ATC should be + ground handling (already in FS, working in most cases fine) + FS great voices/speech.I don't care at all about regional differences, if ATC never holds me anywhere and I can't fly SID out of big airports.

  • Anonymous
    February 04, 2006
    The comment has been removed

  • Anonymous
    February 11, 2006
    The comment has been removed

  • Anonymous
    February 21, 2006
    Hi,

    How easy would it be to implement a 'Fly Me' menu option into FSX?  By this, I mean that an ai pilot takes over your a/c until you stich off the option.  It would be nice just to sit and watch the flight and learn from how the ai flies the airplane, right down to taxying and starting up/shutting down the engines.  I assume the algorithmn logic is already there as ai already know how to fly the fp routes.  It would also be nice to site with a wing view and watch the world go by as a 'virtual passenger'!

    Dazzy.

  • Anonymous
    September 12, 2006
    fligh unlimited III had coments like thanks for mowing the grass
    now get back on the runway.                            lol

  • Anonymous
    October 16, 2006
    atc needs an emergency contact --mayday lost power or something like that to give clearance to land at nearest airport. Don Hunt

  • Anonymous
    October 24, 2006
    i love the way everybody is so critical of this game. i love the progress MS have made with this game. ooh and i love this blog, it has made me see the development of this product in a whole different light. some people have complained that this product is not complete but there's an old saying "you can't please everybody".

  • Anonymous
    March 18, 2007
    fsx is great but how do you open all doors on the aircraft?