Windows Store DirectX Game Template Getting Started

Getting Started with the Windows Store DirectX Game Template

Once you have installed the Windows Store DirectX Game Template, under "FILE -> New -> Project... -> Installed -> Templates -> Visual C++" you should see a project template called "Windows Store DirectX Game". Choose that, pick a suitable solution name (note: the "Name" property is not used except as the name of the subfolder in which the "DirectXTK_Windows8" and "WindowsStoreDirectXGame" folders will be placed. So you might as well make it short and just assign a different "Solution Name" that you will be able to identify as being this particular game project), and press OK.

The solution should be created and you will be presented with the "Getting started with the Windows Store DirectX Game Template" instructions page. The instructions there mirror the instructions here and it is important that you follow all of them to finish the final setup steps.

Set project dependencies.

From the PROJECT menu, select "Project Dependencies...". Under "Projects" select "WindowsStoreDirectXGame" and then under "Depends on" put a check next to "DirectXTK_Windows8". Press OK.

Specify app manifest values.

In Solution Explorer, double click on Package.appxmanifest (the "Manifest").

A brief note: You will see various values in the form of ms-resource:SomeResourceName. These are setup to be localizable and are found in the Resources.resw file (which we will attend to next). For now you should leave these values as you find them so that the proper values will be drawn from the resources file thus making localization and globalization much easier.

Select the "Application UI" tab in the Manifest.

Set the "Supported rotations" for your game. If you support all rotations, do not check any of the boxes. Usually a game will support either landscape or portrait, not both. But it depends on the specifics of your game. Note that if you are going to support both orientations, you should avoid using the fixed back buffer functionality (or else should use it very carefully) since it is designed primarily for use with either landscape or portrait, not both. It is not impossible to use it for both, but that usage is beyond the scope of this comment and should only be considered by people with a really good understanding of how that code works.

Set the "Background color" for your game. This is the color that shows through any transparent sections of your tile (logo) images and your splash screen. It is formatted in #RRGGBB format. Note that while there are named color values available for use, you should not use any named color values since the SettingsFlyout parses this value in order to comply with the settings ui guidance and the parsing code is only written to handle colors in #RRGGBB format.

If you are going to use tile/toast notifications, make sure you select "Badge Logo" under "Visual Assets" and configure the settings appropriately.

Next switch to the "Capabilities" tab in the Manifest.

Make sure to enable any capabilities your game requires. If you are going to use proximity for local multi-player, for instance, you need to set the "Proximity" capability.

Next switch to the "Declarations" tab in the Manifest.

Because this is a game, you should add the "Game Explorer" declaration. You will need to create a Game Definitions File and set the appropriate ratings data as well as any localized names for the game and all other applicable information. For more information, see Creating a GDF file (Windows) , Obtaining a game rating certificate (Windows) , Getting a content rating, and Windows 8 and GDFs . Seriously, see all of those links; they each provide helpful and unique information. If there was just one link with all of it I would've just posted it. Instead there are four and you should visit them all. Or not. It's up to you.

You may wish to add other declarations in order to support various contracts and extensions (note that the settings contract does not require a declaration). For more about these, see: App contracts and extensions (Windows Store apps) .

Lastly switch to the Packaging tab in the Manifest.

Here you will want to set the "Package name". This is the string value that identifies your game on the system (what you would see when running the Windows App Cert Kit tool). It should be between 3 and 50 characters in length consisting of nothing other than alpha-numeric characters, periods, and dashes (e.g. BTI.MyAwesomeGame). There are also reserved names, which you can review here: Identity (Windows) . (Essentially the list consists of all the various port names, e.g. CON, PRN, COM1, LPT9, AUX, etc.).

You will also want to set the "Publisher" value by pressing the "Choose Certificate..." button. Choose an appropriate certificate. This is used during testing and is replaced when you publish the app to the Windows Store.

Open Resources.resw so we can set more values.

RESW files contain string resources that can be easily localized into multiple languages by translators (or, if the strings are simple enough, by a translation tool.) They are your friend and thus this template makes use of them.

For an overview of string localization (both XAML- and code-based), see: Quickstart: Using string resources (Windows Store apps using C#/VB/C++ and XAML) (Windows) and How to load string resources (Windows Store apps using C#/VB/C++ and XAML) (Windows) . For some helpful tools for localizing apps, see: Multilingual App Toolkit for Visual Studio 2012 .

In Resources.resw you will want to change the values of:

  • GameDisplayName;
  • GameDescription;
  • PublisherDisplayName; and
  • GameShortName.

Read the comment for each of the string resources to find out how they are used and the acceptable lengths and contents for each. One important thing to note about resources: if you provide a RESW for a particular locale but do not provide a value for a specific string resource (e.g. PublisherDisplayName), then the value from the default locale's resource file will be used. This all happens automagically regardless of whether you are using XAML x:Uid attributes or you are using the ResourceLoader class . It's a good idea for consistency to either include all string resources in every locale file (even where there is no translation) or else to only include strings that will be localized in resource files other than the default locale's RESW file. The former is generally preferred since you can then choose whether to localize something on a per-language basis while still retaining the ability to make sure that each RESW file has the same set of string resources as the others.

Open SettingsResources.resw to set one (important) value.

SettingsResources.resw contains the string resources for the settings flyout. One of these values is the copyright string in the About settings pane. Right now it reads "Copyright © 2013 XXXXXXXX". Unless you had very strange parents or have a very bizarre business name, you will want to change this value to reflect the correct year and the correct name. If you are unsure what the correct name should be, consult a knowledgeable attorney.

Get started with Game.h and Game.cpp

The main game is implemented in the Game class. This is where you will want to start writing your game.

In addition to the samples that are available, there are also a number of "how to" guides for performing simple tasks. More samples and how tos will be added as time permits.

Creating a game, from design to programming to asset creation and acquisition to testing to polishing and lastly to publishing, is an art, and an arduous art at that. Like any art, becoming good at it takes time and there will likely be some parts that you decide to have a someone else do. One of the strengths of a really good game developer is knowing which areas you should let someone else handle and then finding good people to handle those areas. I wish you the best of luck in your game creating endeavors!

Microsoft, Windows, DirectX, Visual C++, and Visual Studio are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other trademarks, service marks, and intellectual property are the property of their respective owners.

Microsoft Corporation does not sponsor or endorse the Windows Store DirectX Game Template project and is neither involved in its development nor otherwise affiliated with the project.