0%

Book Description

Anyone familiar with Zynga's Farmville understands how fun and addictive real-time social games can be. This hands-on guide shows you how to design and build one of these games from start to finish, with nothing but open source tools. You'll learn how to render graphics, animate with sprites, add sound, validate scores to prevent cheating, and more, using detailed examples and code samples.

By the end of the book, you’ll complete a project called Tourist Resort that combines all of the techniques you’ve learned. You’ll also learn how to integrate your game with Facebook. If you’re familiar with JavaScript, HTML5, and CSS3, you’re ready to get started.

  • Use HTML5’s canvas element to build smooth animations with sprites
  • Create an isometric grid pattern for high-performance graphics
  • Design a GUI that works equally well on mobile devices and PCs
  • Add sound to your game with HTML5’s audio element
  • Implement the game’s path-finding function with WebWorkers
  • Build a client data model on the server with PHP and MySQL
  • Make your game come alive with dynamic CSS3 objects

Table of Contents

  1. Dedication
  2. Preface
    1. The Rise of HTML5
    2. What You Need to Know
    3. Code Examples
    4. Development and Debugging Tools
    5. Notes on Game Design
    6. Conventions Used in This Book
    7. Using Code Examples
    8. Safari® Books Online
    9. How to Contact Us
    10. Acknowledgments
  3. 1. Graphics Foundations: Canvas and Sprites
    1. Working with the canvas Object
    2. Creating Smooth Animations
    3. Working with Sprites
    4. What’s at that Pixel?
      1. Dealing with Transparency
    5. Choosing a Rendering Method for Our Graphics
  4. 2. Making It Isometric
  5. 3. Interface Considerations
    1. GUI Design and Interaction in Web Games
    2. Implementing the GUI
  6. 4. HTML5 Sound and Processing Optimization
    1. Adding Sound with the Audio Element
    2. Managing Computationally Expensive Work with the Web Workers API
    3. Local Storage and Session Storage
  7. 5. Connecting the Game to People
    1. Cheat Prevention and Server-Side Operations
    2. The Path to the Final Game
    3. Polishing the Game
    4. Adding a Social Networking Layer Using Facebook
  8. About the Author
  9. Copyright