840 likes | 1.09k Views
Creating a Cutting-Edge Game for Windows Tablets. Chas. Boyd Windows Graphics 3-043. The Broad Range of PCs. The Opportunity. More users are spending more time with tablets/convertibles Living r oom and commute The hardware ecosystem is going there as a result
E N D
Creating a Cutting-Edge Game for Windows Tablets Chas. Boyd Windows Graphics 3-043
The Opportunity • More users are spending more time with tablets/convertibles • Living room and commute • The hardware ecosystem is going there as a result • You can target those users via a Windows Store Game
Broader PC Innovation • We know the platform is already capable of much more • Let us show you how you can use that platform to create an experience where you will stand out from the masses • These are the key areas where we have invested: • All the key tablet features • Most cutting-edge technology • You can self-publish • Easiest development
PennyArcadeon Surface Pro • www.penny-arcade.com 02/22/2013 • “For me the Surface Pro is actually a great piece of hardware” • -Gabe
Windows 8 Game Platform Technologies Your Killer Game Game Input Movies & Cut Scenes Graphics Audio Local Services Connected Services Tools Visual Studio Direct3D11 DirectX Video Pointer Point Windows Live WASAPI PLM Sensor API Windows Store Direct2D Asset Viewers Media Foundation AppData XAudio2 XInput Xbox LIVE Contracts Asset Processors HTML XAML
PointerPoint Input • win->PointerPressed += refnewTypedEventHandler<CoreWindow^,PointerEventArgs^> • (this, &LonLatController::OnPointerPressed); • voidLonLatController::OnPointerPressed( • _In_CoreWindow^ sender, • _In_PointerEventArgs^ args • ) • { • float2 position = float2( // position of contact • args->CurrentPoint->Position.X, • args->CurrentPoint->Position.Y • ); • m_lonLatLastPoint = position; // save for use in controller • m_lonLatPointerID = args->CurrentPoint->PointerId; • }
Cutting Edge Graphics in Windows 8.0 • Halo: Spartan Assault Reckless Racing Ultimate
Windows 8.1 Game Platform Technologies Your Killer Game Game Input Movies & Cut Scenes Graphics Audio Local Services Connected Services Tools Visual Studio Direct3D11.2 DirectX Video Pointer Point Windows Live, Azure WASAPI PLM Azure Sensor API Windows Store Install Direct2D Asset Viewers Media Foundation AppData XAudio2 XInput Xbox LIVE Contracts Asset Processors HTML WiFi Direct XAML Shader Debugging
Direct3D11 • Photoreal Rendering can help differentiate your product • Tablets run the Direct3D 11 Graphics API • e.g. Surface Pro, etc. • The Direct3D 11 API runs all PC hardware: Tablets to SLI • reduced-precision data types, shadow sampling, etc.
DirectX 11 Feature Level 9 • Vertex shaders • Pixel shaders • 8 Textures • 4 Render Targets • Cube maps • Volume textures • Anisotropic filtering • Antialiasing • HDR rendering • Texture compression • BC1, BC2, BC3
DirectX 11 Feature Level 10 Geometry shaders Stream out 128 Textures per shader 8 Render Targets Integers in shaders Vertex textures Shader sampling Constant buffers Alpha-to-coverage Basic DirectCompute BC4, BC5 formats • Vertex shaders • Pixel shaders • 8 Textures • 4 Render Targets • Cube maps • Volume textures • Anisotropic filtering • Antialiasing • HDR rendering • Texture compression • BC1, BC2, BC3
DirectX 11 Feature Level 11 Geometry shaders Stream out 128 Textures per shader 8 Render Targets Integers in shaders Vertex textures Shader sampling Constant buffers Alpha-to-coverage Basic DirectCompute BC4, BC5 formats Full DirectCompute Random access writes Tessellation shaders New compression formats BC6, BC7 Min10float, min16float Shader linking Present() optimizations Hardware overlays/scalers Tiled Resources • Vertex shaders • Pixel shaders • 8 Textures • 4 Render Targets • Cube maps • Volume textures • Anisotropic filtering • Antialiasing • HDR rendering • Texture compression • BC1, BC2, BC3
Approximate Market Segmentation DX9 DX10 DX9 DX10 DX11 DX11
Creating the Direct3D Device and Context ComPtr<ID3D11Device> device; ComPtr<ID3D11DeviceContext> context; D3D11CreateDevice( nullptr, // use the default adapter D3D_DRIVER_TYPE_HARDWARE, 0, // use 0 unless a software device creationFlags, // defined above featureLevels, // what app will support ARRAYSIZE(featureLevels), D3D11_SDK_VERSION, // should always be D3D11_SDK_VERSION &device, // created device &m_featureLevel, // feature level of the device &context // corresponding immediate context );
Tiled Resources Applications • Games: terrain, shadow maps, skyboxes, etc. • Atlases: fine-grained memory management with minimal state changes • Imaging: 256Mpixel image display/editing • Maps: massive datasets • See Talk 4-063: • Massive virtual textures for games: Direct3D Tiled Resources
Cutting Edge Game Performance • How do I make my high-end game fast enough on a tablet?
Graphics Performance on Tablets • 2D / sprite games should run at native resolution wherever possible • Look at ways to minimize overdraw, such as more complex meshes. • 3D games may need to render the scene at lower-than-native resolution, and scale up to native before the overlay elements (score, etc) are applied • This is common practice on the PC and consoles • The new overlapping Swapchain API enables accelerated scaling • As we’ll see later
Graphics Performance -Language • Also consider programming language • C++ is the fastest language we offer • Enables the most ‘vertical’ portability • The C++ sample code is very straightforward • Modeled after XNA architecture
App Packaging and Distribution Typical cutting edge games of today come on dual layer DVDs (xbox 360, PC, etc) and are 8 GB to 25GB Digital downloads can take a while… How do I fit my game on a tablet?
App Packages in Windows 8 ARM Binaries Audio Textures Shaders Animations x86 Binaries Audio Textures Shaders Animations x64 Binaries Audio Textures Shaders Animations 2GB 2GB 2GB
App Packages in Windows 8.1 ARM Binaries Audio Textures Shaders Animations x86 Binaries Audio Textures Shaders Animations x64 Binaries Audio Textures Shaders Animations 8GB 8GB 8GB 25GB
How do I minimize download time & storage? • DX9 GPUs don’t support some texture formats • Choice: • Use DX9 textures even for DX11 users (LCD) • DX11 users want the higher quality their hardware can use • Ship both: make DX9 users wait for DX11 textures to download • New PC hardware has wireless connectivity and SSD storage
Windows 8.1 App Bundle x86 Binaries x64 Binaries ARM Binaries DX9 Textures DX10 Textures DX11 Textures 1.0x UI Elements 1.4x UI Elements 1.8x UI Elements 25GB
Deployment 1 ARM Binaries DX9 Textures 1.0x UI Elements ARM binaries DX9 Textures 1.0x UI elements
Deployment 2 x86 Binaries x64 Binaries ARM Binaries DX9 Textures DX10 Textures DX11 Textures 1.0x UI Elements 1.4x UI Elements 1.8x UI Elements
Deployment 2 x64 Binaries DX9 Textures DX11 Textures 1.0x UI Elements 1.4x UI Elements x64 binaries DX11 Textures 1.4x UI elements
App Packaging -How To • Keep game resources in separate folders • Standard naming convention for resource identifiers • Build time: Packager tags them all in the bundle • Deployment: Installer checks device, and installs the applicable bits • Note: The default bits for a single package are always installed: • FLDX9, 1.0x DPI setting, Locale language
Notify Resource Manager of Desired Folder // Set current UI thread's MRT ResourceContext'sDXFeatureLevel // Note: GetForCurrentView is per UI thread and will fail on the background thread auto rcontext = Windows::ApplicationModel::Resources::Core::ResourceContext::GetForCurrentView(); rcontext->QualifierValues->Insert("DXFeatureLevel", "DX9"); // “DX10” or “DX11”
Set Feature Level D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_11_1, D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL_9_1 }; String ResourceContextFL; switch ( m_featureLevel ) { case D3D_FEATURE_LEVEL9_1: case D3D_FEATURE_LEVEL9_2: case D3D_FEATURE_LEVEL9_3: ResourceContextFL = “DX9”; break; case D3D_FEATURE_LEVEL10_0: case D3D_FEATURE_LEVEL10_1: ResourceContextFL = “DX10”; break; case D3D_FEATURE_LEVEL_11_0: case D3D_FEATURE_LEVEL_11_1: ResourceContextFL = “DX11”; break; default: error; }
App Bundle Summary App bundles let you tailor your product to your customer Up to Blu-Ray™ install sizes DirectX APIs already help you span different vendors App Bundles let you span different generations as well, as the industry continues moving forward via innovation
Automatic Input Routing Touch Weight Mouse Weight Game Logic Keyboard + Weight Game Controller Weight Accelerometer Weight