• $10B in game software per year worldwide • 145M active gamers in US alone • Over 50% of all current ‘apps’

Download Report

Transcript • $10B in game software per year worldwide • 145M active gamers in US alone • Over 50% of all current ‘apps’

• $10B in game software per year worldwide
• 145M active gamers in US alone
• Over 50% of all current ‘apps’ are games
• Windows is now spanning an even broader range of devices
Windows 8 has everything you need
to write and ship a game to millions of customers
Typical Game Components
Your Killer Game
Graphics
Game Input
Audio
Cut Scenes
Local
Services
Connected
Services
Tools
3-D
Touch
Sound FX
Streaming
Activation
User ID
Compilers
2-D, Text
Sensors
Music
Effects
Storage
Distribution
Debuggers
UI Controls
Game
Controllers
Search &
Settings …
Roaming
Asset
Processors
Graphics
• Games require smooth interaction -> fast graphics
• DirectX gives you control of the low-level hardware
3D Rendering
• Direct3D 11 is fully supported in Metro style apps
• Choice of the latest AAA games
• All Windows 8 systems support Direct3D
• The most direct graphics API available in Windows 8
• Separate talk available on Direct3D <751>
• Hardware feature levels’ range from DirectX9 to DirectX11
• ‘Session on scaling visual quality across devices <752>
2D Rendering and Text
• Many popular games use 2-D rendering
• Even 3-D games have “HUD Art”: score, health bar, etc.
• Direct2D is the rendering API for 2-D graphics
• Drawing vector graphics, bitmaps, image effects, and text
• Use DirectWrite for world-ready text layout and formatting
• Works seamlessly with Direct3D
• All Direct3D samples use Direct2D for HUD elements
Input
Input
• Touch
• PointerPoint API supports touch, + mouse, and stylus
• Sensors
• Sensor APIs return data from Gyro, Accelerometer, and Compass
• ‘Sensor Fusion’ returns orientation state computed from all three
• Game Controllers
• XInput API supports Xbox game controllers
Audio and Video
Audio
• XAudio2
• Optimized for low-latency playback of sound effects
• Performs efficient mixing of multiple simultaneous effects
• Media Foundation
• Simplifies streaming audio such as background music,
• Can access songs from music library via a contract
Cut Scenes
• Media Foundation
• Simplifies streaming video playback
• Supports a variety of media formats
• Video is integrated with Direct3D11 for optimal performance
• See talk on Game Audio and Media <755>
• Initialization
• Allocate resources
• Load state, load media assets
• Main Loop:
• Poll input
-local controls and network input
• Update state -AI, physics, collisions, animations, etc.
• Render
-generate the graphics for the new state
• Present
-present the resulting image on the display
• Update Audio
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Core;
auto dispatcher = m_window->Dispatcher;
m_window->Activate();
while( true )
// Main app loop
{
dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
updateAnimatedState();
// update app logic, animations, etc.
m_renderer->Render();
// render scene to an image
m_renderer->Present();
// present the image on the display
}
// syncs with display refresh
Local Windows Services
A Good Game is a Good Metro style app
•
•
•
•
•
Activation
Splash Screen
Loading state
Suspend/resume
Saving State
•
•
•
•
•
Screen Layouts
Tiles and Notifications
App Bar
Settings Menu
Sharing
•
•
•
•
Included in your .appx package
Gets displayed by OS before app launch
Covers time spent activating app
App should provide additional cover if it can’t run immediately
• No synchronous loading more than 5 sec
• Ideal user experience is less than ½ second
1. Synchronous load on app start (e.g. under OS splash screen)
• This can hit the timer, and is not an ideal user experience
2. Set up a loading screen and load behind that
• Delivers user feedback via progress bar
3. Stream asynchronously to pre-fetch data on demand
• Async I/O routines help with this
4. Procedurally generate content
User
Launches
App
• Suspend is triggered when app is no longer visible
• Time window of no more than 5 seconds
• Well-behaved apps should be much faster
• Game should stop rendering, save state, and free temp memory
• Avoid Termination
• App will be terminated if there is memory pressure
• App with largest memory usage is the first to get cut
• Games often are larger memory users, so free as many resources as
possible on suspend (free scratch buffers, etc.)
Suspending
ref new
void Simple3DGame
Object
SuspendingEventArgs
SuspendingOperation
SuspendingDeferral
// Save game state.
1. Level-based: Save state at end of level, or at each checkpoint
• Issue: Player will have to replay that level if app gets terminated
2. Save recent state on Suspending event
• Player can continue in the middle of a level, even after a terminate
• Need to be quick (5s limit)
3. Save state opportunistically
• Levels, checkpoints, pauses, major events, etc.
• Async file routines help here
• App Storage APIs
• [891] Using Files is the presentation on these
Landscape
Portrait
• Apps can select preferred initial orientation
• And can elect not to rotate
• Apps can rotate their own rendering based on sensors
• Apps will get resize events for these
• They only occur in landscape orientation
• Real-time games can just pause when snapped
• Put up status info, etc.
• Good place to show the status
• What level you are on
• Number of friends playing
• Time until raid starts
Notifications
• Notifications = instant news
• When someone beats your high score
• When a Friend gets an achievement
• Notifications must be minimal
• Only when user has enabled one
• Check out talk <396> on tiles and notifications
• Standard item on ‘Charms Bar’
• Activated by swipe-in from right
• Users will know to look here for
• In-game options (difficulty)
• Input control settings/options
• Try not to use for:
• Graphics quality settings
• System features
• This is an ideal mechanism for sending
• In-game screenshots
• Brag clips
• These can go into the user’s libraries or to online apps via the
share contract
• With a custom version, app can remove text, etc.
• Runtime networking e.g. for multiplayer games
• Co-operative, or PVP
• API: WinRT Sockets, WebSockets
• Simplified syntax, transparent NAT traversal
• See talk [580]
• Xbox LIVE multiplayer APIs
• See talk [756] Building Xbox LIVE Games for Windows 8
Connected Services
Connected Services
• Windows Live
• Live ID, SkyDrive, Windows 8 roaming state service
• Windows Store
• See store talk [121]
• Xbox LIVE for Windows
• See talk [756] Building Xbox LIVE Games for Windows 8
• Azure
• Talk [871] Building Social Games for Windows 8 with Windows Azure
Roaming State
• Basic service is a part of Windows 8
• [402] Deep Dive on Application Data Roaming
• [475] Create App Experiences that Span Time and Space
• Broader set of services available from Xbox Live
• Already announced
Tools
• Enhanced with new game-oriented features:
• Updated C++ language support
• File->New Project templates for Direct3D and DX native C++ apps
• DirectX HLSL shader compilation and syntax highlighting
• Packaging compiled HLSL shaders into the .appx package
• Support for other asset types in MSBUILD and previewer
• Visualization, processing and packaging of
•
Textures, meshes, shaders, and audio
• Debugging DirectX API calls
• Separate talk <761>
Typical Game Components
Your Killer Game
Graphics
Game Input
Audio
Cut Scenes
Local
Services
Connected
Services
Tools
3-D
Touch
Sound FX
Streaming
Activation
User ID
Compilers
2-D, Text
Sensors
Music
Effects
Storage
Distribution
Debuggers
UI Controls
Game
Controllers
Search &
Settings …
Roaming
Asset
Processors
Windows 8 Game Platform Technologies
Your Killer Game
Graphics
Movies &
Cut Scenes
Game
Input
Direct3D
DirectX
Video
Pointer
Point
Direct2D
Media
Foundation
SensorAPI
TBA
XInput
Local
Services
Connected
Services
Tools
XAudio
PLM
Windows
Live
Visual
Studio
WASAPI
AppData
Windows
Store
Asset
Viewers
Contracts
XBox Live
Asset
Processors
Audio
Windows 8 provides all the features you need
for a Metro style game
Go for it!
Feature
Solution
#
Talk
Sample
Graphics
DirectX
PLAT-766T
Introduction to DirectX for Metro style apps
3D Rendering
Direct3D
PLAT-751T
3D Graphics in Metro Style Apps and Games
Simple3DGame
Asset Processing
VS11
TOOL-761T
A lap around DirectX game development tools
ResourceLoading
3D Performance
Direct3D11
PLAT-752T
Tuning GPU usage for any form factor
Simple3DGame
2D, Text, Imaging
Direct2D
PLAT-769T
Achieving high performance 2D graphics with Direct2D
C++ Language
VS11 C++
TOOL-532T
Using the Windows Runtime from C++
IDE and Debugging
VS11
TOOL-761T
A lap around DirectX game development tools
File->New Project
Touch
PointerPoint
APP-186T
Build advanced touch apps in Windows 8
Simple3DTouch
Accelerometer/Gyro
SensorAPI
PLAT-781T
Using location & sensors in your app
MarbleMaze
Game Input
XInput
PLAT-754T
From touch to gamepads: master player input in your Metro
style game
SimpleController
Game Audio&Video
XAudio2
PLAT-755T
Compelling audio and video for Metro style games
BasicSound
Networking
WebSockets
PLAT-580T
Building Windows runtime sockets apps
Xbox Services
XBoxLive
PLAT-756T
Building Xbox LIVE games for Windows 8
OS Services
Windows 8
All
BUILD Conference
DOCUMENTATION & ARTICLES
Build your first Metro style game with DirectX
Creating a DirectX game
Developing the Metro style Marble Maze game with DirectX
Creating a Metro style JavaScript Game
http://forums.dev.windows.com
http://bldw.in/SessionFeedback