Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

XNA And Silverlight


Published on

My slide deck from presenting to the Cleveland WPF User Group about using XNA inside Silverlight for web gaming.

  • Be the first to comment

  • Be the first to like this

XNA And Silverlight

  1. 1. XNA and Silverlight<br />Aaron Stanley King<br />
  2. 2. XNA and Silverlight<br />Free game development toolkit using .NET, C#<br />Extends Visual Studio 2010<br />Including the free C# Express Edition<br />Version 4.0<br />Cross Platform Input API<br />Enhanced Audio and Video<br />Windows Phone 7<br />App Hub membership<br />Develop and publish for Xbox 360 or Windows Phone<br />Unlock your phone to development and publish to the Zune Marketplace<br />$99/12 months<br />
  3. 3. Fundementals<br />Initialize<br />LoadContent<br />Update<br />Draw<br />UnloadContent<br />
  4. 4. The Game Loop<br />while (IsRunning) <br />{ <br />Update(); <br />Draw(); <br />}<br />
  5. 5. The Content Pipeline<br />
  6. 6. ScreenManager<br />screenManager= new ScreenManager(this);<br />Components.Add(screenManager);<br />void OptionsMenuEntrySelected(object sender, PlayerIndexEventArgs e) <br />{ <br />ScreenManager.AddScreen(new OptionsMenuScreen(), e.PlayerIndex); <br />}<br />Architectural Design (decide early if you want more than one ScreenManager)<br />GameScreen classes are loaded into a ScreenManager ( pretty! )<br />Simple transitions can be added (Bing for more)<br />GameComponent is very useful as a base class for most parts of your game<br />
  7. 7. Msft.Xna.FW.Input<br />GamePad<br />Buttons<br />ButtonState<br />GamePadDeadZone<br />GamePadType<br />Keyboard<br />Keys<br />KeyState<br />Mouse<br />Buttons<br />Position<br />Msft.Xna.Fw.Input.TOUCH<br />Input API<br />TouchPanel<br />GestureType<br />TouchLocationState<br />Msft.Devices.Sensors<br />Accelerometer<br />SensorState<br />
  8. 8. _soundEffect = Content.Load<SoundEffect>("ShotEffect");<br />var pan = (float)((_rnd.NextDouble() - 0.5) * 2.0);<br />varpitch = (float)((_rnd.NextDouble() - 0.5) * 2.0); <br />varvolume = (float)((_rnd.NextDouble() / 2.0) + 0.5); <br />_soundEffect.Play(volume, pitch, pan);<br />Audio<br />
  9. 9. Sorry, no transforms or storyboards<br />Just Draw ( most powerful method in the XNA universe )<br />public void Draw ( <br /> Texture2D texture, <br /> Vector2 position, <br />Nullable<Rectangle> sourceRectangle, <br /> Color color, <br /> float rotation, <br /> Vector2 origin, <br /> float scale, <br />SpriteEffectseffects, <br /> float layerDepth<br />)<br />Animations<br />
  10. 10. Silversprite<br />SilverArcade.SilverSprite.dll SilverArcade.SilverSprite.Core.dll <br />A little XAML<br /><UserControlx:Class="SilverSprite.Page" xmlns="http://schem...resentation" xmlns:x="http://schema...xaml" Width="400" Height="300" xmlns:game="clr-namespace:Game"> <Grid x:Name="LayoutRoot" Background="White"> <Canvas> <game:Game1 x:Name="game"/> </Canvas> </Grid> </UserControl> <br />Add content to your silverlightapp (/Content )<br />
  11. 11. Demo<br />
  12. 12. Xbox LIVE Indie Games<br />Publish your games to Xbox LIVE Marketplace<br />Profit!! 70%/30% baseline split<br />Time-limited trial, no free games<br />Charge 200, 400, or 800 points<br />150 MB limit for 400 and 800 point games<br />50 MB limit for 200 point games<br />You retain all rights and IP<br />(if Microsoft invests in further marketing, they reserve the right to take 10-30% more)<br />
  13. 13. Windows Phone Marketplace<br />Publish your games to Windows Phone Marketplace<br />Profit!! 70%/30% baseline split<br />Free apps are ok<br />Charge $.99 to $499 ( no points )<br />225 MB limit <br />You retain all rights and IP<br />You can’t charge for updates. It’s not in the Microsoft marketing strategy.<br />
  14. 14. Indie<br />Develop with XNA Studio<br />arcade<br />Leaderboards<br />Achievements<br />Xbox LIVE Rich Presence<br />Xbox LIVE Multiplayer<br />C++ and Native DirectX<br />Develop with XNA Studio<br />Why not go Pro!<br />
  15. 15. XNA Futures<br />
  16. 16. MSFT.XNA.FW.Input.You<br />Kinect for Windows SDK ( later this summer )<br />
  17. 17. Aaron Stanley King<br />Twitter -> @trendoid<br />Gamertag -> HeraldStudios<br />Email -> <br />Wanna play?<br />
  18. 18. Resources<br />App Hub<br />Silverlight Show<br />XNA 3.1 to 4.0 Cheat Sheet<br />Silversprite<br />Silver Arcade<br />MonoXNA<br />