Microsoft Simplifies Development of Stunning High ...



Overview

Country or Region: United States

Industry: Software Engineering

Customer Profile

Microsoft Corporation is a leader in technology that transforms the way we work, play, and communicate. Its mission is to enable people and businesses, worldwide, to realize their full potential.

Business Situation

Microsoft wanted to simplify the development of world-class multimedia applications without significantly reducing application performance.

Solution

Microsoft developers “wrapped” Microsoft® DirectX® for use with a variety of programming languages to simplify the creation of stunning, fast multimedia programs.

Benefits

■ Cost-effective, high-performance, managed application programming interfaces

■ Rapid time-to-market

■ Superior development environment and resources

| | |“The managed DirectX API worked so well that we plan to use this same library to develop our next game.”

Marshall Belew, Lead Developer, Koios Works

| |

| | | |Computer game developers are constantly challenged to create feature-rich, fast games within shorter |

| | | |product release cycles. To help simplify game programming, Microsoft Corporation created the |

| | | |Microsoft® DirectX® application programming interface for building applications rich in graphics, |

| | | |video, and audio. DirectX applications are typically written in the C/C++ programming language |

| | | |because of their complexity and need for high performance. But a Microsoft engineer saw an |

| | | |opportunity to put DirectX into the hands of programmers of all skill levels—without loss of speed. |

| | | |By using the Microsoft Visual C++® .NET 2003 development system and the Microsoft .NET Framework, |

| | | |developers “wrapped” DirectX for use with a variety of programming languages. Now, more developers |

| | | |can create stunning, fast, multimedia programs while benefiting from improved productivity and |

| | | |reduced time-to-market. |

| | | | |

|[pic] | | |[pic] |

| | | | |

Situation

The computer gaming industry has grown tremendously in the last several years with worldwide revenues surpassing U.S.$10 billion. In fact, computer game revenues are now larger than the yearly box office receipts of all the Hollywood movie studios, combined. Much of the game-play excitement and cutting-edge game development takes place on the Microsoft® Windows® operating system platform.

Part of what makes Windows such a powerful gaming platform is a set of development libraries called the Microsoft DirectX® application programming interface (API). Built into Windows operating systems, DirectX is a suite of multimedia programming interfaces that support advanced 3D graphics, animation, audio, networking, and controller input. DirectX provides an abstraction from the underlying hardware to help games run flawlessly, regardless of what peripherals have been installed on the computer.

In order to achieve the level of hardware access and high-performance needed for a rich gaming experience, the team developing DirectX relied on Microsoft Visual C++® .NET 2003 Standard development system. By using Visual C++ .NET 2003, the team was able to easily tune the DirectX library for fastest performance. Their success can be seen in the large number of the showcase games that use DirectX, such as Half Life 2, Far Cry, and Halo. These games, through their use of Visual C++ .NET 2003 and DirectX, have been able to push the limits of the platform and, as a result, redefine gaming.

While breaking new ground in graphics or sound design is certainly one hallmark of a successful game, the development of these titles is often very time-consuming. Given the market demand for games, many companies are looking for ways to shorten development cycles. Software Design Engineer at Microsoft Corporation, Tom Miller, who has extensive development experience with the DirectX product group at the company, was concerned with that very problem.

Miller explains, “In mid-2001, while we were finishing up the DirectX 8.1 software development kit, I began looking at the then-nascent Microsoft .NET Framework. I recognized fairly quickly the potential for a managed DirectX application programming interface [API] to considerably reduce development time.” The .NET Framework is an integral component of the Windows operating system that provides a programming model and runtime for Web services, Web applications, and smart client applications.

Miller saw that exposing DirectX through the .NET Framework could allow him to craft a more elegant API, improve productivity, and open up game development to a variety of programming languages and coders of all skill levels.

Solution

Miller and the DirectX team turned the vision into reality by using Visual C++ .NET 2003 to create a “wrapper” for the DirectX 9.0 library that can be accessed from the .NET Framework.

The .NET Framework provides access to a number of run-time services, such as language integration, security enforcement, and memory, process, and thread management. In general, these services focus on helping reduce the amount of code a developer must write in order to turn programming logic into a reusable component. As a result, developers have found that writing code on the .NET Framework significantly increases their productivity. In addition, language-independence means that components exposed through the .NET Framework are accessible from a wide variety of programming languages.

By creating a wrapper for DirectX, the team was able to simplify building multimedia applications and improve developer productivity. In doing this, they were able to reach a new audience by introducing DirectX to developers, regardless of programming language. Finally, the team helped enhance the .NET Framework with a rich set of functionality that wouldn’t have otherwise been available.

