Differences in game development between the phone and the desktop for Windows Phone 8
Applies to: Windows Phone 8 and Windows Phone Silverlight 8.1 only
Starting with Windows Phone 8, Windows Phone apps can be created using native code and Direct3D. This means that a lot of code and programming techniques are the same when creating games for Windows 8 and Windows Phone 8. However, due to the smaller form factor, the different input mechanisms, and the set of available APIs, there are some significant differences that you need to consider when creating a game for the phone platform. This topic highlights the major areas where the phone platform is different.
This topic contains the following sections.
Windows Phone 8 supports a subset of the APIs in the DirectX library. Most notably, the Windows Imaging Component (WIC) and Direct2D libraries are entirely unsupported. The APIs that are supported on the phone are supported at the 9_3 feature level which means that they behave differently than the same APIs running on a device that supports a higher feature level. There are a few instances where the APIs behave differently on the phone than they do in a desktop app using the 9_3 feature level, particularly around setting up the swap chain for the graphics device. For detailed info about the API differences for Direct3D on the phone, see Supported Direct3D APIs for Windows Phone 8.
Windows 8 apps can use the WIC to load textures in multiple image formats, for example, as PNG files. Windows Phone doesn’t support WIC. Games for the phone should use textures that are in the .dds file format.
Due to the smaller screen size of the phone, we recommend that you use smaller textures for phone games. This doesn’t improve performance, but it does make the XAP file for your app significantly smaller without affecting the visual fidelity of your game.
On Windows Phone, the term Direct3D app refers to an app that uses the native app model and which can only call native code. This type of app does not support any XAML controls such as text boxes for text input. There are helper functions that allow a native app to receive text input from the Software Input Panel (SIP) keyboard to enable custom built text boxes. For more info about handling text input in native apps, see How to handle keyboard input in a Direct3D app for Windows Phone 8.
Windows Phone reimplements a subset of the Microsoft Media Foundation (MF) APIs that are available on the desktop. You should use the IMFMediaEngine interface to implement background audio for games. For more info about the MF interfaces that are supported on the phone, see Walkthrough: Using Microsoft Media Foundation for Windows Phone 8.
Marble Maze is a fully functional game that was developed to illustrate game development for Windows Store apps. For info about how this game was developed, see Developing Marble Maze. This app has been ported to run on Windows Phone 8. To download the sample and read about the changes that were made to the app to make it run on Windows Phone, see Marble Maze sample for Windows Phone 8.
The DirectX Tool Kit (DirectXTK) is a collection of helper classes for writing Direct3D 11 code. The DirectXTK supports both desktop and phone development and can help you implement some common scenarios that can be more challenging on the phone, such as loading textures, 2-D drawing, and rendering text. The features of the tool kit include:
SpriteBatch - simple and efficient 2-D sprite rendering
SpriteFont - bitmap-based text rendering
Effects - set of built-in shaders for common rendering tasks
PrimitiveBatch - simple and efficient way to draw user primitives
GeometricPrimitive - draws basic shapes such as cubes and spheres
CommonStates - factory providing commonly used Direct3D state objects
VertexTypes - structures for commonly used vertex data formats
DDSTextureLoader - lightweight DDS file texture loader
WICTextureLoader - WIC-based image file texture loader (not supported on Windows Phone 8)
ScreenGrab - lightweight screen shot saver
To find out more about the DirectXTK, see the project page on CodePlex.