Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Developing Marble Maze, a Windows Store game in C++ and DirectX

Applies to Windows only

This section of the documentation describes how to use DirectX and Visual C++ to create a 3-D Windows Store game. With Windows Store apps, Windows 8 introduces an app personality that embraces consumer trends such as touch, motion and proximity sensors, mobility, and other app experiences. This documentation shows how to create a 3-D game named Marble Maze that embraces new form factors such as tablets and also works on traditional desktop and laptop PCs.

Note  To download the Marble Maze source code, see DirectX Marble Maze game sample.

Important  Marble Maze illustrates design patterns that we consider to be best practices for creating Windows Store games. You can adapt many of the implementation details to fit your own practices and the unique requirements of the game you are developing. Feel free to use different techniques or libraries when those better suit your needs. (However, always ensure that your code passes the Windows App Certification Kit.) When we consider a Marble Maze implementation to be essential for successful game development, we emphasize it in this documentation.

Introducing Marble Maze

We chose Marble Maze because it is relatively basic, but still demonstrates the breadth of features that are found in most games. It shows how to use graphics, input handling, and audio. It also demonstrates game mechanics such as rules and goals.

Marble Maze resembles the table-top labyrinth game that is typically constructed from a box that contains holes and a steel or glass marble. The goal of Marble Maze is the same as the table-top version: tilt the maze to guide the marble from the start to the end of the maze in as little time as possible, without letting the marble fall into any of the holes. Marble Maze adds the concept of checkpoints. If the marble falls into a hole, the game is restarted at the last checkpoint location that the marble passed over.

Marble Maze offers multiple ways for a user to interact with the game board. If you have a touch-enabled or accelerometer-enabled device, you can use those devices to move the game board. You can also use an Xbox 360 controller or a mouse to control game play.

Screen shot of the Marble Maze game.

Note  The XNA Framework also provides a sample that is named Marble Maze that runs as a Windows Phone or classic desktop Windows app. (That version does not run as a Windows Store app). For more info about the XNA Framework version of Marble Maze, see App Hub - marble maze.


  • Windows 8
  • Microsoft Visual Studio 2013
  • C++ programming knowledge
  • Familiarity with DirectX and DirectX terminology
  • Basic knowledge of COM

Who should read this?

If you’re interested in creating 3-D games or other graphics-intensive applications for Windows 8, this is for you. We hope you use the principles and practices that this documentation outlines to create your own Windows Store game. A background or strong interest in C++ and DirectX programming will help you get the most out of this documentation. If you don't have experience with DirectX, you can still benefit if you have experience with similar 3-D graphics programming environments.

If you are new to game development, and your game does not have demanding graphics requirements, consider developing it as a Windows Store app by using JavaScript or XAML. For more info about these options, see Technologies for developing Windows Store games for Windows. If you want a basic introduction to Windows Store game programming with C++, see Create your first Windows Store app using DirectX. The document Walkthrough: create a simple Windows Store game with DirectX describes another sample that implements a basic 3-D shooting game by using DirectX and C++.

What this documentation covers

This documentation teaches how to:

  • Use the Windows Runtime API and DirectX to create a Windows Store game.
  • Use Direct3D and Direct2D to work with visual content such as models, textures, vertex and pixel shaders, and 2-D overlays.
  • Integrate input mechanisms such as touch, accelerometer, and the Xbox 360 controller.
  • Use XAudio2 to incorporate music and sound effects.

What this documentation does not cover

This documentation does not cover the following aspects of game development. These aspects are followed by additional resources that cover them.

  • 3-D game design principles.
  • C++ or DirectX programming basics.
  • How to design resources such as textures, models, or audio.
  • How to troubleshoot behavior or performance issues in your game.
  • How to prepare your game for use in other parts of the world.
  • How to certify and publish your game to the Windows Store.

Marble Maze also uses the DirectXMath library to work with 3-D geometry and perform physics calculations, such as collisions. DirectXMath is not covered in-depth in this section. For more info about DirectXMath, see DirectXMath Programming Guide . For details about how Marble Maze uses DirectXMath, refer to the source code.

Although Marble Maze provides many reusable components, it is not a complete game development framework. When we consider a Marble Maze component to be reusable in your game, we emphasize it in the documentation.

The following resources can help you understand Windows Store game development.

DirectX Developer Center

Contains getting started resources as well as in-depth whitepapers and samples for DirectX programmers.

Visual C++ Developer Center

Contains resources for beginning and experienced C++ programmers.

Planning Windows Store apps

Outlines practical, prescriptive guidance about how to design Windows Store apps that enhance user interaction and take advantage of device and touch capabilities.

Developing games

Helps you get started with common Windows game development tasks and discover and evaluate new and existing Windows game technologies and development platforms.

Working with 3-D Assets for Games and Apps

Describes the visual design and resource editing tools that Visual Studio provides to support DirectX-based application development.

Debugging DirectX Graphics

Describes the debugging functionality that Visual Studio provides for DirectX-based applications.

Defining app resources

Describes how to define app resources to improve maintainability and localization.

Prepare your Windows game for publishing

Describes the steps that are required to publish a game to the Windows Store, such as how to package the game and obtain ratings certification.

Next steps

We recommend that you start with Marble Maze sample fundamentals to learn about the Marble Maze structure and some of the coding and style guidelines that the Marble Maze source code follows. The following table outlines the documents in this section so that you can more easily refer to them.

Related Topics

Marble Maze sample fundamentals Provides an overview of the game structure and some of the code and style guidelines that the source code follows.
Marble Maze application structure Describes how the Marble Maze application code is structured and how the structure of a DirectX Windows Store app differs from that of a traditional desktop application.
Adding visual content to the Marble Maze sample Describes some of the key practices to keep in mind when you work with Direct3D and Direct2D. Also describes how Marble Maze applies these practices for visual content.
Adding input and interactivity to the Marble Maze sample Describes how Marble Maze works with accelerometer, touch, and Xbox 360 controller devices to enable users to navigate menus and interact with the game board. Also describes some of the best practices to keep in mind when you work with input.
Adding audio to the Marble Maze sample Describes how Marble Maze works with audio to add music and sound effects to the game experience.




© 2015 Microsoft