Windows 8 has changed the PC landscape with innovative form factors, new chip architectures, exciting commerce models and huge opportunities. PC games have long been a staple of the way computers are enjoyed. Now, more than ever, games exemplify the value of this new landscape of devices. Thanks to the Windows Store, games are easier to acquire, play, share with friends and update safely. It’s no wonder then that games account for such a large number of downloads, generate a lot of revenue, and drive the most user engagement on the new platform. With GDC around the corner, more game developers are eager to learn about the Windows 8 opportunity.
So, how do you create a great Windows Store game? What does Windows offer to make your game more creative, innovative, profitable and easier to develop? What tools, technologies and services can you use? What’s available out there in the ecosystem? What are other discoveries developers shared when developing for Windows 8? This post will answer questions about these topics and clarify how you too, can develop an awesome Windows Store game.
Windows 8 game design and development considerations
Windows 8 was designed and engineered specifically for the enjoyment of entertainment experiences. The Windows 8 User Experience (UX) guidelines promote full screen imagery, as well as fast and fluid interactions with no borders or extra window decorations. The design guidance recommends that apps focus on experiences that invite users to engage and provide interactions that guide them through an immersive experience. Main game controls should be easily accessible and secondary controls should be tucked away in an app bar or in a settings panel until they are needed. So, that’s great for general apps, but how do these principles affect games? After all, game developers have been providing fast and fluid, full screen, immersive experiences for a long time. Nevertheless, several basic questions arise almost right away:
- How can game mechanics scale from powerful desktop PCs to notebooks and tablets?
- What are the most important form factors to target?
- Can you enable games for touch, game controller and keyboard/mouse simultaneously?
- What are the most important screen sizes, aspect ratios and resolutions?
Game developers have been using a wide range of technologies to deliver entertaining games to the PC community for a long time. The APIs used on Windows have evolved significantly over time. With Windows 8, a new development platform has been added. The Windows Runtime API aggregates the best technologies from APIs of the past and brings significant improvements in performance, security, development consistency and servicing. The Windows Store adds a new way for games to be discovered, distributed and serviced. These new APIs significantly add value for game developers targeting the new development model. You might have some questions when you start to develop a Windows Store game, for example:
- What are the best Windows Runtime APIs to use for game development?
- How do the development models map to the different game genres?
- How do I transition my code from other platforms?
- How do I update my code from older versions of Windows?
- What, if any, of my game assets might need updating?
- Are there resources to help me reduce development costs?
- Where is the DirectX SDK?
Every game starts with an idea. Where that idea comes from can be very different. Sometimes it randomly pops into your head while you’re taking a walk, or while you’re in the shower. Other times, a more collaborative and iterative approach with your team may result in the idea. Once you’ve got your idea, you need to decide what type of game it is. Maybe you want a new unique game. Or perhaps you want to port your existing game. It could be a shooter, or puzzle, or racing game – no matter what type of game it is, there’s a home for it in the Windows Store. The Gaming Case Studies presented at //build/ 2012 might inspire you. If you have a Windows Store developer account you can browse the games’ subcategories to be inspired and see how different game categories are performing in different regions.
Game design guidance
Once you’ve decided what game you want to build, making design decisions on the front end can save you a lot of development time later on. The Windows 8 game category design guidance gives you some ideas about how best to attract players and keep them engaged with tiles and notifications. There are also suggestions about what type of overall layout to use and where to place primary and secondary controls.
You can find recommendations about interactions and how to incorporate touch, sensors and contracts into your game. Decisions about game mechanics and controls should be made as early as possible to scope development. That said, the Windows Runtime platform makes it more convenient than ever to support touch, pen (ink) and mouse with the same code so you don’t have to design special mechanics for different form factors. Because every Windows PC has a place to plug in a game controller, don’t miss out on the opportunity and make sure you include that control mechanism in your game as well.
Plan how – and at what pace – you’ll introduce game interactions and mechanics to the player. Too slow and they may lose interest; too fast and they may get frustrated. Perhaps most important of all, decide what monetization model and commerce platform you’d like to use. The Windows Store allows you to choose your business model. It supports Free to Play, Ad-based, In-app Purchases and Downloadable Content. Windows Store games can take advantage of the built-in time-based or feature-based trials. Alternately, you can use a third-party commerce provider or roll your own. Either way, as these issues can significantly impact your game’s success, monetarily or in popularity, they are important to consider.
Like all Windows Store apps, games have to support the different activation, view and suspension states. The design guidance offers some help with considerations for how and when to pause your game, how and when to suspend your game’s state, and how to handle full screen, snapped and filled view states. Decide how your game will support landscape and portrait orientations. Consider the size of hit targets and other on-screen controls when adjusting the resolution of your game’s assets to match different screen sizes (or parts of them). Also don’t forget to take screen aspect ratios, resolutions, and DPI settings into consideration. This will make sure your game’s content renders correctly on any screen size and scale factor.
Finally, remember to consider a few additional things that can help increase your game’s accessibility and socialization capabilities. A high contrast mode and extra audio queues could help increase visibility or playability and therefore encourage adoption among players in less than ideal lighting conditions or with visual impairments. Additionally, leveraging the platform’s built-in capabilities for online identity (authentication), data roaming and sharing to other apps can lead to increased engagement through social activity such as comparing game results and playing games across different PCs.
Game development guidance
DirectX is considered to be at the heart of the Windows game development platform. However, many other components were developed and transitioned in to the Windows 8 SDK to provide all the required capabilities the platform needs to support the diverse Windows gaming ecosystem. We provide a consistent and comprehensive development approach. We also incorporated best practices learned from other game development platforms. More than anything, however, we emphasized and observed two key architectural goals. Performance and power consumption were at the core of every architectural decision – as described in the Hardware Accelerating Everything: Windows 8 Graphics blog post. Developing games on Windows 8 rocks because the entire platform was designed to deliver fast and fluid entertainment experiences.
C++ with DirectX is the preferred development language for games
The Windows Runtime provides a rich set of APIs that expose all the new devices and sensors in a convenient, consistent way, and simplifies Windows event handling. There’s a single Windows SDK so every API you need to develop a Windows Store game is available in Microsoft Visual Studio 2012. For the most high-fidelity and immersive experiences, you’ll want to use the Windows 8 DirectX APIs to build 3D games. This is the easiest version of DirectX to develop with, and it supports a wide range of graphics feature levels, from DirectX 9.1 to all the latest hardware features exposed in DirectX 11.1, allowing you to tailor your game to every PC from power-efficient ARM-based portable Windows 8 tablet PCs to overclocked multi-GPU gamer rigs.
If you’re comfortable with a particular development language, you can use a lot of your existing skills and experience in Windows 8. Windows Store games can be developed in a number of technology combinations, depending on the type of game you’re developing and your preference. You’re not going to be forced or constrained to one syntax or model. Managed code developers can build great, smooth 2D games with XAML that leverage the strength and features of the Windows Store platform. If you’re a web developer, you can leverage your existing web and web game development skills to make a game that can be monetized through the Windows Store. For 3D interactive games, we recommend you use C++ with DirectX (and optionally XAML), which will be the main focus of the rest of this article.
Game development components
Windows 8 offers built-in game technology that ships with every version of the OS and resides on every PC so you don’t have to worry about distributing it or manage multiple versions. There’s no need to find, download and install additional components.
From graphics, audio and input, to file I/O, scheduling, math and networking – each component is accessible in the development language of your choice. Lower level components offer more flexibility, resource management and performance but may require additional code to comprehensively control processing and the flow of data it requires. With C++, you have a direct line to the GPU, CPU and low-level services of the Windows 8 platform, allowing you to write high performance code. With the new C++/CX language extensions, the syntax approaches the simplicity of C#. You get transparent object management via reference counting, and yet there’s no runtime layer, garbage collection or just-in-time compilation behaviors that could compromise the smooth performance of your game.
For 3D and 2D graphics, media, imaging and many of the other gaming components – the Windows 8 DirectX technologies provide a comprehensive set of APIs, components and libraries to build upon. Check out Getting started with DirectX game development for a comprehensive overview. The new Windows 8 graphics stack is better integrated, making Direct2D, Direct3D, DirectVideo and DirectCompute components easier to use together and requiring fewer duplicated resources than before. We’ve also added built-in support for the Xbox controllers with the XInput library. To learn more about it see Working with Input and controls in your DirectX game. The improved APIs for audio and sound mixing with XAudio2 are covered in the Working with audio in your DirectX game section, and simplified math functions and types are covered in the DirectXMath programming guide.
One of the greatest advantages of the DirectX/C++ development approach is that you can reuse significant amounts of your code to create a Windows Store game (and Windows Desktop game), a Windows Phone game, and an Xbox 360 game. The DirectX APIs are relevant to all Microsoft gaming platforms. Everything you’ll need to develop a great Windows game is included in the Runtime, the Windows SDK and Visual Studio 2012. For info about the legacy DirectX SDK, see Where is the DirectX SDK? There are several additional development models available in Windows 8. A hybrid model that supports DirectX and XAML interop provides the best control and performance and the convenience of the WinRT UI toolkit.
We provide a great set of tools to meet the demands of Windows Store game developers. Visual Studio 2012 includes a template for DirectX Windows Store apps that gives you a head start in developing for Direct3D. The template code provides the basic view provider infrastructure and window support, and references to all the necessary headers and components. There are other templates to explore that will make sure you are using best practices no matter which game development model you choose.
Additionally, new features in Visual Studio 2012 have been added to improve game development, debugging and profiling. Investments in Visual Studio 2012 Graphics Tools were made to ensure that graphics application development is seamlessly integrated. Work with 3D models, view textures and images, or create, edit and compile HLSL shaders without ever leaving the familiar IDE interface. Debugging graphics intensive DirectX applications in Visual Studio 2012 is now more intuitive with the integration of graphics API capture and playback features (previously known as Windows PIX).
Samples and tutorials
These samples provide a great range of source code examples to get you started on your game development quickly. Each sample focuses on a particular technology or technique. The tutorials and samples were developed with a progression in mind. They are in logical order beginning with the sparsest amount of code and simplest approach to help you get started. Each additional sample adds to the previous sample with one or two additional concepts until an entire game is created. Writing Code for DirectX and C++ Windows Store apps explains some of the things you need to know about writing DirectX and C++ code for Windows Store apps.
- Direct3D Tutorial: This five step tutorial shows how to initialize Direct3D, draw to the surface, and display updates to the surface using the swap chain. The “spinning cube” displayed by this sample is extended by other Direct3D samples, so this is a great place to start if you’re new to the Direct3D APIs.
- DirectX Touch Sample: This shows very minimal touch support added to the spinning cube from D3DTutorial. Specifically, this shows how to connect your Direct3D animation updates to the touch events provided by the Windows Runtime. See the Bump Mapping sample for pinch-to-zoom navigation.
- Direct3D Sprite Sample: This provides a Direct3D implementation of sprite batch behaviors, similar to the XNA SpriteBatch API. Sprites are 2D bitmaps that can be transformed and managed independently in a 3D scene, typically used in 2D games or to represent computationally expensive or distant objects in 3D games.
- Resource Loading Sample: This demonstrates an approach for loading resources and assets like shaders, textures, and meshes. (Note that each content type has an associated build rule in the project. You can add your own content processor apps, and build your own rules to invoke them.)
- Direct3D Bump Mapping Sample: This demonstrates bump mapping using a normal map and per-pixel lighting. The sample provides code for Surface-shaded lighting of an object using a normal map and a color texture. It also implements a very basic pinch-to-zoom control without the gesture recognizer.
- Direct3D Post-Processing Sample: This demonstrates post-processing the simple rotating cube scene using down-scaled intermediate buffers in a Windows Store C++ app with Direct3D. It demonstrates the use of two different shaders depending on the feature level of the hardware. The intermediate render target can be modified to render to a smaller surface to improve performance, and then scale up to the final native resolution of the device for high quality.
- AUDIO2 Audio File Playback Sample: This sample app shows how to incorporate the XAudio2 APIs for low-latency interactive sound effects into your DirectX game for a better aural experience.
- XINPUT Game Controller Sample: This shows how to add Xbox controller support to your DirectX game. It reads input from an Xbox game controller and displays data about the analog stick movements and button presses. It shows how to get input state from an attached controller and draw to the display using Direct2D and DirectWrite.
- Direct3D Stereoscopic 3D Sample: Windows 8 supports stereo 3D as a core OS feature. This app shows how to incorporate stereoscopic 3D into your DirectX game. It also demonstrates how to respond to system stereo changes in Direct3D.
- Trials and in-app purchases are so important to the success of games, so this sample demonstrates how to use the licensing API provided by the Windows Store to determine the license status of a game or a feature that is enabled by an in-app purchase.
The following are end-to-end samples that combine the individual techniques into full games:
- DirectX Simple 3D Shooting Game: This end-to-end sample app and comprehensive code walkthrough shows how to incorporate various control types and DirectX techniques in a simple first-person shooting gallery game. If you’re comfortable with the basics of all the individual technique samples, this is a good place to see all the components of a Windows Store Direct3D game in action.
- XAML DirectX Simple 3D Shooting Game: This demonstrates the basic end-to-end implementation of a simple first person 3-D game using DirectX (Direct3D 11.1, Direct2D, XInput, and XAudio2) and XAML in a C++ app. Direct3D is used to render the 3D content and XAML is used for the heads-up display and game state messages.
- DirectX Marble Maze Game Sample: This end-to-end game app is a simple labyrinth game where the player is challenged to roll a marble through a maze of pitfalls using tilt controls. It demonstrates how to fit all the game components into a single application. We’ve also provided some rich guidance around this app in the form of a complete code walkthrough.
Techniques for developing games
Several development patterns, best practices and techniques that are particularly relevant to game development are worth pointing out:
- Targeting different Direct3D feature levels helps you understand how to optimize across many devices that have different levels of graphics performance. This will enable you to reach a wider audience for your Windows Store game built for Windows using DirectX with C++.
- Asynchronous programming ensures your game takes advantage of multiple cores and hyper-threaded CPUs. Your game’s graphics, audio, logic, file I/O and networking can all be parallelized for best performance and battery life.
- Use thread pool parallelization for Windows Store games instead of traditional threading APIs (such as CreateThread). The task model is especially important for rendering and ensuring a responsive UI, as described in this post.
- Supporting screen orientation, covers screen rotation and DPI scaling of content and input for DirectX applications. This helps make sure your game works well on various screen resolutions.
- Adding mouse move/look controls to your game explains a traditional mouse-like navigation technique that has been adapted to add touch for the Windows Store development model.
- Developing mouse controls discusses the implementation of relative mouse controls, which hides the system cursor and returns relative screen coordinates rather than absolute values.
- Game publishing requirements provides Windows 8 game developers with info about the tools and support for common game publishing scenarios, such as ratings certification and packaging.
- Supporting Windows RT and ARM processors gets your DirectX Windows Store game up and running on Windows RT devices, targeting Direct3D feature level 9_1 and compiling an ARM package.
Using middleware to reduce development time or cost
Developing high quality professional games can be costly. Developing games for multiple platforms can be complex, error prone, and even more costly. Many established game studios build tools and develop production technologies that make up their game development process or “pipeline.” These investments help studios leverage their game assets between different games and platforms. Rendering engines, user interface tool kits, visibility occlusion, physics simulators, audio video authoring, animation interpolation and artificial intelligence are just a few of the technology categories typically involved in game development. Some gaming technologies can take many years to develop and fine-tune.
Proprietary gaming pipelines are incredibly valuable and many studios consider their investments as strategic as the games they make. Not everyone can afford the time or cost of developing a pipeline however. Luckily, third-party vendors offer end-to-end game development pipelines or individual technology libraries that provide these capabilities. Since Windows 8 launched, many gaming middleware vendors have transitioned their offerings to the new Windows Store app model. Using these products will get your game in the Windows Store much faster and with much less risk. As time progresses, we expect more vendors to announce and ship products for Windows Store game development. The following (in alphabetical order) is a compilation of third-party gaming middleware vendors that (at the time of writing) have announced or delivered versions of their product that support Windows 8 game development.
Microsoft’s XNA Game Studio is a game development pipeline that targets the Xbox 360, Windows Phone and Windows. However, it’s not compatible with Windows Store game development, (although XNA games are supported as Windows 8’s desktop apps). DirectX development with Visual C++/CX borrows many patterns and practices from XNA, and shares many conceptual similarities. So many XNA game developers will find it relatively easy to transition to DirectX and C++ development than ever before. Alternatively, we have seen developers successfully use the open source MonoGame library that replicates many of the XNA Game Studio capabilities. Several articles have been written about leveraging assets created with XNA for games targeting the Windows Store. Here’s a link to more info on the subject.
Additional resources for developing games
- The documentation has a dedicated game development area on MSDN
- The game-centric sessions, slides decks and recordings of talks that were given at //build/ 2012
- The game-centric sessions, slides decks and recordings of talks that were given at GDC 2012
- The game-centric sessions, slides decks and recordings of talks that were given at //build/ 2011
- Help and support is available on The Developer Center which has a dedicated forum for game development for game developers like you who can provide answers when you need them
- The DirectX Toolkit is a collection of helper classes for writing Direct3D 11 C++ code
- Other great resources include Chuck Walbourn’s blog and Shawn Hargreaves’ blog
Windows 8 reimagines PCs and with new form factors, innovative technologies and lucrative commerce models that are perfect for gaming. The platform represents a green-field of opportunity for those who take advantage of it. The Windows Store has several thousand games at the time of writing and that number grows daily. The goal of this post was to help you understand what it would take to create a great Windows Store game of your own to leverage the possibilities. The information was meant to clarify how Windows 8 can make game development easier, more creative, innovative and profitable. We’ve reviewed what tools, technologies and services are available on the platform and what third-party technologies are available. As we head out to the annual Game Developer Conference in San Francisco, look to this post for guidance as you develop Windows Store games.
Shai Hinitz, Sr. Program Manager