Getting started with C++/3D/WinStore Game Dev with the "Visual Studio 3D Starter Kit"
Today's project by JP Duplessis, Scott Marison, Mohsen Agsen, Jacob Meyer, Justin Goshi and Roberto Sonnino was something Brian Peek suggested you all might find interesting, cool and fun. I mean what's more fun than a VS2012, C++ with XAML, DirectX, Direct3D, Windows Store...
Update: This is a pretty hot topic and the team has been releasing additional information, projects and video's. Scroll down to see the latest...
This sample contains the starting point for a basic game. The sample contains a “Starter Kit” which provides support for consuming runtime assets produced by the VS tools. This includes loading and rendering assets (meshes, textures and shaders).
This sample demonstrates several features of Visual Studio useful in game development. It contains the starting point for a basic Direct3D game for the Windows Store.
Building the Sample
- Start Visual Studio 2012 and select File >Open >Project/Solution.
- Go to the directory in which you unzipped the sample. Go to the directory named
for the sample, and double-click the Visual Studio 2012 Solution (.sln) file.
- Press F6 or use Build > Build Solution to build the sample.
This sample contains the starting point for a basic game.
It demonstrates using the Visual Studio Graphics tools for asset manipulation, along with using an MSBUILD task for converting the included assets to a format suitable for runtime consumption.
The sample contains a “Starter Kit” which provides basic support for consuming the runtime assets produced by the MSBUILD task. This includes loading and rendering assets, along with other functionality to enabled developers to work with the assets at runtime.
The sample also demonstrates using XAML to implement a simple 2D HUD over the 3D scene.
To view the included assets, open the Assets folder in Visual Studio 2012, under the StarterKit project. Double click on any of the assets included in the Assets folder.
Including the Assets in the Build
The assets included with this sample have been set up to be converted by the MSBUILD task to a runtime format at build time. For an example on how this is set up, right click on the GameLevel.fbx file, and select “Properties” from the context menu. Select “General” from the Configuration properties on the left. Notice how the “Item Type” has been set to “Mesh Content Pipeline”. The Visual Studio Graphics tools contain 3 different build types related to assets: Mesh Content, Shader Content, and Image Content.
In this example, the mesh is converted at build time to a file named “GameLevel.cmo”.
Using the Starter Kit
The sample includes the header VSD3DStarter.h, which contains code for getting started with the content produced by the build task described above.
An example of using the starter kit to load and render the GameLevel can be found in the
Source Code Files
- App.xaml/App.xaml.cpp – Application file for XAML app.
- DirectXBase.cpp/.h – Base class for Direct3D rendering
- DirectXHelper.h – DirectX helper code
- DirectXPage.xaml.cpp/.h – Used for hosting Direct3D content in a XAML app
- Game.cpp/.h – Game logic use to demonstrate use of the “Starter Kit”
- VSD3DStarter.h – “Starter Kit”. Provides runtime support for working with the assets in this sample.
While it's important you learn the basis and basics for what you are writing, it's also important to ship and to focus on your game logic and not worry too much about foundational/grunt code. This starter kit will can help you with both (learning and avoiding the grunt'ness)...
Just in: Looking for another example of using the Visual Studio 3D Starter Kit? Here's a project by Roberto Sonnino and Xiaoji Chen.
A simple Towers of Hanoi 3D game for the Windows Store.
Developed with the Visual Studio 3D Starter Kit - https://aka.ms/vs3dkit
Update: Want to see it in action? Here's a hot off the press video from the team...
Want to write a 3D game for Windows 8, but not sure where to start?
In this video, we'll show you the Visual Studio 3D Starter Kit, which is now available on the Visual Studio Developer Code Samples site for all editions of Visual Studio 2012 that support writing Windows Store apps, including Visual Studio 2012 Express for Windows 8. JP and Roberto walk you through this C++ code sample which shows you how to use common capabilities in 3D apps and games for the Windows Store, such as:
- Loading textures, models, shaders
- Working with a Camera class
- Creating a 3D Scene
- Using XAML with DirectX
We'll also show you how to use the Model and Image Viewers and Shader Designer which are included in retail editions of Visual Studio 2012.