1 / 35

Developing Games for Windows Phone with XNA Game Studio 4.0

SESSION CODE: W00T!. Developing Games for Windows Phone with XNA Game Studio 4.0. Paul Foster Developer Evangelist Microsoft. Xbox LIVE Hub. Xbox LIVE is Gaming Services. Gamertag. Friends. Achievements.

latif
Download Presentation

Developing Games for Windows Phone with XNA Game Studio 4.0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SESSION CODE: W00T! Developing Games for Windows Phone with XNA Game Studio 4.0 Paul Foster Developer Evangelist Microsoft

  2. Xbox LIVE Hub

  3. Xbox LIVE is Gaming Services Gamertag Friends Achievements Windows Phone will extend the Xbox LIVE brand beyond the console for the first time Merchandising Premium Placement • Windows Phone is the first step towards our vision of a ubiquitous gaming service Differentiates your title from the rest

  4. Leveraging the Right Technology Graphics For 3D graphics your only choice is the XNA Framework Game Loop Sprite heavy 2D applications should consider the XNA Framework Game Loop Simulation/Drawing Those who prefer a traditional update/draw/present frame loop should leverage the XNA Framework Game Loop Tooling Those who want to leverage the XNA Framework Content Pipeline graphics types

  5. XNA Game Studio 4.0 Develop games for Windows Phone 7 Series Enhanced audio support Simplified graphics API’s Visual Studio 2010 integration New configurable effects

  6. Powerful

  7. Managed Code for Game Development Windows Phone 7 Series Uses the .NET platform • Managed code platform, no unsafe code .NET/XNA is used for games today! • XNA Game Studio 4.0 is C# exclusive 800+ managed code games on XBLA/XBLIG • Windows games published through portals

  8. Addressing Performance Head-on Frameworks designed for performance Frameworks designed for performance Frameworks designed for performance Frameworks designed for performance XNA Framework designed for gaming scenarios Commitment to future of managed code No unnecessary garbage generation • Three+ years of profiling and investment • We’ve built for performance on Windows Phone 7 Series • Math libraries optimized • Efficient APIs with tuned transitions to native code

  9. demo Exercising the platform…

  10. Productive

  11. Visual Studio & .NET Productive development with .NET & C# High performance IDE Intellisense makes coding faster Integrated build/deploy/debug experience MSBuild engine for build automation

  12. Content Pipeline Simplify Your Content Usage! Manage assets in Visual Studio Importers for common game data formats Optimize data into binary format for efficient loading Fully extensible XNA Framework/Game Loop not required Content projects external in XNA Game Studio 4.0

  13. XNA Framework Simplifying Game Development

  14. XNA Framework Game Loop Start Simple and Customize! XNA Framework Game Loop Example • protectedoverridevoid Update(GameTimegameTime) • { • // Allows the game to exit • if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) • this.Exit(); • // TODO: Add your update logic here • base.Update(gameTime); • } • protectedoverridevoid Draw(GameTimegameTime) • { • GraphicsDevice.Clear(Color.CornflowerBlue); • // TODO: Add your drawing code here • base.Draw(gameTime); • } Traditional update/draw/present frame loop Core programming model consistent with previous releases Changes implemented yield better power performance on devices System integration with Windows Phone 7 Series best practices Translated to existing XNA Framework concepts

  15. Graphics Let’s Get Visual, Visual!

  16. Five Configurable Effects BasicEffect DualTextureEffect AlphaTestEffect SkinnedEffect EnvironmentMapEffect Plus hardware accelerated 2D sprite drawing

  17. BasicEffect BasicEffect DualTextureEffect AlphaTestEffect SkinnedEffect EnvironmentMapEffect • 0-3 directional lights • Blinn-Phong shading • Optional texture • Optional fog • Optional vertex color

  18. DualTextureEffect BasicEffect DualTextureEffect AlphaTestEffect SkinnedEffect EnvironmentMapEffect • For lightmaps, detail textures, decals • Blends two textures • Separate texture coordinates • Modulate 2X combine mode (A*B*2) • Good visuals at low pixel cost

  19. AlphaTestEffect BasicEffect DualTextureEffect AlphaTestEffect SkinnedEffect EnvironmentMapEffect • For billboards and imposters • Adds alpha test operations (pixel kill) • Standard blending is free with all effects • Only need alpha test if you want to disable depth/stencil writes

  20. SkinnedEffect BasicEffect DualTextureEffect AlphaTestEffect SkinnedEffect EnvironmentMapEffect • For animated models and instancing • Game code animates bones on CPU • Vertex skinning performed by GPU • Up to 72 bones • One, two, or four weights per vertex

  21. EnvironmentMapEffect BasicEffect DualTextureEffect AlphaTestEffect SkinnedEffect EnvironmentMapEffect • Oooh, shiny! • Diffuse texture + cube environment map • Cheap way to fake many complex lights • Fresnel term simulates behavior when light reaches a surface and some reflects, some penetrates

  22. System Support: Scaler & Orientation Write your game without worrying about native resolution or orientation Automatic rotation between portrait and landscapeTouch automatically supports both scale and orientation changes Scaler can drastically improve performance Trade off performance for “crispness” & shade fewer pixels800x480 = 384,000 pixels, 480x320 = 153,600 pixels Upsample an arbitrary back buffer to native device resolution Far higher quality than bilinear filteringAllows for easier porting from other platforms Scaling/Rotation comes for “free” from Hardware

  23. Audio & Media Can You Hear Me Now?

  24. Audio Audio Capture Example publicvoidEventDrivenCapture() { mic = Microphone.Default; buffer = newbyte[mic.GetSampleSizeInBytes(mic.BufferDuration)]; mic.BufferReady += newEventHandler(OnBufferReady); DynamicPlayback = newDynamicSoundEffectInstance(mic.SampleRate, AudioChannels.Mono); } publicvoidOnBufferReady(object sender, EventArgsargs) { // Get the latest captured audio. int duration = mic.GetData(buffer); // Do some post-capture processing and playback. MakeMeSoundLikeARobot(buffer, duration); DynamicPlayback.SubmitBuffer(buffer); } Audio Capture & Playback Simple API to play back WAV data Modify pitch, volume, pan audio Ability to play synthesized/buffered audio Serialize captured data Provides more control over System.Media types on Windows Phone 7 Series Audio Playback Example // Load a sound effect from a raw stream SoundEffecteffect1 = SoundEffect.FromStream( GetStreamFromTheWeb("http://url.wav")); effect1.Play(); // Create dynamic audio on the fly byte[] fluteSound = GetFluteNote(); effect2 = newSoundEffect(fluteSound, SampleRate, AudioChannels.Stereo); SoundEffectInstanceinstance = effect2.CreateInstance(); instance.Pan = -1; instance.Pitch = 1.5f; instance.Play(); Microphone/Bluetooth Support Playback through headset Capture through mic or headset

  25. Media – Music/Photos/Video URI Song Playback Example Music Enumeration & Playback // Constructs a song from a URI UrimediaStreamUri = newUri("http://song.asx"); SongstreamedSong = Song.FromUri("Song", mediaStreamUri); // Play the song MediaPlayer.Play(streamedSong); Control and enumerate users’ media within a game Ability to play songs from URI/URL (i.e. music app) Picture Enumeration & Playback Supports photo picking/editing/publishing Retrieve Image Data MediaLibrary media = newMediaLibrary(); // Get the JPEG image data StreammyJpegImage = ReadAndModifyPicture(somePicture); // Save texture to Media Library   media.SavePicture("Awesome", myJpegImage); Video Playback Uses standard video player API Show/Hide controls

  26. Input / Touch Interacting with games gets easier!

  27. Input Overview Cross Platform Input API Xbox 360 Controllers (Xbox/Windows) Keyboard (Xbox/Windows/Windows Phone 7 Series) Touch Input Handling vartouchCollection = TouchPanel.GetState(); //... foreach (vartouchLocationintouchCollection) { if (touchLocation.State == TouchLocationState.Released) { //... } } Touch API Available across platforms for portability (fewer #ifdefs) Multipoint on Windows Phone 7 Series and Windows Orientation and resolution aware Developer can override

  28. Sensors Using Silverlight and the XNA Framework

  29. Sensor Overview Leverage Platform Features on Windows Phone 7 Series VibrationExample VibrateControllerrumbler; rumbler.Start(TimeSpan.FromSeconds(2)); Location Accelerometer Vibration Accelerometer Example AccelerometerSensor accelerometer; AccelerometerReadingaccelerometerReading; accelerometer = AccelerometerSensor.Default; accelerometer.ReadingChanged += AccelerometerReadingChanged; accelerometer.Start();

  30. demo Build a game in minutes…

  31. Portable

  32. Target Three Screens XNA Framework designed to be cross platform Smaller time investment & target more sockets Project synchronization between platforms

  33. Summary Powerful Great managed code games, working today Windows Phone provides a powerful platform for gaming Productive Focus on being a game developer Great tools make you more productive Portable Target more platforms easily Focus on your game differences, not the technology

  34. © 2008 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.

More Related