The Web Game Developer’s Cookbook: Using JavaScript and HTML5 to Develop Games

Book description

Want to start building great web games with HTML5 and JavaScript? Moving from Flash or other game platforms? Already building HTML5 games and want to get better and faster at it? This guide brings together everything you need: expert guidance, sample projects, and working code!

Evan Burchard walks you step-by-step through quickly building 10 popular types of games. Each chapter implements a game within a well-understood genre; introduces a different free, open source, and easy-to-use HTML5 game engine; and is accompanied with full JavaScript source code listings.

Each game recipe uses tested and well-proven patterns that address the development challenges unique to that genre, and shows how to use existing tools and engines to build complete substantial game projects in just hours. Need a quick JavaScript primer? Evan Burchard provides that, too!

Coverage includes

  • Mastering an essential HTML5/JavaScript game development toolset: browser, text editor, terminal,¿JavaScript console, game engine, and more

  • Accelerating development with external libraries and proven patterns

  • Managing browser differences between IE, Firefox, and Chrome

  • Getting up to speed on web development with a QUIZ game built with JavaScript, HTML, CSS, and JQuery

  • Creating INTERACTIVE FICTION “gamebooks” that leverage new CSS3 features and impress.js

  • Building PARTY games around the lightweight atom.js engine

  • Developing PUZZLE games with the easel.js graphics rendering engine

  • Writing PLATFORMERS with melon.js and its integrated tilemap editor

  • Coding intense 2-player FIGHTING games for web browsers with game.js

  • Building a SPACE SHOOTER with the jQuery-based gameQuery game engine

  • Implementing pseudo-3D techniques like ray casting for an FPS (First Person Shooter) style game

  • Producing a 16 bit RPG (Role Playing Game) complete with interfaces for dialog, inventories, and turn-based battles with enchant.js

  • Building an isometric RTS (Real Time Strategy) game that incorporates server components along with¿ node.js, socket.io, and crafty.js

  • Engaging players with content that encourages exploration

  • Turn to The Web Game Developer’s Cookbook for proven, expert answers–and the code you need to implement them. It’s all you need to jumpstart any web game project!

    Table of contents

    1. Title Page
    2. Copyright Page
    3. Praise for The Web Game Developer’s Cookbook
    4. Dedication Page
    5. Contents
    6. Preface
    7. Acknowledgments
    8. About the Author
    9. Introduction
      1. Audience for This Book
      2. Coding Style Conventions Used In This Book
      3. How This Book Is Organized
      4. How To Use This Book
    10. Chapter 1. Quiz
      1. Recipe: Making the Questions
      2. Recipe: Hiding and Showing Your Quiz
      3. Recipe: Getting Your Questions Back
      4. Recipe: The Shopping List
      5. Recipe: Which Answers Are Correct?
      6. Summary
    11. Chapter 2. Interactive Fiction
      1. Recipe: Styled Pages
      2. Recipe: Goto Page
      3. Recipe: Adding an Inventory with Drag and Drop
      4. Recipe: Adding Complex Interactions
      5. Recipe: Breadcrumb Trail
      6. Recipe: A Dramatic Ending
      7. Summary
    12. Chapter 3. Party
      1. Recipe: Creating a Sample Game in atom.js
      2. Recipe: Drawing with Canvas
      3. Recipe: Drawing Holes
      4. Recipe: Drawing a Mole
      5. Recipe: Putting the Moles in the Holes
      6. Recipe: Dynamic Mole Peeking
      7. Recipe: Bopping Moles
      8. Wallowing in Despair with HTML5’s <audio> tag
      9. Summary
    13. Chapter 4. Puzzle
      1. Recipe: Rendering with easel.js
      2. Recipe: Rendering More Than One Thing
      3. Recipe: Creating Pairs
      4. Recipe: Matching and Removing Pairs
      5. Recipe: Hiding and Flipping the Pictures
      6. Recipe: Winning and Losing
      7. Recipe: Caching and Performance
      8. Recipe: Matching Pairs Instead of Duplicates
      9. Summary
    14. Chapter 5. Platformer
      1. Getting Started with melon.js
      2. Recipe: Creating a Tiled Map
      3. Recipe: Starting the Game
      4. Recipe: Adding a Character
      5. Recipe: Building a Collision Map
      6. Recipe: Walking and Jumping
      7. Recipe: Title Screen
      8. Recipe: Adding Collectables
      9. Recipe: Enemies
      10. Recipe: Powerups
      11. Recipe: Losing, Winning, and Information
      12. Summary
    15. Chapter 6. Fighting
      1. Recipe: Getting Started with game.js
      2. Recipe: Accessing Individual Sprites from a Spritesheet
      3. Recipe: Handling Input from Two Players
      4. Recipe: Moving and Changing Forms
      5. Recipe: Nonblocking Input
      6. Recipe: Implementing Bitmasks
      7. Recipe: Masking Collisions
      8. Recipe: Giving and Taking Damage
      9. Summary
    16. Chapter 7. Shooter
      1. Some Background Info on Rendering
      2. Recipe: Getting Started with gameQuery
      3. Recipe: Adding “Enemies”
      4. Recipe: Making Your Ship
      5. Recipe: Enemy Collisions
      6. Recipe: Shooting
      7. Recipe: Powerups
      8. Summary
    17. Chapter 8. FPS
      1. Recipe: Getting Started with Jaws
      2. Recipe: Creating a 2-D Map
      3. Recipe: Adding a Player
      4. Recipe: Raycasting Top View
      5. Recipe: Fake 3D with Raycasting
      6. Recipe: Adding a Camera
      7. Recipe: Making the World a More Photogenic Place
      8. Recipe: Adding a Friend or Foe
      9. Summary
    18. Chapter 9. RPG
      1. Recipe: Getting Started with enchant.js
      2. Recipe: Creating a Map
      3. Recipe: Adding the Player
      4. Recipe: Adding a Collision Layer
      5. Recipe: Status Screen
      6. Recipe: Talking to NPCs
      7. Recipe: Creating an Inventory
      8. Recipe: Creating a Shop
      9. Recipe: Creating a Battle Interface
      10. Recipe: Saving Your Game with HTML5’s Local Storage API
      11. Summary
    19. Chapter 10. RTS
      1. We Need a Server
      2. Recipe: Getting Node
      3. Recipe: Real Time with Socket.io
      4. Recipe: Creating an Isometric Map with crafty.js
      5. Recipe: Drawing the Units
      6. Recipe: Moving Units
      7. Recipe: Player Specific Control and Visibility
      8. Recipe: Collisions for Destruction and Revelation
      9. Summary
    20. Chapter 11. Leveling Up
      1. What Happened?
      2. What’s Next?
    21. Appendix A. JavaScript Basics
      1. Main Types of APIs in JavaScript
      2. Statements
      3. Variables
      4. Strings
      5. Numbers
      6. Arrays
      7. Functions
      8. Objects
      9. Conditionals
      10. Loops
      11. Comments
    22. Appendix B. Quality Control
      1. Browser Debugging Tools
      2. Testing
      3. Collaboration for Better Code
    23. Appendix C. Resources
      1. Game Engines
      2. Text Editors
      3. Browsers
      4. Assorted Tools
      5. Art Creation/Finding
      6. Demos and Tutorials
      7. Books
      8. Websites
    24. Index

    Product information

    • Title: The Web Game Developer’s Cookbook: Using JavaScript and HTML5 to Develop Games
    • Author(s):
    • Release date: March 2013
    • Publisher(s): Addison-Wesley Professional
    • ISBN: 9780133358711