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.

Download Report

Transcript 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.

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
PennyArcade on 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
Graphics
Movies & Cut
Scenes
Game Input
Audio
Local
Services
Connected
Services
Tools
Direct3D11
DirectX
Video
Pointer
Point
WASAPI
PLM
Windows
Live
Visual Studio
Direct2D
Media
Foundation
Sensor API
XAudio2
AppData
Windows
Store
Asset
Viewers
Contracts
Xbox LIVE
Asset
Processors
HTML
XAML
XInput
PointerPoint Input
win->PointerPressed += ref new TypedEventHandler<CoreWindow^,PointerEventArgs^>
(this, &LonLatController::OnPointerPressed);
void LonLatController::OnPointerPressed(
_In_ CoreWindow^ sender,
_In_ PointerEventArgs^ args
)
{
float2 position = float2(
args->CurrentPoint->Position.X,
args->CurrentPoint->Position.Y
);
// position of contact
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
Graphics
Movies & Cut
Scenes
Game Input
Audio
Local
Services
Connected
Services
Tools
Direct3D11.2
DirectX
Video
Pointer
Point
WASAPI
PLM
Windows
Azure
Live, Azure
Visual Studio
Direct2D
Media
Foundation
Sensor API
XAudio2
AppData
Windows
Store Install
Asset
Viewers
Contracts
Xbox LIVE
Asset
Processors
WiFi Direct
Shader
Debugging
HTML
XAML
XInput
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 SLI
reduced-precision data types, shadow sampling, etc.
DirectX 11 Feature Levels
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
Vertex shaders
Pixel shaders
8 Textures
4 Render Targets
Cube maps
Volume textures
Anisotropic filtering
Antialiasing
HDR rendering
Texture compression
BC1, BC2, BC3
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
DirectX 11 Feature Level 11
Vertex shaders
Pixel shaders
8 Textures
4 Render Targets
Cube maps
Volume textures
Anisotropic filtering
Antialiasing
HDR rendering
Texture compression
BC1, BC2, BC3
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
Approximate Market Segmentation
Creating the Direct3D Device and Context
ComPtr<ID3D11Device>
ComPtr<ID3D11DeviceContext>
nullptr
// use the default adapter
// use 0 unless a software device
// defined above
// what app will support
// should always be D3D11_SDK_VERSION
// created device
// feature level of the device
// corresponding immediate context
Tiled Resources
Graphine
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
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
x64 Binaries
ARM Binaries
Audio
Textures
Shaders
Animations
Audio
Textures
Shaders
Animations
Audio
Textures
Shaders
Animations
2GB
2GB
2GB
App Packages in Windows 8.1
x86 Binaries
x64 Binaries
ARM Binaries
Audio
Audio
Audio
Textures
Textures
Textures
Shaders
Shaders
Shaders
Animations
Animations
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
DX9 Textures
DX10 Textures
DX11 Textures
1.0x UI Elements
1.4x UI Elements
1.8x UI Elements
ARM Binaries
Deployment 2
x64 binaries
DX11 Textures
1.4x UI elements
x64 Binaries
DX9 Textures
DX11 Textures
1.0x UI Elements
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
Create the
App 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
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
Cutting Edge Games: Controls
Automatic Input Routing
Touch
Weight
Mouse
Weight
Keyboard
Weight
Game Controller
Weight
Accelerometer
Weight
+
Game
Logic
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
Tablets
Convertibles
Notebooks
Desktops & All-in-Ones
26
27
2-D Visuals: New DPIs
At 10” tablet panel
1366*768 1.0x
1920*1080 1.4x
2560*1440 1.8x
OS DPI Scale factors
Modern
1.0x
1.4x
1.8x
Desktop
1.0x
1.25x
1.5x
2.0x
New Resolutions And Performance
1024*768 0.75MPix
1280*800 1 MPix
1366*768 1 MPix
1600*900 1.4MPix
1920*1080 2 MPix
2560*1600 4 Mpix
3840*2160 8 Mpix
Hardware Solution: Scalers and Overlays
For performance, hardware can scale up imagery for free
Main 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
HUD swap chain
Hardware accelerated composition of overlay
elements onto background content
outRGB = topRGB + bottomRGB*(1 – topA)
3D swap chain
(1920x1080)
(1280x720)
Display
See talk 3-062: What’s New in Direct3D
(1920x1080)
Swapchain Creation
DXGI_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 XAML
Create a separate IFrameworkView in the same window/rect
Analogous to XNA’s GameScreen helper class
Can use XAML in menu view, & pure DX in game view
Open a new window (split-screen) from your app
Lets user control split with familiar OS UI
Switch using Activate() method
Closes 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 API
Lets users control split via familiar OS UI
Can 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 gameplay
Auto-resume on tap/click or just a timer
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-Mon
More screen real-estate
“Docking” your tablet
Projection/TV
Immersion
Share 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 Miracast
Miracast (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 available
Start
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-Resume
Tablet to convertible to laptop to desktop PC
use roaming, save state and dynamic input switching
Windows 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 considerations
New 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 Desktop
Windows Store
Windows Phone
Console
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 2013
2-211
C++ for Windows Phone
3-329 Using VS C++ 2013 to get the best performance
3-308 C++ Best Practices
Cutting Edge Game Features
Windows 8
Direct3D 11.1
XAudio
PointerPoint
MouseLook
XInput
C++
Windows 8.1
Direct3D11.2
Tiled Resources
Scalers & Overlays
HLSL Shader linker
8-25GB packages
Multi-mon
Wi-Fi Direct
Go For It
Get 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
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
BC4 4k x 2k
BC4 4k x 2k
2k x 1k
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
BC4 4k x 2k
.5
5.46MB
BC4 4k x 2k
.5
Total Sizes:
2k x 1k
1 2.73MB
14MB
14 + 22MB
5.46MB
14 + 27MB
Hardware Form Factors
Phone
Tablet
Desktop/Laptop
Always available
10min engagement
Each user has one
Moderate performance
Small display size 3-5”
720-1080p resolution
DirectX 9
Touch input
Always connected -3G
Living Room, Commute
30-60min engagement
Multiple per household
Moderate performance
Med. display size 7-11”
HD resolution (1080p)
DirectX 9-11
Touch input, stylus
Always Connected -WiFi
Seated at workstation
2+hr session
Shared across household
Top performance hardware
Large display size 13-24”
Full 1080p or higher resolution
DirectX 11
Mouse&Keyboard, trackpad
Always connected –LAN
Game Categories
Casual
Mid-core
AAA
Simple gameplay
2-D Sprites
1-10min session
Asynch multiplayer
4-25 weeks, $50k
1-5 developers
Self-published
Easy to port to new platforms
$1 - $5 unit price
~5% total user spend
1-2GB install
Not sticky, 4x turnover of AAA
XBLIG
1000s released/year
Moderate gameplay
3-D rendered
30min to 60min
Local multiplayer
1 year, $100k to $2M
5-10 developers
Steam, XBLA, Impulse
Reasonable porting cost
$5 - $10
Significant portion of spend
2-8GB install
Very popular with users
XBLA, PSN
??
Challenging gameplay
3-D Photo-Real
2+hrs session
Web and local multiplayer
Up to 2-5 years and $5-25M
20-100 developers
Large Publishers
Challenging to port ($1-2M/per)
$20 - $60
Majority of Total Game Spend
8-25GB install
Create a loyal audience
Xbox, PS3
Dozens released /year