Microsoft Flight Simulator X SOARS to New Heights with Multi-Threading

By Lee Purcell

Download PDF

Microsoft Flight Simulator X SOARS to New Heights with Multi-Threading**

For many pilots, no sensation evokes greater pleasure than that fleeting moment when gravity is undone, the accelerating rush of air over the curved wing surfaces gracefully lifts the wheels from the runway, and in an instant of exquisite weightlessness pulls the aircraft skyward. For many gamers and flying buffs, the closest way to capture the sensations of flying without leaving the ground has been Microsoft Flight Simulator*, a long-lived and respected presence in the oft fickle world of gaming. Now into its second decade of existence, the tenth version, Microsoft Flight Simulator X, successfully takes advantage of multithreading and Intel® CoreTM microarchitecture, thanks to ongoing collaboration between Microsoft development teams and Intel engineering staff members.

As you might expect from a computer simulation that models the intricacies of aircraft control systems, expansive scenery across the entire surface of the planet, and the complexities of flight, effective playback requires powerful processing capabilities. The engagement between Microsoft and Intel and the collaborative engineering efforts resulted in some of the most richly rendered visuals ever seen in a desktop flight simulator. The multi-threading techniques employed in Microsoft's latest release preview the possibilities in future business and entertainment software where processor-intensive tasks performed in parallel will give developers abundant opportunities to model and depict natural-world phenomena.

Multiple Cores Unlock the Capabilities of 3-D Flight Simulation


Any way you look at it, the processor demands of launching a computer-generated aircraft skyward, tracking and displaying its movement above diverse landscapes, and responding to the physics involved in flight maneuvers are considerable. For many years (since 1982 when the IBM* PC version was released), Microsoft Flight Simulator has pushed the boundaries of processing power and graphics display capabilities. Not everyone realizes that the first version of Flight Simulator, created by Bruce Artwick, flew on an Apple* II computer in 1980, where budding pilots had to use a lot of imagination with only a four-color or monochrome screen to display the surroundings and a rudimentary two-gauge panel that delivered airspeed and altitude data.1

The second generation Microsoft release, FS 1.0, modeled the behavior of a Cessna 182, improving on the prior Apple version by offering eight gauges, an improved coordinate system, four unique scenery areas with 20 airports to choose from, a pair of COM radios, and distance measurement equipment (DME). The simulator factored weather into the flight performance, giving the user nine different view directions, but the display characteristics were closer to abstract art than photorealism, with only four colors plus dithering to replicate the cockpit and scenery.


Figure 1. This screen from FS 1.05 tests the user's usual acuity to identify the Statue of Liberty.

