You are previewing Professional HTML5 Mobile Game Development.
O'Reilly logo
Professional HTML5 Mobile Game Development

Book Description

Create mobile game apps for the lucrative gaming market

If you're an experienced developer seeking to break into the sizzling mobile game market, this is the book for you. Covering all mobile and touchscreen devices, including iPhones, iPads, Android, and WP7.5, this book takes you through the steps of building both single- and multi-player mobile games. Topics include standard patterns for building games in HTML5, what methods to choose for building (CSS3, SVG, or Canvas), popular game engines and frameworks, and much more. Best of all, code for six basic games is provided, so you can modify, further develop, and make it your own.

  • Shows intermediate developers how to develop games in HTML5 and build games for iPhone, iPad, Android, and WP7.5 mobile and touchscreen devices

  • Explains single-player and multi-player mobile game development

  • Provides code for six basic games in a GitHub repository, so readers can collaborate and develop the code themselves

  • Explores specific APIs to make games even more compelling, including geolocation, audio, and device orientation

  • Reviews three popular open-source HTML5 game engines--crafty.js, easel.js, and enchant.js

  • Covers simple physics as well as using an existing physics library

The world is going mobile, as is the game industry. Professional HTML5 Mobile Game Development helps savvy developers join in this exploding market.

Table of Contents

  1. Cover
  2. Part I: Diving In
    1. Chapter 1: Flying Before You Walk
      1. Introduction
      2. Building a Complete Game in 500 Lines
      3. Adding the Boilerplate HTML and CSS
      4. Getting Started with Canvas
      5. Creating Your Game’s Structure
      6. Loading the SpriteSheet
      7. Creating the Game Object
      8. Adding a Scrolling Background
      9. Putting in a Title Screen
      10. Adding a Protagonist
      11. Summary
    2. Chapter 2: Making It a Game
      1. Introduction
      2. Creating the GameBoard Object
      3. Firing Missiles
      4. Adding Enemies
      5. Refactoring the Sprite Classes
      6. Handling Collisions
      7. Representing Levels
      8. Summary
    3. Chapter 3: Finishing Up and Going Mobile
      1. Introduction
      2. Adding Touch Controls
      3. Maximizing the Game
      4. Adding a Score
      5. Making It a Fair Fight
      6. Summary
  3. Part II: Mobile HTML5
    1. Chapter 4: HTML5 for Mobile
      1. Introduction
      2. Capturing a Brief History of HTML5
      3. Using HTML5 The Right Way
      4. Considering HTML5 from a Game Perspective
      5. Considering HTML5 from a Mobile Perspective
      6. Surveying the Mobile Browser Landscape
      7. Summary
    2. Chapter 5: Learning Some Helpful Libraries
      1. Introduction
      2. Learning JavaScript Libraries
      3. Starting with jQuery
      4. Using Underscore.js
      5. Summary
    3. Chapter 6: Being a Good Mobile Citizen
      1. Introduction
      2. Responding to Device Capabilities
      3. Dealing with Browser Resizing, Scrolling, and Zooming
      4. Configuring Your App for the iOS Home Screen
      5. Taking Mobile Performance into Consideration
      6. Adapting to Limited Bandwidth and Storage
      7. Going Offline Completely with Application Cache
      8. Summary
  4. Part III: JavaScript Game Dev Basics
    1. Chapter 7: Learning about Your HTML5 Game Development Environment
      1. Introduction
      2. Picking an Editor
      3. Exploring the Chrome Developer Tools
      4. Debugging JavaScript
      5. Profiling and Optimizing Your Code
      6. Mobile Debugging
      7. Summary
    2. Chapter 8: Running JavaScript on the Command Line
      1. Introduction
      2. Learning About Node.js
      3. Installing Node
      4. Installing and Using Node Modules
      5. Creating Your Own Script
      6. Writing a Sprite-Map Generator
      7. Summary
    3. Chapter 9: Bootstrapping the Quintus Engine: Part I
      1. Introduction
      2. Creating a Framework for a Reusable HTML5 Engine
      3. Adding the Game Loop
      4. Adding Inheritance
      5. Supporting Events
      6. Supporting Components
      7. Summary
    4. Chapter 10: Bootstrapping the Quintus Engine: Part II
      1. Introduction
      2. Accessing a Game Container Element
      3. Capturing User Input
      4. Loading Assets
      5. Summary
    5. Chapter 11: Bootstrapping the Quintus Engine: Part III
      1. Introduction
      2. Defining SpriteSheets
      3. Adding Sprites
      4. Setting the Stage with Scenes
      5. Finishing Blockbreak
      6. Summary
  5. Part IV: Building Games with CSS3 and SVG
    1. Chapter 12: Building Games with CSS3
      1. Introduction
      2. Deciding on a Scene Graph
      3. Implementing DOM Support
      4. Summary
    2. Chapter 13: Crafting a CSS3 RPG
      1. Introduction
      2. Creating a Scrolling Tile Map
      3. Building the RPG
      4. Summary
    3. Chapter 14: Building Games with SVG and Physics
      1. Introduction
      2. Understanding SVG Basics
      3. Working with SVG from JavaScript
      4. Adding SVG Support to Quintus
      5. Adding Physics with Box2D
      6. Creating a Cannon Shooter
      7. Summary
  6. Part V: HTML5 Canvas
    1. Chapter 15: Learning Canvas, the Hero of HTML5
      1. Learning Canvas, the Hero of HTML5
      2. Introduction
      3. Getting Started with the Canvas Tag
      4. Drawing on Canvas
      5. Using the Canvas Transformation Matrix
      6. Applying Canvas Effects
      7. Summary
    2. Chapter 16: Getting Animated
      1. Introduction
      2. Building Animation Maps
      3. Adding a Canvas Viewport
      4. Going Parallax
      5. Summary
    3. Chapter 17: Playing with Pixels
      1. Introduction
      2. Reviewing 2-D Physics
      3. Implementing Lander
      4. Summary
    4. Chapter 18: Creating a 2-D Platformer
      1. Introduction
      2. Creating a Tile Layer
      3. Handling Platformer Collisions
      4. Building the Game
      5. Summary
    5. Chapter 19: Building a Canvas Editor
      1. Introduction
      2. Serving the Game with Node.js
      3. Creating the Editor
      4. Adding Level-Saving Support
      5. Summary
  7. Part VI: Multiplayer Gaming
    1. Chapter 20: Building for Online and Social
      1. Introduction
      2. Understanding HTTP-Based Multiplayer Games
      3. Planning a Simple Social Game
      4. Integrating with Facebook
      5. Connecting to a Database
      6. Finishing Blob Clicker
      7. Pushing to a Hosting Service
      8. Summary
    2. Chapter 21: Going Real Time
      1. Introduction
      2. Understanding WebSockets
      3. Using Native WebSockets in the Browser
      4. Using Socket.io: WebSockets with Fallbacks
      5. Building a Multiplayer Pong Game Using Socket.io
      6. Summary
    3. Chapter 22: Building Nontraditional Games
      1. Introduction
      2. Creating a Twitter Application
      3. Connecting a Node App to Twitter
      4. Generating Random Words
      5. Creating Twitter Hangman
      6. Summary
  8. Part VII: Mobile Enhancements
    1. Chapter 23: Locating via Geolocation
      1. Locating via Geolocation
      2. Introduction
      3. Getting Started with Geolocation
      4. Getting a One-Time Position
      5. Plotting a Location on a Map
      6. Watching the Position Change over Time
      7. Drawing an Interactive Map
      8. Calculating the Position between Two Points
      9. Summary
    2. Chapter 24: Querying Device Orientation and Acceleration
      1. Introduction
      2. Looking at a Device Orientation
      3. Getting Started with Device Orientation Events
      4. Trying Out Device Orientation
      5. Summary
    3. Chapter 25: Playing Sounds, the Mobile Achilles Heel
      1. Introduction
      2. Working with the Audio Tag
      3. Building a Simple Desktop Sound Engine
      4. Building a Sound System for Mobile
      5. Looking to the Future of HTML5 Sound
      6. Summary
  9. Part VIII: Game Engines and App Stores
    1. Chapter 26: Using an HTML5 Game Engine
      1. Using an HTML5 Game Engine
      2. Introduction
      3. Looking at the History of HTML5 Engines
      4. Using a Commercial Engine
      5. Using an Open-Source Engine
      6. Summary
    2. Chapter 27: Targeting App Stores
      1. Introduction
      2. Packaging Your App for the Google Chrome Web Store
      3. Using CocoonJS to Accelerate Your App
      4. Building Apps with the AppMobi XDK and DirectCanvas
      5. Summary
    3. Chapter 28: Seeking Out What’s Next
      1. Introduction
      2. Going 3-D with WebGL
      3. Getting Better Access to Sound with the Web Audio API
      4. Making Your Game Bigger with the Full-Screen API
      5. Locking Your Device Screen with the Screen Orientation API
      6. Adding Real-Time Communications with WebRTC
      7. Tracking Other Upcoming Native Features
      8. Summary
  10. Appendix: Resources
    1. Books on HTML5 and JavaScript
    2. Web Resources
  11. Credits
  12. About the Author
  13. About the Technical Editor
  14. Acknowledgments
  15. Introduction
  16. Advertisement