You are previewing Windows Phone 8 Game Development.
O'Reilly logo
Windows Phone 8 Game Development

Book Description

A practical guide to creating games for the Windows Phone 8 platform

  • Create a 3D game for the Windows Phone 8 platform

  • Combine native and managed development approaches

  • Discover how to use a range of inputs, including sensors

  • Learn how to implement geolocation and augmented reality features

  • Allow communication between players via web services

  • Prepare and publish your game in the Windows Phone Store

In Detail

Currently almost everyone has a mobile phone that is used not only for calling, texting, and browsing the Internet, but also as an entertainment and social platform. Developers can create advanced 3D games with outstanding functionality that allow the player to enjoy the game directly on the mobile phone and cooperate with other players via the Internet!

Windows Phone 8 Game Development is a practical, hands-on guide that will show you how to create a 3D game for the Windows Phone 8 platform. From setting up the environment to publishing your game, you will first learn how to implement 3D and 2D graphics with Direct3D, XAML, C++, and C#. We will then look at the game logic, steering with sensors, detecting collisions, as well as using maps, geolocation, augmented reality, social networks, and web services to share data between players. Featuring many code examples, images, and diagrams you should find the content both engaging and easy to understand.

Table of Contents

  1. Windows Phone 8 Game Development
    1. Table of Contents
    2. Windows Phone 8 Game Development
    3. Credits
    4. About the Author
    5. Acknowledgments
    6. About the Reviewer
    7. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
      2. Why Subscribe?
      3. Free Access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Getting Started
      1. Windows Phone platform
      2. Managed, native, and hybrid development
        1. Managed approach
        2. Native approach
        3. Hybrid approach
      3. First steps
        1. Software Development Kit
        2. Integrated Development Environment
        3. Developer account registration
        4. Phone registration
      4. Concept of the game
        1. Objective
        2. Screens
        3. Architecture
        4. Programming languages and technologies
      5. Summary
    10. 2. Game User Interface
      1. New project
      2. Project structure
      3. Manifest file
      4. Application lifecycle
      5. First screen
        1. Required modifications
        2. New application page
        3. Working with designer
        4. Working with the XAML code
          1. Layout controls
            1. Grid
            2. StackPanel
            3. Canvas
          2. Screen layout
          3. Background
        5. Menu options
        6. Styles
        7. Handling events
          1. Separate event handlers
          2. Common event handler
        8. Navigating between pages
      6. Running
      7. Debugging
      8. Resources shared among all screens
      9. Data binding
      10. Localization
      11. Summary
    11. 3. MVVM Design Pattern
      1. Model-View-ViewModel
        1. Simple implementation
      2. Menu screen
      3. Map screen
        1. View
        2. View model
        3. Model
      4. Ranks screen
        1. Model
          1. RankItem class
          2. RankTopScoreConverter class
        2. View model
        3. View
          1. RankControl user control
          2. Ranks page
      5. Settings screen
      6. World, Web, and Help screens
      7. Game screen
      8. Summary
    12. 4. 3D Graphics Basics
      1. Introduction to 3D graphics
        1. Vertices, indices, coordinates, and faces
        2. Model, view, and projection matrices
        3. Rendering pipeline
        4. Shaders
      2. Direct3D-related part
        1. Windows Phone Runtime Component
        2. Direct3DInterop class
        3. Direct3DBase class
        4. CubeRenderer class
          1. Fields
          2. Device resources
          3. Resources dependent on the window size
          4. Updating
          5. Rendering the scene
        5. Shaders
        6. GamePage.xaml.cs
      3. Necessary modifications
      4. Native part debugging
      5. Summary
    13. 5. 3D Game World
      1. Planet model
        1. Creating model
        2. Adding model file
        3. Importing model
          1. VertexData structure
          2. GameHelpers class
          3. ModelLoader class
        4. Placing a model in the game world
          1. MVPConstantBuffer structure
          2. Object3D class
          3. GameHelpers class
          4. Constants
          5. Planet class
          6. GameRenderer class
      2. Adding asteroids to the game world
        1. Asteroid class
        2. GameRenderer class
      3. Flying towards the planet
        1. Rocket class
        2. GameRenderer class
      4. Summary
    14. 6. Steering, Sensors, and Collision Detection
      1. Rocket steering
        1. Steering by accelerometer
          1. Rocket class
          2. GameRenderer class
        2. Game world limitation
        3. Engine power adjustment
          1. Rocket class
          2. GameRenderer class
          3. Direct3DInterop class
      2. Game levels
        1. Implementation
          1. Constants
          2. Game class
          3. GameRenderer class
      3. Collision detection
        1. Concept
        2. Implementation
          1. CollisionDetector class
          2. GameRenderer class
      4. Improving performance
        1. Update operation
        2. Render operation
      5. Other sensors in the native part
        1. Writing to output
        2. Gyrometer
        3. Compass
      6. Interactive Help screen
        1. HelpPage.xaml
        2. HelpPage.xaml.cs
        3. HelpViewModel.cs
      7. Other sensors in the managed part
        1. Gyroscope
      8. Summary
    15. 7. 2D User Interface in 3D Game
      1. DirectX Tool Kit
      2. Game states
        1. Concept
        2. Implementation
          1. Constants
          2. Game class
          3. GameRenderer class
      3. Rocket display
        1. Concept
        2. Texture
        3. Font
        4. Implementation
          1. Constants
          2. RocketDisplay class
          3. GameRenderer class
      4. Localized strings
        1. Concept
        2. Implementation
          1. Constants
          2. LocalizedStrings class
      5. Level countdown
        1. Concept
        2. Implementation
          1. Constants
          2. Countdown class
          3. GameRenderer class
          4. Direct3DInterop class
          5. GamePage class
      6. Menus
        1. Concept
        2. Implementation
          1. Constants
          2. Localized strings
          3. MenuItem class
          4. MenuButton class
          5. MenuLabel class
          6. Menu class
          7. GameRenderer class
          8. Direct3DInterop class
          9. GamePage class
      7. Summary
    16. 8. Maps, Geolocation, and Augmented Reality
      1. Maps and geolocation
        1. Windows Phone Toolkit
          1. Installation
          2. Ambiguous reference error
        2. Locations of other players
          1. PlayerData.cs
          2. MapViewModel.cs
          3. MapPage.xaml
          4. MapPage.xaml.cs
        3. Your location
          1. MapViewModel.cs
          2. MapPage.xaml
      2. Augmented reality
        1. Geo Augmented Reality Toolkit
        2. Locations of other players
          1. ARItemExtended.cs
          2. WorldViewModel.cs
          3. WorldPage.xaml
          4. WorldPage.xaml.cs
        3. Error message
          1. VisibilityConverter.cs
          2. WorldViewModel.cs
          3. App.xaml
          4. WorldPage.xaml
      3. Navigation to GPS coordinates
        1. Implementation
          1. GameHelpers.cs
          2. MapViewModel.cs and WorldViewModel.cs
      4. Summary
    17. 9. Exchanging Data via Web Services
      1. SOA and WCF
      2. Creating a web service
        1. New project
        2. Database
          1. Adding SQL Server database
          2. Players table
          3. Results table
        3. Access to database
          1. Language-Integrated Query
          2. LINQ classes
        4. Implementation
          1. SA3DPlayer.cs
          2. SA3DRankItem.cs
          3. SA3DRank.cs
          4. ISA3DService.cs
          5. SA3DService.cs
      3. Web service deployment
        1. Development deployment
          1. IIS Express hosting
          2. Access by IP address
          3. Web service testing
        2. Production deployment
      4. Web service usage
        1. Adding reference
        2. Settings
          1. Settings.cs
        3. Ranks screen
          1. RanksPage.xaml
          2. RanksViewModel.cs
        4. Map screen
          1. MapPage.xaml
          2. MapViewModel.cs
        5. World screen
          1. WorldViewModel.cs
        6. Game screen
          1. GameRenderer.h
          2. Direct3DInterop.h
          3. Direct3DInterop.cpp
          4. GameViewModel.cs
          5. GamePage.xaml.cs
      5. Summary
    18. 10. Social Networks, Feeds, Settings, and Local Rank
      1. Publishing posts with Facebook API
        1. Creating Facebook application
        2. Facebook C# SDK
        3. Implementation
          1. WebPage.xaml
          2. WebPage.xaml.cs
          3. WebViewModel.cs
        4. Result
      2. Tweeting by Twitter API
        1. Creating Twitter application
        2. LINQ to Twitter installation
        3. Implementation
          1. WebPage.xaml
          2. WebPage.xaml.cs
          3. WebViewModel.cs
        4. Result
      3. Obtaining data from RSS feeds
        1. Implementation
          1. News.cs
          2. WebPage.xaml
          3. WebViewModel.cs
      4. Game settings
        1. Implementation
          1. Settings.cs
          2. SettingsViewModel.cs
          3. MapViewModel.cs
      5. Local rank
        1. Files in the isolated storage
        2. Implementation
          1. LocalRank.cs
          2. RanksViewModel.cs
          3. Direct3DInterop.h
          4. Direct3DInterop.cpp
          5. GamePage.xaml.cs
          6. GameViewModel.cs
        3. Isolated Storage Explorer tool
      6. Summary
    19. 11. Improving Game Experience
      1. Saving and loading the game state
        1. Concept
        2. Implementation
          1. Constants.h
          2. Game.h
          3. GameRenderer.h
          4. GameRenderer.cpp
      2. Audio support
        1. Background music
          1. App.xaml
          2. App.xaml.cs
          3. SettingsViewModel.cs
        2. Sounds
          1. WAV file creation
          2. Using files from sample
          3. GameRenderer.h
          4. GameRenderer.cpp
      3. Video support
        1. Concept
        2. Implementation
          1. CalibrationPage.xaml
          2. CalibrationPage.xaml.cs
          3. WorldViewModel.cs
      4. Vibrations
        1. Concept
        2. Implementation
          1. MenuViewModel.cs
          2. GameRenderer.h
          3. GameRenderer.cpp
          4. Direct3DInterop.h
          5. GamePage.xaml.cs
      5. Speech recognition and synthesis
        1. Concept
          1. Speech recognition
          2. Speech synthesis
          3. Asynchronous operations
        2. Implementation
          1. MenuPage.xaml
          2. MenuPage.xaml.cs
          3. MenuViewModel.cs
      6. Disabling the lock screen
        1. Implementation
          1. GameViewModel.cs
          2. GamePage.xaml.cs
      7. Summary
    20. 12. Game Publishing
      1. Manifest file
        1. Basic configuration
        2. Tiles
        3. Remaining settings
      2. Rating by the users
      3. Release version
      4. Store Test Kit
        1. Application details
        2. Automated tests
        3. Manual tests
      5. Simulation Dashboard
      6. Windows Phone Application Analysis
      7. Frame rate counters
      8. Certification requirements
      9. Publishing in the store
        1. Application information
        2. Map credentials
          1. View model
          2. View
        3. XAP submission
      10. Updating submission
      11. Summary
    21. A. Useful Resources
      1. Getting started
      2. Game user interface
      3. MVVM design pattern
      4. 3D graphics basics and 3D game world
      5. Steering, sensors, and collision detection
      6. 2D user interface in a 3D Game
      7. Maps, geolocation, and augmented reality
      8. Exchanging data via web services
      9. Social networks, feeds, settings, and local rank
      10. Improving game experience
      11. Game publishing
    22. B. Languages and Technologies
      1. Languages
        1. C#
        2. C++
        3. XAML
      2. Technologies and frameworks
        1. Direct3D
        2. WCF
        3. .NET Framework
    23. Index