Anyone with a sense of nostalgia about the good old days of computing can experience the early flight simulators- downloadable from The Old Flight Simulator Vault (http://fshistory.simflight.com/fsvault/). Emulators, available for downloading, allow early Apple, Commodore*, and TRS-80* versions to run on modern equipment, offering a revealing picture of how far the simulator has advanced.

---
1 Flight Simulator History, http://fshistory.simflight.com/fsh/timeline.htm.
Over the intervening 25 years, improvements in Microsoft Flight Simulator have mapped closely to the improvements in personal computing as displays have become capable of producing millions of colors and processors in home machines rival the performance of supercomputers of years past.


Figure 2. The view inside the cockpit is now a far cry from the early release days of Flight Simulator*.TM

Credit multi-threading and multi-core processing for much of the enhanced graphics environment in Flight Simulator X. Parallel processing provides significant inherent advantages when modeling the world. The complexities and difficulty in capturing real-world phenomena algorithmically and depicting intricate 3-D computer-based environments can be effectively mastered using threading techniques and multi-core processor architecture. By deploying processor-intensive tasks on individual threads and keeping tasks running in parallel, game designers and other application developers have overcome previous constraints and can now create visually stunning applications with unprecedented capabilities.

Sharpening the Visuals


The collaborative engineering engagement between Microsoft and Intel took place over approximately six months, beginning in December 2006. Early in the engagement, the Microsoft developers and Intel development support team targeted their efforts on enhancing the visual quality of Flight Simulator X, rather than on improving the frame rate.
The Flight Simulator X Service Pack 1 download includes these performance improvements and graphics enhancements along with the architecture optimizations and the multi-threading capabilities.

Seung-Woo Kim, senior application engineer at Intel, was involved in the project from the earliest days. "There are essentially two ways to use multi-threading for the Flight Simulator. One is to increase the frame rate. Another is to increase the visual quality. Last year, the primary concern at Microsoft was both, but they were more concerned about the visual quality of the software. We decided to use multi-threading to increase the visual quality, instead of increase the frame rate." Essentially, by distributing the workload across multiple cores, Microsoft was able to substantially enhance the overall visual quality without loss of frame rate.

"We made extensive use of Intel® VTune Performance Analyzer and the Intel® Thread Profiler, ITT 3.0," Kim continued, "resulting in a substantial performance improvement in the flight simulator."

To enhance the visual quality of the simulation, a number of threading techniques were used. The first thread manages the game rendering and processes the artificial intelligence and physics algorithms. On a system platform with more than one core, multiple terrain tessellation simultaneously executes on the second, third, and fourth cores. Digital elevation model loader and texture composition tasks are encompassed in this processing as well.

The net results are a lower latency in texture calculation and a much clearer visual image displayed at varying elevation levels. Processing multiple tessellations concurrently ensures balanced usage of available cores and also contributes to significantly faster load times. As figure 3 shows, the level of detail when quad-core processing is involved provides a crisp, realistic image and a heightened user experience.

"Optimizations done in Flight Simulator* deliver the most realistic flight simulation experience possible when running on Intel® CoreTM2 Duo and CoreTM2 Quad processors. As a result of global scale multi-threading, terrain textures, shades, and shadows are processed in real time without the loss of frame rate-delivering a difference users can see when they move from single-core to dual-core to quad-core processors."
-Mark Swearingen, director Microsoft program office

The Art of Texture Processing


Much of the processing work done in Flight Simulator X involves texture processing. As Kim explains, "We are flying around a vast area of the earth. Unlike the shoot-em-up games, you cannot just load one stage, play a little while, and wait about 30 seconds or so to go to the next stage. Everything has to be done in one go. Once you are loading in a flight, you should be able to fly the entire world without pausing or stopping at all."

"Because of this," Kim continued, "you need to continually load the game contents while you are flying. This also means that you need to do the texture processing on the fly while you are playing the game."

When the player is viewing detailed areas close to the airplane, the display requires high-resolution textures. From far away-10 or 100 miles-those high-resolution textures aren't needed and can be cleared from memory.

Loading textures is one aspect of the texture composition task, but you also need to do pre-processing before you push a texture to the graphics card. For example, each texture on the drive is a basic texture, but once loaded into memory, the texture must be modified based on the contour of the landscape, the "landclass" associated with that texture cell, and the location of the sun. Shades and shadows created by the location of buildings and other structure must also be taken into account.


Figure 3. On the left, the figure shows the detail rendered by a single core as compared to a quad-core processor on the right.

As the texture is loaded, the processor calculates all of those factors-a very time-consuming job. For more detail on the entire texture synthesis process, see: Global Terrain Technology for Flight Simulation

A single processor is not fast enough to update this structure and burn in those textures in real time and allow a high slider setting at the same time. As the airplane flies over, you cannot catch up to the contour location of the airplane.

Before multi-threading, FSX used a technique called fibers on single-core machines to handle sub-tasks (including texture processing) during available intervals, as dictated by the frame rate and rendering requirements. The level of detail generally had to be reduced by means of the slider settings because the background processes could not be allowed to interfere with the graphics rendering. For example, with a target frame rate of 33 frames per second, each frame runs for 30 milliseconds. Critical jobs, such as rendering, might require about 20 milliseconds. This leaves about 10 milliseconds before the 30 milliseconds allotted to the frame elapses. Those remaining milliseconds are all that are available for performing background processes, such as the texture loader and the composition, as well as burning all the required shadows.

Multiple cores make it possible to break down individual tasks and perform them concurrently. With the multi-threaded version of Flight Simulator X, those background tasks are running in the separate cores now. No matter how much time it takes to render the scene- the main task-the other cores are still processing the background and texture composition. Consequently, the texture is always updated in intricate detail.

"The latest version of Microsoft Flight Simulator* X Service Pack 2 (SP2) is a great match for the extreme multi-core processing delivered by the new 45nm Intel® CoreTM2 Extreme processors. Flight Simulator X SP2 greatly increases multicore utilization and will scale as more threads are available leading to reduced load times as well as frame rate improvements and great visual complexity during flight. The Flight Simulator team at Microsoft is pleased to work with Intel to provide our end users with a great gaming experience."
-Phil Taylor, Flight Simulator program manager, Microsoft Game Studios

Tools That Made a Difference


Tuning and optimizing benefits using Intel VTune Performance Analyzer and Intel Thread Profiler developer tools proved invaluable in identifying code bottlenecks in Flight Simulator X and determining the most effective ways to employ multi-threading throughout the application. The results include smoother-running simulations, improved artificial intelligence features, and some of the richest, most detailed 3-D environments ever presented in a program of this type.

Much of the success of the Microsoft Flight Simulator X release is due to the collaborative engagement between Microsoft development groups and the Intel engineering support team. The advantages of tuned and optimized software running on the latest multi-core processor technology can be readily seen in the astonishing simulator imagery and experienced in the responsive simulation playback. Utilizing multiple processor cores efficiently and effectively is the future of software development, unlocking vast new application opportunities.

Three-Dimensional Modeling and Parallelism


Modeling of the natural world-whether the complexities of flight, the variables of meteorology, the biological intricacies of humans or animals, or other realms of scientific inquiry-can be handled more successfully with parallel processing. As Intel rolls out a new line of fast, efficient quad-core processors, including the Intel® CoreTM2 Quad processor Q6600 currently drawing attention from serious gamers, application designers look ahead to eight cores, 16 cores, and beyond. Well-threaded applications automatically scale as additional cores come on line, adding an element of future proofing to skillfully engineered game designs and applications. Development tools, such as Intel VTune Performance Analyzer, Intel Thread Profiler, Intel® Thread Checker, and Intel® Threading Building Blocks, are a programmer's best friend when it comes to multi-threading tasks. Thinking "parallel first" when programming opens the ultimate capabilities of multi-processor architectures, leading to new business opportunities and product possibilities.

---
For more information about Intel® threading analysis tools, visit: /en-us/intel-sdp-home/
For more about Microsoft Flight Simulator*, visit: http://www.microsoft.com/games/flightsimulatorx/

Threading from the Microsoft Point of View


Phil Taylor, the Flight SIM program manager at Microsoft, talked a bit about the multi-threading improvements to the application in a posted article, SPI: How to Prepare For It and What You Get When You Install It.2 In this piece, Taylor said: "Intel is using FSX as one of their prime examples at IDF, so we had a lot of engineering time from one of their threading guys. Intel doesn't do that lightly. We used the time to good benefit.

During loading, we run the DEM loader on threads. You'll see good balanced usage across all cores, as well as about 1/3 faster load times on average.

During flight we spawn threads for Autogen batch rebuilds as well as the terrain texture synthesis.

The terrain texture work tends to be a bit bursty; as an area gets generated the load reduces true. But as you fly forward, as you bank, and as the terrain is lighted (once a minute) threads are spawned. The terrain grid system is radial around the current viewpoint, and, depending on level of detail, radius can be up to 4.5 tiles in either direction, something like 64 tiles. So there is plenty of work to go around. Autogen is more constant, with a 2 km extent being batched.

Even given the bursty nature of the core usage when flying, when there is load, it's pretty balanced across the cores. And we got rid of as much of the stutters as we could by going to a lock-free synchronization style. It's solid work that we are deservedly proud of.

As far as practical limits on number of usable cores, currently SetThreadAffinityMask only allows explicit scheduling of threads on 32 cores (the mask is a dword) on Win32. So that's our effective limit on number of cores. But as soon as there is a way to explicitly schedule them, we can handle 256 cores."

Developers and FSX aficionados may want to follow Phil Taylor's blog, Performance Tips and Tweaks, for more details about achieving optimal performance with the application.
---
2http://www.microsoft.com/Products/Games/FSInsider/tips/Pages/SP1HowtoPrepareforSP1andWhatYouGetWhenYouInstallIt.aspx

 


**[EDITOR'S NOTE: This article was independently acquired and published by Gamasutra for inclusion on its platform-agnostic Intel Visual Computing microsite. It is republished here with permission from both Gamasutra’s editors and the article’s author.]


 

Here's your chance to get the latest E-magazine from Intel® Software delivered directly to your desktop. The Intel® Visual Adrenaline magazine is published quarterly, and delivered to your e-mail inbox as a directly downloadable PDF. (No, it's not sent as an attachment.)

With every issue of Intel® Visual Adrenaline, you’ll get inside the visual computing industry through the eyes of game developers, industry leaders and experts, featured artists, and cutting-edge businesses who share with you:

  • New games, cool tools, and apps
  • Techniques, technologies, and methodologies
  • Visions and opinions on all areas of visual computing: gaming, graphics, animation, video, physics, engines, and more!

Capture the buzz. Subscribe to Intel® Visual Adrenaline today. (Did we mention it’s fun, informative, visually stimulating, free, and you can unsubscribe at any time?)
Go here to subscribe to the premium, free Intel Visual Adrenaline magazine today.

For more complete information about compiler optimizations, see our Optimization Notice.

Comments

It is too bad that Microsoft jettisoned the Flight Simulator team after all of these years. It was a team that really showed how to push DirectX and Intel hardware in the simulation front. Another institution falls by the wayside.


FSX is a shit!!!! We spend a lot of money in it, and it's the same: don't work. Why did you make a game that doesn't work at all?????? It's so heavy, that doesn't matther what we do, it won't work! I have a notebook with all needed specifications on the box, and, again: DON'T WORK!!!!! I' ll never spend a cent with microsoft fsx again. That's it!


Ricardo, si realmente no te funciona FSX es porque no has aplicado los últimos descubrimientos que ha hecho Jesus Altuve (Bojote). Pásate por esta página y descarga el FSX.CFG que te crea a partir del tuyo y de unas preguntas simples sobre tu equipo. Espero que el resultado te haga cambiar de opinión... conmigo y mucha otra gente, nos cambió la vida en FSX!!!

Un saludo

Gerard (gcabezonb (at) gmail (dot) com)


No real simmer would buy a notebook to run FSX, not even one of those "gaming" notebooks. FSX is one of the more demanding applications you can use, it's a simulator, not a game. The specs on the box as usual are more or less the minimal ones to run it with very low detail settings. If you want to get the best from it, you need a high-end system, with fast CPU and graphic card(s). Anyway I am still running it on a PentiumD with a nVidia GTX 9800 card, and it works well enough, not at full steam, but enough to fly proficiently.