Jump to content
The simFlight Network Forums

How FSX makes decisions


Recommended Posts

Dear friends, there have been several topics on this forum now about specific decisions that FSX takes related to AI traffic, from parkings over runways to directions. Therefore I discuss here how, according to all I know, FSX makes decisions, and why they are very different to what a human being would decide.

In principle, there are two ways to decide. The usual way we do it is to estimate consequences, and our human brain is very powerful to habe a rough estmate of future consequences due to past experience, and we react mostly out of our subconciessness ( that uses 95% of our brain ) than out of our intelligence ( that uses 5% only ).

To bring this onto the computer, the computer would have to calculate what will happen in advance, so not only the current frame, but also the next 10 minutes minimum, at 25 frames per second, 1500 frames per minute, so the next 15000 frames. We know now that current hardware has problems to get one frame done in time - to have a real concept of future our computers would need to be 15000 times as fast as they are now. And if they were, I assume you would want to have more details and not just a better basic logic...

The alternative are weighting algorithms. Let me describe how FS calculates which parking should be used for an AI plane when it has landed and shortly stops on the runway.

FSX loops over all parkings. If they are used, they get the weight 0 and the loop goes over to the next one. Otherwise, from ATC parking code ( airline code, if programmed into the aircraft and the parking ), parking type, parking radius, and distance from the current location a weight is calculated. The detail of this formula I do not know, but every free parking gets a weight - 0 if it is significantly too small for the aircraft. Parking codes have the largest weight.

This weight always is a compromise, it may well be that on a crowded airport ( especially if some parkings are assigned to airlines ) a gate fitting to the aircraft in size nearby gets a higher weight as a far away cargo parking that is larger, despite it is a cargo plane, but it is a rather fast algorithm.

Now, if the maximum weight is 0, there is no solution where to park the aircraft, and it gets deleted. The art of AI programming is to have this to be a rare case with normal traffic settings ( 50% AI density) , and in MyTraffic a lot of work has gone into this optimisation.

It should be mentioned that the same, looping over all aircraft that are on the airport, is done during the fast phase of scenery loading. This means that the first aircraft will get the best fitting places, without looking if other aircraft would fit there better.

Still, on larger airports this loop can go over hundred and more parkings, so we speak about several thousand calculations that have to be done. Each subsystem in FSX only gets a certain amount of CPU time warrented - so if you have no spare CPU time, it will happen that this calculation gets aborted before all the parkings are evaluated, in this case the first best will be used. This is what happens if you have the frame delimiter above your actual frame rate, and especially at unlimited. The loop will terminate after a few parkings have been evaluated, and what happens will be completely random.

Other decisions, like which runway gets used, etc, use similar procedures. Since they do not calculate in advance the consequences, they work astonishingly well, with a low failure rate of a few % only - but these failures will happen, and there is no way around them.

Link to comment
Share on other sites

More than once it has happened to me that an aircraft will sit on the runway but not take of. ATC tells me to hold position. After a few minutes, the plane gets deleted. Nothing was blocking the runway, and this happens right 15 minutes into the sim, with enough cycles left over for the AI. The last time I remember, this happebed at EDFH, a Ryan 738 behaved as described.

Link to comment
Share on other sites

One known reason for this to happen is overflow of the ATC stack. ATC can only queue a limited number of calls, if there are too many some get forgotten, and the aircraft will just be forgotten. I would not have expected this at Hahn, since ATC is rather quiet there compared to other airports.

Link to comment
Share on other sites

  • 11 months later...

A piece of research I'm doing for STB involves predicting how FSX selects a runway for use for a given AI (and user aircraft). Let me start by saying what I do know:

a) The coordinates of the AI/User aircraft

b) A list of runways for all the world's airports, including:

i) The runway threshold coordinates (AFD "Start" point)

ii) The orientation of the runway

iii) Whether it is open, closed for takeoff, closed for landing

c) The direction of the wind.

So how does FSX determine the runway, especially if there are multiple choices? My guess is the closest available runway is chosen (closest being "as the crow flies") for both an arrival request and a departure request. "Available runways" depend on closed state and wind direction.

Any comments?



Link to comment
Share on other sites

The same way as all decisions.

For each runway, a probabilty is calculated.

Open/close information gives a certain amount of weight ( a big one ), wind direction gives a big weight, and distance from aircraft to start point enters in this. Maybe also length requirements, for sure surface pproperty compared to aircraft requirement, maybe more... All this gets summed up and the one with the smallest weight will be used.

In case of Heathrow, with two runways parallel of same length and surface and width, if both are open this comes down to the distance only, with more complicated layouts this may depend on wind direction, wind speed for two non parallel runways that have similar distance from the aircraft. Usage of runways is not taken into account, so FSX does not try to prefer unused runways.

Link to comment
Share on other sites

  • 2 months later...

I'm alive :) Apart from flying a bit and giving support for my own add-on, FSX was gathering dust for me.

Recently I picked it up again and started browsing some forums again, we'll see what happens.

On topic... I've done a lot of research on how FSX will assign runways. The two most important things to remember:

1) There is a bug in it, related to closed runways. For both the primary and secondary runway start, FSX will check the 'Closed for Take-off' flag for the primary. (There may be bugs in this line as well, since I don't recall exactly what got checked instead of what, but there is a mix up there)

2) The assigning algoritm is (totally) incompatible with the crosswinds/Star technology. The FS algorithm is based upon the fact that it only has to make a decision between true parallel runways. Tying non parallel runways together using the Star technology breaks the algorithm. Ever wondered why you had to taxi to a runway on the other side of the field while you are standing almost next to an available runway? It's a side effect of the Star technology. FSX will send you to the closest available runway. But closest as in: the shortest distance between you and the great circle through the runway (or the centerline of the runway extended all around the world). Now this works ok if all available runways are truly parallel. But if they are not, you could be 300 feet from runway 18, but still be send to runway 27, 5000 feet away, if the extended centerline of that runway passes within 300 feet from your parking position.

The algorithm itself... have to look it up, but it involves the wind (which is only evaluated for the first runway in a group, again since FSX thinks all runways in a group are really parallel) and then the type of engine and the weight of the plane to determine the required length of the runway and, as said, the distance between the plane and the extended centerline of the runway.

Another bug is the distance between the runway start and the plane that is needed before a plane will ask for T/O clearance. This threshold is too small for for instance 18C at Schiphol. Planes will taxi there but just hold short because the T/O request is never triggered.


Link to comment
Share on other sites

Each subsystem in FSX only gets a certain amount of CPU time warrented - so if you have no spare CPU time, it will happen that this calculation gets aborted before all the parkings are evaluated

Is this perhaps documented somewhere? I'd be quite interested the find out a bit more about this.


Link to comment
Share on other sites

Some of the blogs of Phil Taylor discussed it, other things are from a newsgroup that closed some years ago...

But if you are a programmer, you know this is the fastest way to do things, and if you make realtime programming, that is standard technology...

Link to comment
Share on other sites

  • 2 weeks later...

So far I have not been able to find this in FSX, once FSX starts searching for a parking spot it will scan all of them and return the best match. On a higher level though the scheduler does kick in. The agents that act as ATC Controllers are part of the 6Hz group. I haven't analyzed it in detail but I could very well be possible that if an agent has to find 7 parking spots and it will only get time to look up 4. But once it starts searching for a specific plane it will scan all of the parkings.

The scoring algorithm is rather complex, the details I have deciphered so far are in a Wiki article over at fsdevelopper: http://www.fsdeveloper.com/wiki/index.passignment


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.