Have you ever dreamed of writing your own video game but didn’t know where to start? During the past five years Microsoft’s XNA framework has become a favorite of Windows and Xbox game developers everywhere. XNA uses the same great Visual Studio development environment you are used to but brings a slew of features specifically for games development. With the release of Windows Phone last year XNA can now be used to create Windows Phone games exposing your ideas to a whole new marketplace! We’ll charge full speed into XNA to learn about the basic Windows Phone model, explore its core device characteristics, and review highlights of the XNA phone framework. Finally, we’ll explore some of the cool games that have been developed specifically for Windows Phone and even learn how to build one ourselves.
You will learn:
Get up to speed on utilizing Microsoft XNA Tools for Windows Phone
Get exposed to freely available third party tools and frameworks that will help jumpstart your game
Learn how to make money through in game Advertising as well as the new Trial mode on Windows PhoneWalk away with the foundation for a game we will build first hand during the session
Source code can be found on Github here: http://github.com/disbitski
Living the Dream: Make the Video Game You’ve Always Wanted and Get Paid For It!
1. Living the dream: make the video game
you’ve always wanted and get paid for it!
Dave Isbitski
Sr. Developer Evangelist, Microsoft
http://blogs.msdn.com/davedev
@TheDaveDev
Level: Intermediate
2. Agenda
• Windows Phone
– A new world of opportunity
• XNA Game Studio 4.0
– Xbox and Windows Phone
• XNA Framework for Phone
– Game Loop, Touch, Accelerometer, Sound,
Graphics
• Making $ Money $ in the Marketplace
3.
4.
5. Large and 40,000+ certified applications and games
Growing Growing at over 100 new apps per day
Selection of 61% Paid, 39% Free
70+ exclusive Xbox LIVE games
Apps & Games
38,000+ developers registered
From Many 7,300+ developers have submitted one or more
Developers apps
1,200 new developers every week
Loved 12 Downloads per User per Month
10% Conversion rate from Trial to Paid Purchase
by Users Daily Merchandising drives 500% download uplift
MO Billing now available to over 50% of Windows
Generating Phone users
% Paid Downloads: 3.2%
5 High ARPU Paid Apps Average Selling Price: $2.93; High ad
monetization rate
6. Promoting Your App
Merchandizing Placements
Merchandizing Placements
PlacementType
Placement Type Panorama
Panorama Featured Icon
Featured Icon Featured List
Featured List
Download Uplift
DownloadUplift 2000%
2000% 800%
800% 150%
6
11. Gamertag
Friends
Achievements
Windows Phone will extend the
Xbox LIVE brand beyond the
Merchandising console for the first time
Premium Placement
Windows Phone is the first step
towards our vision of a
ubiquitous gaming service
Differentiates your title from the
rest
14. Makes game development easier
XNA Framework provides robust APIs for games
C#, .NET and Visual Studio tooling
Solutions for game content processing
Not an engine solution
Creating
Games
15.
16. Develop Enhanced
exciting audio
games support
Simplified Visual Studio
graphics 2010
API’s integration
New
configurable
effects
16
20. Typical Game Loop
Load content when they start Initialize
Initialize() Load
LoadContent() Get User
Engine Resources Input
Update the game world Update()
Draw the game world Calculate
Test Criteria
Draw()
UnloadContent() Give
Free Resources FeedBack
20
21. Start simple and customize! XNA Framework Game Loop Example
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
Traditional update/draw/ if
present frame loop (GamePad.GetState(PlayerIndex.One).Buttons.Back ==
ButtonState.Pressed)
Core programming model this.Exit();
consistent with previous releases
// TODO: Add your update logic here
Changes implemented yield
better base.Update(gameTime);
power performance on devices }
System integration with protected override void Draw(GameTime gameTime)
{
Windows Phone 7 best practices GraphicsDevice.Clear(Color.CornflowerBlue);
Translated to existing // TODO: Add your drawing code here
XNA Framework concepts
base.Draw(gameTime);
}
22.
23. Scaler
Write your game without worrying about native resolution or orientation
Automatic rotation between portrait and landscape
Touch automatically supports both scale and orientation changes
Scaler can drastically improve performance
Trade off performance for “crispness” and shade fewer pixels
800x480 = 384,000 pixels, 480x320 = 153,600 pixels
Upsample an arbitrary back buffer to native device resolution
Far higher quality than bilinear filtering
Allows for easier porting from other platforms
Scaling/Rotation comes for “free” from Hardware
24.
25. Input Overview
Cross Platform Input API
Xbox 360 Controllers
(Xbox/Windows)
Touch Input Handling
Keyboard
(Xbox/Windows/Windows Phone 7) var touchCollection = TouchPanel.GetState();
Touch API //...
Available across platforms for foreach (var touchLocation in touchCollection)
portability {
(fewer #ifdefs) if (touchLocation.State ==
TouchLocationState.Released)
Multipoint on Windows Phone 7 {
and Windows //...
}
Orientation and resolution aware }
Developer can override
26. Touch gestures
• The touch panel can detect a number of different
gestures including
– Tap
– DoubleTap
– Hold
– HorizontalDrag, VerticalDrag and FreeDrag
– Pinch
– Flick
TouchPanel.EnabledGestures = GestureType.Flick;
27.
28.
29.
30.
31.
32. Audio Capture Example
Audio public void EventDrivenCapture()
{
mic = Microphone.Default;
buffer = new byte[mic.GetSampleSizeInBytes(mic.BufferDuration)];
Audio Capture and mic.BufferReady += new EventHandler(OnBufferReady);
DynamicPlayback = new DynamicSoundEffectInstance(mic.SampleRate,
Playback }
AudioChannels.Mono);
public void OnBufferReady(object sender, EventArgs args)
Simple API to play back WAV data {
// Get the latest captured audio.
int duration = mic.GetData(buffer);
Modify pitch, volume, pan audio
// Do some post-capture processing and playback.
Ability to play synthesized/buffered audio MakeMeSoundLikeARobot(buffer, duration);
DynamicPlayback.SubmitBuffer(buffer);
Serialize captured data }
Provides more control over
System.Media
types on Windows Phone 7 Audio Playback Example
// Load a sound effect from a raw stream
SoundEffect effect1 =
Microphone/Bluetooth
Support SoundEffect.FromStream(GetStreamFromTheWeb("http://url.wav"));
effect1.Play();
Playback through headset
// Create dynamic audio on the fly
Capture through mic or headset byte[] fluteSound = GetFluteNote();
effect2 = new SoundEffect(fluteSound, SampleRate,
AudioChannels.Stereo);
SoundEffectInstance instance = effect2.CreateInstance();
instance.Pan = -1; instance.Pitch = 1.5f;
instance.Play();
33. Media – Music/Photos/Video
Music Enumeration and URI Song Playback Example
// Constructs a song from a URI
Playback Uri mediaStreamUri = new
Control and enumerate users’ Uri("http://song.asx");
Song streamedSong =
media within a game
Song.FromUri("Song",
Ability to play songs from URI/URL mediaStreamUri);
(i.e. music app) // Play the song
MediaPlayer.Play(streamedSong);
Picture Enumeration and
Playback
Supports photo Retrieve Image Data
picking/editing/publishing
Video Playback MediaLibrary media = new MediaLibrary();
// Get the JPEG image data
Uses standard video player API Stream myJpegImage =
ReadAndModifyPicture(somePicture);
Show/Hide controls
// Save texture to Media Library
media.SavePicture("Awesome", myJpegImage);
39. Render Silverlight over XNA Graphics
• Silverlight Page is still active when using XNA
Shared Rendering
•
•
– UI, controls, and input
– Texture models
– Imposters/Billboards
• Text input, Storyboards, and Animations all available
43. Trial Mode
Simple check
Simulate for testing
Send user to your Marketplace offer
Trial Mode
Guide.SimulateTrialMode = true;
// if we are in trial mode, show a marketplace offering
if (Guide.IsTrialMode)
{
PlayerIndex playerIndex =
Gamer.SignedInGamers[0].PlayerIndex;
Guide.ShowMarketplace(playerIndex);
}
44. PubCenter Advertising SDK
• Very easy to incorporate ads into XNA
games
• Download the Ad-Control SDK
• AdManager added as a game component – easy to
retro-fit to an existing game
• Players can click through an advertisement
to a web site or call the advertiser from within
your game
• Advertisements are specifically targeted at each player
demographic
• You get 70% of the revenue
45. • Sign up here so that you can incorporate ads in your
games: http://pubcenter.microsoft.com
• Find out more about Windows Phone Advertising
http://advertising.microsoft.com/mobile-apps
46. • The Advertising SDK is now part of the Windows
Phone SDK
• You can include a n XNA Drawable Ad into a game
• This is very easy to do – full code example on my
Blog
• http://blogs.msdn.com/b/davedev/p/events.aspx
49. Today (16)
Publish Apps to More Places + 19 New (35)
Hong Kong
Singapore
1.8 Billion more potential users
49
50. Call to Action
Download the Windows Phone Developer Tools
http://create.msdn.com
http://creators.xna.com
wpgames@microsoft.com
Fun First. Test on a device if possible!
51. Living the dream: make the video game
you’ve always wanted and get paid for it!
Dave Isbitski
Sr. Developer Evangelist, Microsoft
http://blogs.msdn.com/davedev
@TheDaveDev
Level: Intermediate