Md2010 jl-wp7-sl-game-dev

56,710 views

Published on

Introduction to windows phone 7 game development with Silverlight - for the demos please check http://silverlightguy.com

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
56,710
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 2.1
  • Md2010 jl-wp7-sl-game-dev

    1. 1.
    2. 2. Developing WP7 Appswith Silverlight<br />José Luis Latorre<br />Microsoft MVP, UX Specialist & Brainsiders CEO<br />http://silverlightguy.com<br />
    3. 3.
    4. 4. Generalni sponzori:<br />Organizatori:<br />Glavni sponzori:<br />Generalni medijski sponzor:<br />Sponzori:<br />Medijski sponzori:<br />Strateški partneri:<br />Službena PR agencija:<br />
    5. 5. Gameswith Silverlight? Why?<br />
    6. 6. Silverlight is for games?<br />Concretely, Silverlight isgood for casual gamesthatdoesn’trequireintensivegraphiccapabilities. <br />Wehavethefactthat:<br />Playerslove casual games (simple & easyto pick up and putdown).<br />Phone platforms are great for this<br />Silverlight isgreat for this.<br />
    7. 7. Why Silverlight <br />Compelling Cross-Platform User Experience<br />Flexible object-oriented model<br />Fully managed code to improve encapsulation and centralization<br />Declarative presentation language (Xaml)<br />Role specific tools<br />Rapid application development <br />Good performance<br />
    8. 8. Whatkind of games?<br />Word games<br />Desk games<br />Turn based strategy games<br />Pictorial games<br />Platform games<br />Touch interaction games<br />If this is what you want to write there might be no need to learn XNA..<br />
    9. 9. The Game Loop<br />
    10. 10. Game Loop I<br /><ul><li>The “GAME LOOP”
    11. 11. Executes once per frame
    12. 12. It handles all the game logic, animation, Collisions, manages input, applies game logic, etc.
    13. 13. Optimal game loop in Silverlight is usually implemented with CompositionTarget.Rendering, which executes once per rendered frame.
    14. 14. Final Hardware will execute 30 Frames Per Second
    15. 15. For details on deciding the Game Loop implementation, check http://nokola.com/ and its ”GameLoopsInSilverlight.docx” document. </li></li></ul><li>Game Loop II<br />Is the ”Heart Beat” of the game...<br />Typical game loop logic<br />Checks for user input<br />Checks for collisions<br />Updates all the game elements visuals<br />Draws all game elements (Actually not needed in Silverlight due to the Visual Tree Model)<br />Applies Game logic & AI.<br />
    16. 16. Game loop III<br />protectedDateTimelastTick; <br />public Page()<br />{<br />InitializeComponent();<br />CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);<br />lastTick = DateTime.Now;<br />}<br />void CompositionTarget_Rendering(object sender, EventArgs e)<br />{<br />DateTimenow = DateTime.Now;<br />TimeSpanelapsed = now - lastTick;<br />lastTick = now;<br /> //Game Logicgoeshere<br />}<br />
    17. 17. Sprites<br />The game characters can be represented by Sprites, which are usually represented by an image and a position on the game surface.<br />So they have:<br />Image.<br />Position.<br />Vector of movement.<br />Other details, depending on the game.<br />
    18. 18. Animated Sprites<br />An animated sprite is the natural evolution as it can show an animation instead of a still image, which is good if the player is walking, to show a walking animation. <br />So they have, additionally from the Sprite:<br />An animation or sequence of images, also called Frames.<br />Speed of the animation ( frames per second)<br />Number of Frames.<br />
    19. 19. Game character<br />A game character derives from a sprite or animated sprite and represents a game element, the player, an enemy, bonus, obstacle, etc..<br />It usually has its own logic and is tied to events that determine its behavior.<br />
    20. 20. Sprite, Camera, Action<br />(link to demo)<br />Note: This demo isderivedfrom a samplefrom Andy Bealieu. <br />
    21. 21. Collisions I<br />If two sprites (or animated sprites) collide, for example the player and a enemy, something must happen!!<br />For this, we must know if there is a collision between both sprites.<br />Usually a calculation of the bounding boxes will be enough.<br />
    22. 22. Collisions II<br />First, we need the bounding boxes of the two elements we want to discover if they have collided:<br />public static RectUserControlBounds(FrameworkElement control)<br />{<br />Point ptTopLeft = new Point(Convert.ToDouble(control.GetValue(Canvas.LeftProperty)), Convert.ToDouble(control.GetValue(Canvas.TopProperty)));<br />Point ptBottomRight = new Point(Convert.ToDouble(control.GetValue(Canvas.LeftProperty)) + control.Width, Convert.ToDouble(control.GetValue(Canvas.TopProperty)) + control.Height);<br />returnnew Rect(ptTopLeft, ptBottomRight);<br />}<br />
    23. 23. Collisions III<br />Next we validate if both bounding boxes overlap each other:<br />public static boolRectIntersect(Rectangle rectangle1, Rectangle rectangle2)<br />{<br />return (((double)rectangle1.GetValue(Canvas.LeftProperty) <= (double)rectangle2.GetValue(Canvas.LeftProperty) + rectangle2.Width)<br /> && ((double)rectangle1.GetValue(Canvas.LeftProperty) + rectangle1.Width >= (double)rectangle2.GetValue(Canvas.LeftProperty))<br /> && ((double)rectangle1.GetValue(Canvas.TopProperty) <= (double)rectangle2.GetValue(Canvas.TopProperty) + rectangle2.Height)<br /> && ((double)rectangle1.GetValue(Canvas.TopProperty) + rectangle1.Height >= (double)rectangle2.GetValue(Canvas.TopProperty)));<br />}<br />
    24. 24. Input<br />
    25. 25. Input via Buttons<br />Back – Start – Search Only<br />NOT usable for Games!<br />
    26. 26. Input via Touch<br /><ul><li>UIElement Class contains Events
    27. 27. ManipulationStarted
    28. 28. ManipulationDelta
    29. 29. ManipulationCompleted
    30. 30. Supported in Emulator
    31. 31. Requires Multitouch Monitor</li></li></ul><li>Input via Accelerometer<br />+Y<br />1<br />Measures force applied on each axis over time<br /><ul><li>Not supported by Emulator
    32. 32. Can be faked using Mouse Input + Perspective Transform</li></ul>-Z<br />-X<br />+X<br />+Z<br />-Y<br />
    33. 33. Alltogethernow!! – A shootinggame<br />(link to demo)<br />Note: This demo isderivedfroma greatsamplefromMatthew Casperson.<br />
    34. 34. Otherpoints<br />
    35. 35. Performance Statistics<br /><ul><li> Set EnableFrameRateCounter = true</li></ul>A – Render Thread Framerate<br />B – UI Thread Framerate<br />C – Amount of Video Memory Used<br />D – Total # of Textures Used<br />E – Total # of Intermediate Textures Used<br /><ul><li>Set EnableCacheVisualization = true
    36. 36. Tinted items are NOT being cached by GPU</li></li></ul><li>Automatic GPU Acceleration<br /><ul><li> Automatically Applied to
    37. 37. StoryBoardAnimations
    38. 38. Perspective 3D (PlaneProjections) – but only if they are applied by Storyboard animations.
    39. 39. Uses Video Card for Transform, Rotate, Scale, Rectangular Clip
    40. 40. NOT automatic for Procedural Animation!</li></li></ul><li>monetization<br />
    41. 41. Monetization<br />The Marketplace Hub<br />
    42. 42. Monetization<br />Try and buy<br />Detailed product description<br />Screen shots<br />Reviews & ratings<br />Related apps<br />Optional game content rating<br />More apps by developer<br />
    43. 43. Monetization<br />70% revenue share<br />Trial API<br />Credit card & mobile operator billing<br />Paid, ad funded and free apps<br />
    44. 44. Deployment Process<br />Develop <br />& Debug<br />Submit& Validate<br />Certify<br /> & Sign<br />Windows Phone Application Deployment Service<br />Marketplace<br />
    45. 45. resources<br />
    46. 46. Good resources<br />http://www.andybeaulieu.com<br />http://www.farseergames.com/blog/<br />http://blogs.silverarcade.com/silverlight-games-101/<br />http://forums.silverlight.net/<br />http://laumania.net/?tag=/game+development<br />http://expression.microsoft.com/en-us/dd835381.aspx<br />http://www.bluerosegames.com/brg/silverlight_game_development.aspx<br />http://Silverlightguy.com<br />
    47. 47. Cool games, samples & tuts<br />http://silverarcade.com/games/InnoveWare/quakelight<br />http://dobbschallenge2.com/<br />http://silverarcade.com/games/ddtmm/vsa<br />http://www.mashooo.com/SilverlightGames/Tire_Storm.aspx<br />http://dl.dropbox.com/u/2681028/CodeplexData/WriteableBitmapEx/BlitSample/TestPage.html<br />http://www.brighthub.com/internet/web-development/articles/14494.aspx<br />
    48. 48.
    49. 49. jose@brainsiders.com - @joslat<br />

    ×