Nool Aerosystems
Airport traffic for Geneva
Vehicle system

Airport traffic for Geneva

Follow our dive into the most complex ground vehicle system ever created for Microsoft Flight Simulator as we explore its origins and unique features.

Trial by fire at Malmö

In early 2022, Marcus Nyberg and Orbx Simulation Systems were working on a new version of Malmö airport in southern Sweden. They approached us for jetways. The cooperation quickly expanded into providing airport vehicles that would drive around Malmö to create illusion of airport full of life.

The first iteration was something that many have done: vehicles were placed around the airport and each had an associated script that made them drive around by assigning waypoint lists to follow. They were like amusement park rides, always doing the same thing without any variation.

We tried to add variation by providing several possible waypoint lists for each vehicle to make them less predictable, but this quickly spiraled out of control into unmanageable mess as the number of vehicles grew.

In the end, the first version was never released to the public because it was simply not good enough.

Instead, we chose to leave behind the scripting system provided by Microsoft Flight Simulator and focus on programming an entirely new module that would create random routes on the fly, taking into account desired traffic density, availability of destinations, and other factors.

Humble beginnings. The first vehicles at Malmö. Humble beginnings. The first vehicles at Malmö.

Scheduler and collision avoidance

At the heart of the module is a scheduler that manages vehicles and ensures that traffic density follows a 24-hour cycle. In the morning, the airport roads are the busiest. Vans are driving between different areas of the airport. Tractors are pulling trailers with luggage and cargo containers. As the day turns into evening, traffic settles down and little remains after the evening rush. At night, a lone vehicle can be seen here or there.

Taking direct control over vehicles with the custom module opened a whole new world of possibilities. The most pressing issue was collision avoidance. Vehicles seen in Microsoft Flight Simulator usually either stop when they are anywhere near an airplane, or just plow through everything.

Neither is a good option. Malmö has service roads between terminal building and parking stands. If vehicles always stopped near airplanes, we’d just have traffic jams near every airliner parked at the terminal. Malmö also has service roads crossing taxiways. There we definitely want vehicles to stop, and not just anywhere, but specifically before they enter segments going over a taxiway. If they are already crossing, it is best to let them continue and get out of the way as quickly as possible.

Rainy day in Malmö. Tractor with cargo containers waiting for the A320 to pass. Rainy day in Malmö. Tractor with cargo containers waiting for the A320 to pass.

With the custom module, we were able to achieve a sane driving style that depends on the situation. Once vehicles were smart enough to stop for airplanes, the next step was collision avoidance between themselves.

Countless hours of trying different approaches eventually led to a solution that handles most conflict situations in a natural manner. At intersections, vehicles give way. When a car reverses out of a parking spot, it waits until it is clear of traffic, or others stop to let it reverse. Fast vehicles slow down and match speed of slow movers like tractors with heavy cargo containers.

Vehicles may sometimes still drive through each other, but usually this is necessary to avoid complete gridlocks where a van blocks a tractor, the tractor blocks a truck, the truck blocks the van - without any of them being able to drive out of the traffic jam.

Trailers and articulated busses

On the visual side of things, choosing the path of a custom module let us create vehicles that are more complex than a regular car or a van. Initially, the tractors that pulled trailers were single objects that bent sideways to match the turning radius and leave an impression of a realistic train.

In the first update to Malmö, they were replaced with true trains. Each trailer is now a separate object. Trailers do not slide along precomputed rails. Instead, links between trailers are fully simulated. Tractor pulls the first trailer, that pulls the second tailer, and so on.

Malmö was followed by Gothenburg, another Swedish airport. Gothenburg has a prominent bus bay sticking out in the middle of the terminal, served by long articulated busses. Naturally, we had to bring them to the Flight Simulator and make them bend like their real counterparts.

Improving driving AI at Arlanda

After Malmö and Gothenburg came Stockholm Arlanda, the largest airport in Sweden. Essentials like scheduler and collision avoidance were relatively mature at this point, and we could spend more time on driving AI.

When vehicles are assigned waypoints, Microsoft Flight Simulator’s driving AI assumes control and steers them from one waypoint to the other. Unfortunately, the AI tends to understeer, which results in vehicles rarely staying in their lanes, and being unable to make slow and tight turns required to navigate confined environments. Driving AI seems drunken, deviating significantly from the optimal path.

For Stockholm Arlanda, we replaced the stock driving AI with our own that takes into account the upcoming road geometry and adjusts heading and speed accordingly. We also ensured that it can drive through underpasses and overpasses. Arlanda has quite a few of them.

With subsequent updates, these improvements were ported back to Malmö, Gothenburg, and Stockholm Bromma, which was a smaller side project.

Containers at freight terminal in Arlanda Containers at freight terminal in Arlanda

Further refinement at Geneva

By the time Geneva came around, preparing the road network for pathfinding was still a time-consuming exercise that required lots of fine-tuning, which stretched development time.

Vehicles followed the shortest path to their destination by default. If we wanted them to always arrive from one direction and leave the other way – like when busses pick up or drop off passengers – we had to manually encode that information into path segments.

Geneva saw improvements that made such manual tuning obsolete. Pathfinding algorithm is now smart enough to consider multiple options and choose the best one. Whenever possible, vehicles prefer a small detour over making difficult turns in confined spaces. If their destination requires arriving or departing from a specific direction, then vehicles can now pick the proper paths automatically.

Needless to say, this increased computational cost and affected performance. The first prototype took 480 milliseconds on average to prepare a route for a vehicle. Microsoft Flight Simulator runs modules in the main loop, meaning the simulator stuttered for half a second every time a route was calculated. We needed to optimize the algorithm. By precomputing as much as possible at simulator startup, and dividing runtime pathfinding calculations over multiple frames, we were able to bring that down to less than a fraction of a millisecond.

This freed up so many resources that we were able to revisit collision avoidance and implement traffic flow modeling for significantly improved vehicle behavior.

Parked van at Geneva Parked van at Geneva

Geneva airport by JetStream Designs was released on 20th September 2024. The vehicle system is widely considered one if its highlights.

We will take a closer look at the vehicles themselves in a future article.

Next work