But all of these benefits would have been for nothing if application performance were seriously degraded. With regard to retaining performance levels, the team far exceeded expectations. By using the managed DirectX API, developers will experience an almost negligible reduction in run-time performance.

This case study describes Miller’s efforts and the value the developer community can gain by using the managed DirectX API. It also tells the story of a commercial game developer who has used the managed DirectX API with great success. In addition, readers can look beyond the particulars of DirectX to see how any tested and tuned C/C++ code can be reused within the .NET Framework.

Developer Designed Own Managed DirectX API

Miller began by building a proof of concept by using the C# programming language. As C# had just been released, Miller used this project as an opportunity to learn about both the new language and the .NET Framework.

Miller’s goal with this prototype was simply to allow the entire set of DirectX component object model (COM) calls to be made through managed code. This resulted in a very simple wrapper API that was essentially a one-to-one mapping of each native call into an appropriate managed call.

Although the proof of concept met its design goals, significant performance improvements were needed. Miller says, “While we found working with C# easy enough, we weren’t able to get the marshalling performance we needed out of it.”

During development of the prototype, Miller had been introduced to the Managed Extensions for Visual C++. In working with the Managed Extensions, he immediately noticed a dramatic performance improvement. This led him to move his wrapper code to C++.

There was another important benefit to using the Managed Extensions for Visual C++. The DirectX routines for programming 3D graphics couldn’t be wrapped in C# because of restrictions in importing function calls from a static library. The flexibility afforded by Visual C++ .NET 2003 in mixing calls between native and managed code solved this problem.

With both the performance and 3D library issues resolved, Miller focused on tuning his class design. He recognized that simply mapping the DirectX COM calls wasn’t sufficient. Instead, he wanted an elegant, object-oriented API that would help simplify development of multimedia applications. This phase took the biggest time commitment–about five months. Miller states, “We spent a lot of time ensuring the managed API’s were much easier to use than the unmanaged counterparts.”

Company Exceeded Performance Goals

Although high performance is and always has been the primary motivating factor, Miller’s original goal wasn't terribly lofty. Miller explains, “We were hoping for at least 80 percent of the speed of the unmanaged layer. Since we really didn’t have any experience with the new technology, we really didn’t have any idea it if was going to be possible or not.”

The performance of the prototype was slightly under expectations, a problem that was solved by the move to the Managed Extensions for Visual C++. Says Miller, “It was then I realized I could get much better than the 80 percent initial goal, and revised the expectations.”

To really optimize performance, though, Miller decided to handle the marshalling of data between managed and native code, himself. He describes this process as one of the biggest learning curves in the project, but the results were worth the time. Miller’s final design achieved over 98 percent the performance of native DirectX calls.

Miller highly recommends that customers looking to reuse native code from within the .NET Framework understand marshalling costs. By applying effort in this stage, companies can be rewarded with significant performance gains.

Game Company Benefits from Managed DirectX

One company that has benefited from the managed DirectX 9.0 API is Koios Works, LLC. Koios Works developed a strategy game called Tin Soldiers: Alexander the Great, which has been published by Matrix Games. Marshall Belew, Lead Developer at Koios, and a small team of developers faced a tight deadline for getting this game out the door.

Because of the time constraints, Belew began considering the use of the managed DirectX API while Tin Soldiers: Alexander the Great was being planned. The productivity benefits gained by using the .NET Framework—as well as Belew’s own performance tests with the managed DirectX APIs—convinced him this was the way to go.

Koios Works chose to write Tin Soldiers: Alexander the Great by using C#, but any .NET language can be used with the managed DirectX libraries. In fact, the upcoming release of the Visual C++ development system has an optimized compiler for the .NET Framework that makes it the performance leader for both native and managed applications.

Using the managed DirectX libraries, Marshall’s team was able to meet all their deadlines. They were also able to develop, debug, and test their code faster than they had in the past. Plus, they were able to meet all their operational and performance criteria.

Says Belew, “Before we started developing Tin Soldiers: Alexander the Great, we knew we wouldn’t be doing animation or motion capture. Still, our goal was to have characters move across the screen smoothly. We've hit that goal 100 percent. Our success on Alexander the Great is a testament to the value of managed DirectX code.”

Benefits

By creating a wrapper for DirectX, the Microsoft team was able to simplify building multimedia applications and improve developer productivity. In doing this, they reached a new audience by introducing DirectX to all developers, regardless of what programming language they use. This reuse also helped enhance the .NET Framework with a rich set of functionality that wouldn’t have otherwise been available. Perhaps most importantly for game development, these benefits were achieved without a significant loss of performance.

