Upload
rosalind-carter
View
221
Download
0
Tags:
Embed Size (px)
Citation preview
Creating a Cutting-Edge Game for Windows Tablets
Chas. BoydWindows Graphics3-043
The Broad Range of PCs
The Opportunity
More users are spending more time with tablets/convertibles
Living room and commuteThe hardware ecosystem is going there as a resultYou can target those users via a Windows Store Game
Broader PC Innovation
We know the platform is already capable of much moreLet us show you how you can use that platform to create an experience where you will stand out from the massesThese are the key areas where we have invested:
All the key tablet featuresMost cutting-edge technologyYou can self-publishEasiest development
PennyArcade on Surface Pro
www.penny-arcade.com 02/22/2013“For me the Surface Pro is actually a great piece of hardware” -Gabe
Movies & Cut Scenes
Your Killer Game
Game Input
Graphics Audio
Direct3D11
DirectX Video
PointerPoint PLM
Windows Live
Connected Services
Local Services
Direct2D
XInput
Sensor API
WASAPI
Windows Store
Xbox LIVE
Media Foundatio
nAppData
Contracts
Visual Studio
Asset Viewers
Asset Processors
Tools
Windows 8 Game Platform Technologies
HTML
XAML
XAudio2
PointerPoint Inputwin->PointerPressed += ref new TypedEventHandler<CoreWindow^,PointerEventArgs^>
(this, &LonLatController::OnPointerPressed);
void LonLatController::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
RecklessRacingUltimate
Movies & Cut Scenes
Your Killer Game
Game Input
Graphics Audio
Direct3D11.2
DirectX Video
PointerPoint PLM
Windows Live, Azure
Connected Services
Local Services
Direct2D
XInput
Sensor API
WASAPI
Windows Store Install
Xbox LIVE
Media Foundatio
nAppData
Contracts
Visual Studio
Asset Viewers
Asset Processors
Tools
Windows 8.1 Game Platform Technologies
HTML
XAML
XAudio2
Shader Debugging
WiFi Direct
Azure
Cutting Edge Games: Graphics
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 SLIreduced-precision data types, shadow sampling, etc.
DirectX 11 Feature Levels
DirectX 11 Feature Level 9
Vertex shadersPixel shaders8 Textures4 Render TargetsCube mapsVolume texturesAnisotropic filteringAntialiasingHDR renderingTexture compressionBC1, BC2, BC3
DirectX 11 Feature Level 10
Vertex shadersPixel shaders8 Textures4 Render TargetsCube mapsVolume texturesAnisotropic filteringAntialiasingHDR renderingTexture compressionBC1, BC2, BC3
Geometry shadersStream out128 Textures per shader8 Render TargetsIntegers in shadersVertex texturesShader samplingConstant buffersAlpha-to-coverageBasic DirectComputeBC4, BC5 formats
DirectX 11 Feature Level 11
Vertex shadersPixel shaders8 Textures4 Render TargetsCube mapsVolume texturesAnisotropic filteringAntialiasingHDR renderingTexture compressionBC1, BC2, BC3
Geometry shadersStream out128 Textures per shader8 Render TargetsIntegers in shadersVertex texturesShader samplingConstant buffersAlpha-to-coverageBasic DirectComputeBC4, BC5 formats
Full DirectComputeRandom access writesTessellation shadersNew compression formats BC6, BC7Min10float, min16floatShader linkingPresent() optimizationsHardware overlays/scalersTiled Resources
Approximate Market Segmentation
DX10
DX9
DX11
DX10DX9
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
Graphine
Tiled Resources Applications
Games: terrain, shadow maps, skyboxes, etc.Atlases: fine-grained memory management with minimal state changesImaging: 256Mpixel image display/editingMaps: 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 possibleLook 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 appliedThis is common practice on the PC and consoles
The new overlapping Swapchain API enables accelerated scalingAs we’ll see later
Graphics Performance -Language
Also consider programming language
C++ is the fastest language we offerEnables the most ‘vertical’ portability
The C++ sample code is very straightforwardModeled after XNA architecture
Cutting Edge Games: Size
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
x86 Binaries
AudioTexturesShaders
Animations
x64 Binaries
AudioTexturesShaders
Animations
ARM Binaries
AudioTexturesShaders
Animations2GB
2GB
2GB
App Packages in Windows 8.1
x86 Binaries
Audio
Textures
Shaders
Animations
x64 Binaries
Audio
Textures
Shaders
Animations
ARM 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 downloadNew PC hardware has wireless connectivity and SSD storage
25GB
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
ARM binariesDX9 Textures1.0x UI elements
Deployment 1
DX9 Textures
1.0x UI Elements
ARM Binaries
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
x64 binariesDX11 Textures1.4x UI elements
Deployment 2
x64 Binaries
DX9 Textures
DX11 Textures
1.0x UI Elements
1.4x UI Elements
App Packaging -How To
Keep game resources in separate foldersStandard 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
Group assets by FeatureLevel
Create theApp Bundle
App Bundle Contents
App Bundle Contents
App Bundle Contents
App Bundle Contents
Notify Resource Manager of Desired Folder// Set current UI thread's MRT ResourceContext's DXFeatureLevel// 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 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;}
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 };
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
Cutting Edge Games: Controls
Automatic Input Routing
Touch
Mouse
Keyboard +
Weight
Weight
WeightGameLogic
Game Controller
Accelerometer Weight
Weight
Cutting Edge Games: Display
All the Inches
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Tablets
Convertibles
Notebooks
Desktops & All-in-Ones
2-D Visuals: New DPIs
At 10” tablet panel1366*768 1.0x1920*1080 1.4x2560*1440 1.8x
4k
2560x1440
1080p
OS DPI Scale factors
Modern1.0x1.4x1.8x
Desktop1.0x1.25x1.5x2.0x
New Resolutions And Performance
1024*768 0.75MPix1280*800 1 MPix1366*768 1 MPix1600*900 1.4MPix1920*1080 2 MPix2560*1600 4 Mpix3840*2160 8 Mpix
4k
2560x1440
1080p
Hardware Solution: Scalers and OverlaysFor performance, hardware can scale up imagery for freeMain rendering can be at a lower resolution for better performance – the hardware will scale it back up
It can also preserve quality of 2-D content:Create a second swapchain for an overlay to store 2D imagery (text, score, cross-hair, etc.) at native resolution
Overlapping Swapchain Composition
Hardware accelerated scaling of content up to native resolution at high quality
Hardware accelerated composition of overlay elements onto background contentoutRGB = topRGB + bottomRGB*(1 – topA)
See talk 3-062: What’s New in Direct3D
HUD swap chain
(1920x1080)
Display
(1920x1080)
3D swap chain
(1280x720)
Swapchain CreationDXGI_SWAP_CHAIN_DESC1 bottomSwapChainDesc = {0};bottomSwapChainDesc.Width = RenderTargetWidth;bottomSwapChainDesc.Height = RenderTargetHeight;bottomSwapChainDesc.Scaling = DXGI_SCALING_STRETCH;dxgiFactory->CreateSwapChainForCoreWindow( ... );
if (m_dxgiOutput->SupportsOverlays()) { DXGI_SWAP_CHAIN_DESC1 topSwapChainDesc = {0}; topSwapChainDesc.Width = 0; // screenWidth; topSwapChainDesc.Height = 0; // screenHeight; topSwapChainDesc.Scaling = DXGI_SCALING_NONE; topSwapChainDesc.Flags = DXGI_SWAP_CHAIN_FOREGROUND_LAYER; topSwapChainDesc.AlphaMode = DXGI_ALPHA_MODE_PREMULTIPLIED; dxgiFactory->CreateSwapChainForCoreWindow( ... );}
...bottomSwapChain->Present(1, 0);if (topSwapChain) topSwapChain->Present(1, 0);
Option Menus and Inventory Screens
Render UI directly in Direct3D, ScaleForm, Direct2D, or XAMLCreate a separate IFrameworkView in the same window/rect
Analogous to XNA’s GameScreen helper classCan use XAML in menu view, & pure DX in game view
Open a new window (split-screen) from your appViewSizePreference::UseHalfLets user control split with familiar OS UISwitch using Activate() methodCloses when app closes
Secondary Apps
In App Purchase store, server status app, chat client, Skype
Launch a new app (split-screen)New cross-app launching APILets users control split via familiar OS UICan stays running when invoking app quits
See Talk 2-010: Building Apps that Work Together
Best Practices
Be sure to throttle back rendering speed of any window that loses focus (changes activationState )Speeds up the window or app the user is actually using
On occlusion, pause gameplayAuto-resume on tap/click or just a timer
Handling Occlusion
void DirectXApp::Run(){ while (!m_windowClosed) { if (m_windowVisible) // from window->VisibilityChanged event { dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); m_renderer->Update(timer->Total, timer->Delta); m_renderer->Render(); m_renderer->Present(); } else { dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); } }}
Multiple Displays
Multi-MonMore screen real-estate“Docking” your tablet
Projection/TVImmersionShare your display
Share Your Display
Share Your Display
Let everyone see the game board, track map, rankings, or world map, …
User can just use Multi-mon to MiracastMiracast (aka WiDi) is based on WiFi Direct, so no WiFi AP reqd
User feature: No APIs need to be called by developer
ProjectionManager API
API that allows you to show different things on different screens when Windows has multiple screens availableStart ProjectionManager->StartProjectingAsync( NewView, CurrentView );
Stop ProjectionManager->StopProjectingAsync( NewView, CurrentView );
Swap ProjectionManager->SwapDisplaysForViewsAsync( NewView, CurrentView );
Screen Available Query ProjectionManager->ProjectionDisplayAvailable
Screen Available Notification ProjectionManager->ProjectionDisplayAvailableChanged
Cuting Edge Games: Connectivity
Game Scenarios
Play-Pause-ResumeTablet to convertible to laptop to desktop PC use roaming, save state and dynamic input switchingWindows Phone to Windows to Xbox use services and cloud – or roll your own with Azure
Cross device vs. cross screen – compare & contrast mechanics and mobility
Living Room
Living Room -sociable
Considerations for Gameplay Types
Async: turn-based, crowd-sourced real-time, rankings, etc.Sync: simultaneous multiplayer via TCP
Local Multiplayer - Wifi Direct and NFC, e.g. for matchmaking See multiplayer talk 3-051 by Jianye & Priya
Tune mechanics and difficulty per form factor and perf profile“Lean forward” vs “lean back” content
Connectivity Innovation
More broadband wireless devices are coming
Metered network considerationsNew store packaging and installer helps with that
Scenarios for connected play
Gameplay Design
Implementation Strategies
Isolate code for core game logic from device-dependent code
Console / desktop / phone / tablet specific features (e.g. XAML UI/input/contract usage)
C++ dlls are a good solution
Cross Device Development Tools
Visual Studio 2013 builds apps for all MS platforms
Windows DesktopWindows StoreWindows PhoneConsole
New for Windows 8.1 and VS 2013: DirectX Debugging
Visual Studio Talks
See talk 3-141: DirectX Graphics Debugging Tools
See Also:2-305 What’s New in Visual Studio 20132-211 C++ for Windows Phone3-329 Using VS C++ 2013 to get the best performance3-308 C++ Best Practices
Cutting Edge Game Features
Windows 8Direct3D 11.1XAudioPointerPointMouseLookXInputC++
Windows 8.1Direct3D11.2 Tiled Resources Scalers & Overlays HLSL Shader linker
8-25GB packagesMulti-monWi-Fi Direct
Go For ItGet your cutting edge game out to these new users/places Pioneer this new space
Check out the solutions for your case: Store, packaging, installer Rich input/controller options Direct3D11 graphics, hardware scalers Networking, services
Related talks Title Session ID
Building Games for Windows 2-047
What’s new in Direct3D 11.2 3-062
Massive virtual textures for games: Direct3D and Tiled Resources 4-063
DirectX Graphics Debugging Tools 3-141
Bringing Desktop PC Games to the Windows Store 3-190
Tales from the Trenches: Developing “The Harvest” and “Gunpowder” with Unity 3-044
Accelerating Windows Store Game Development with Middleware 3-187
Bringing Halo: Spartan Assault to Windows tablets and mobile devices 2-049
From Android or iOS: Bringing Your OpenGL ES Game to the Windows Store 3-189
Cutting Edge Games on Windows Tablets 3-043
Play Together! Leaderboards with Windows Azure and iMultiplayer with WiFi Direct 3-051
Innovations in High Performance 2D Graphics with DirectX 3-191
Evaluate this session
Scan this QR code to evaluate this session and be automatically entered in a drawing to win a prize!
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Example Assets Used
DX9 DX10 DX11
Texture.dds BC1 4k x 2k BC1 4k x 2k BC7 4k x 2k
Normal.dds R8G8 2k x 1k BC5 4k x 2k BC5 4k x 2k
Height.dds R8 2k x 1k BC4 4k x 2k BC4 4k x 2k
DX9 DX10 DX11
Texture.dds BC1 4k x 2k .5 5.46MB
BC1 4k x 2k .5 5.46MB
BC7 4k x 2k 1 10.9MB
Normal.dds R8G8 2k x 1k 2 5.46MB
BC5 4k x 2k 1 10.9MB
BC5 4k x 2k 1 10.9MB
Height.dds R8 2k x 1k 1 2.73MB
BC4 4k x 2k .5 5.46MB
BC4 4k x 2k .5 5.46MB
Total Sizes: 14MB 14 + 22MB 14 + 27MB
Hardware Form Factors
Phone Tablet Desktop/LaptopAlways available10min engagementEach user has oneModerate performanceSmall display size 3-5”720-1080p resolutionDirectX 9Touch inputAlways connected -3G
Living Room, Commute30-60min engagementMultiple per householdModerate performance Med. display size 7-11”HD resolution (1080p)DirectX 9-11Touch input, stylusAlways Connected -WiFi
Seated at workstation2+hr sessionShared across householdTop performance hardwareLarge display size 13-24”Full 1080p or higher resolutionDirectX 11Mouse&Keyboard, trackpadAlways connected –LAN
Game Categories
Casual Mid-core AAASimple gameplay2-D Sprites1-10min sessionAsynch multiplayer4-25 weeks, $50k1-5 developersSelf-publishedEasy to port to new platforms$1 - $5 unit price~5% total user spend1-2GB installNot sticky, 4x turnover of AAAXBLIG1000s released/year
Moderate gameplay3-D rendered30min to 60minLocal multiplayer1 year, $100k to $2M5-10 developersSteam, XBLA, ImpulseReasonable porting cost$5 - $10Significant portion of spend2-8GB installVery popular with usersXBLA, PSN??
Challenging gameplay3-D Photo-Real2+hrs sessionWeb and local multiplayerUp to 2-5 years and $5-25M20-100 developersLarge PublishersChallenging to port ($1-2M/per)$20 - $60Majority of Total Game Spend8-25GB installCreate a loyal audienceXbox, PS3Dozens released /year