Koios Works and Matrix Games can attest to these benefits. They were able to meet all their development and release deadlines while exceeding game performance goals.

Cost-effective, High-Performance Managed APIs

This project has demonstrated that wrapping existing native code is both cost-effective and can yield impressive results. Miller relates, “It’s tough to get a handle on the actual cost for this project, but it’s certainly orders of magnitude lower than the alternative: developing an API from scratch. Companies that want to follow our lead stand to benefit significantly from reusing their production-quality code in other environments. We’ve shown that writing a wrapper can be done without committing significant resources.”

For Koios Works, the managed DirectX API met their graphics performance design goals. Belew states, “The managed DirectX API worked so well that we plan to use this library to develop our next game.”

Rapid Time-to-Market

Many companies have tuned and tested their own Dynamic Link Libraries (DLLs) or have “battle-hardened” C++ libraries. Visual C++ .NET 2003 enables reuse of these components from within the .NET Framework. The result is:

■ Improved developer productivity and faster product cycles.

■ Enhanced functionality not available from within .the NET Framework alone.

■ Access to these components by a wide number of developers using other programming languages.

Companies gain a competitive advantage, especially on development projects for which time-to-market is a factor. Koios Works is a good example. By using the managed DirectX libraries, the company met the final release deadline and also met or exceeded every interim development goal.

Superior Development Environment and Resources

For Koios Works, as for any developer, working with DirectX in a managed environment significantly reduced time required for debugging and testing. Belew estimates he experienced about 25 percent faster testing and debugging.

Belew liked the readability of the managed DirectX, saying, “I like to be able to read code like a book. Because the managed DirectX is much more readable than unmanaged DirectX, I can concentrate on making the game rather than on the details of the game engine.”

Belew found the Microsoft DirectX user group and documentation on the Microsoft Developer Network (MSDN®) developer program “invaluable.” He also benefited from Tom Miller’s book, Managed DirectX 9.0: Graphics and Game Programming.

Microsoft Visual Studio .NET

Microsoft Visual Studio® .NET development system is the rapid application development (RAD) tool for building next-generation Web applications and Web services. Visual Studio .NET empowers developers to rapidly design broad-reach Web applications for any device and any platform. In addition, Visual Studio .NET is fully integrated with the Microsoft .NET Framework, providing support for multiple programming languages and automatically handling many common programming tasks, freeing developers to rapidly create Web applications using their language of choice. For more information, go to:

msdn.vstudio

Acquire Visual Studio .NET at:

msdn.vstudio/howtobuy

For more information about MSDN subscriptions, go to:

msdn.subscriptions

Microsoft .NET Framework

The Microsoft .NET Framework is an integral Windows component for building and running the next generation of applications and Web services. For more information, go to:

framework

-----------------------

| |Software and Services

■ Microsoft Visual C#® .NET 2003

■ Microsoft Visual C++ .NET 2003

■ Technologies

− Microsoft .NET Framework

− Microsoft DirectX 9.0

− Microsoft Managed Extensions for Visual C++

− C#

− C\C++

− |Services

− MSDN

Partners

■ Koios Works

■ Matrix Games | |

“Companies that want to follow our lead stand to benefit significantly from reusing their … code in other environments. We’ve shown that it can be done without committing significant resources.”

Tom Miller, Software Design Engineer, Microsoft Corporation

| |

© 2005 Microsoft Corporation. All rights reserved. This case study is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY. Microsoft, DirectX, MSDN, the .NET logo, Visual C++, Visual C#, Visual Studio, the Visual Studio logo, and Windows are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. All other trademarks are property of their respective owners.

Document published March 2005 | | |

For More Information

For more information about Microsoft products and services, call the Microsoft Sales Information Center at (800) 426-9400. In Canada, call the Microsoft Canada Information Centre at (877) 568-2495. Customers who are deaf or hard-of-hearing can reach Microsoft text telephone (TTY/TDD) services at (800) 892-5234 in the United States or (905) 568-9641 in Canada. Outside the 50 United States and Canada, please contact your local Microsoft subsidiary. To access information using the World Wide Web, go to:

For more information about Koios Works products and services, call (972) 277-8520 or visit the Web site at:

Screen capture of Tin Soldiers: Alexander the Great

[pic]

“Because the managed DirectX is much more readable than unmanaged DirectX, I can concentrate on making the game rather than on the details of the game engine.”

Marshall Belew, Lead Developer, Koios Works

| |

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download