EARTH WEEK
Go paperless and save 40% on eligible eBooks, 70% on video now through April 26. Shop the sale.
Rough Cuts are manuscripts that are developed but not yet published, available through Safari. Rough Cuts provide you access to the very latest information on a given topic and offer you the opportunity to interact with the author to influence the final publication.
This is the Rough Cut version of the printed book.
Get Started Fast with HTML5 Online Game Programming!
HTML5 will transform web and mobile gaming. As new browsers rapidly adopt it, HTML5 will do everything “legacy” technologies such as Flash and Silverlight have done—and much more. In Learning HTML5 Game Programming, pioneering developer James L. Williams gives you all the knowledge, code, and insights you’ll need to get started fast!
Williams combines detailed explanations of HTML5’s key innovations with examples, including two case study applications that address the entire development process. He guides you through setting up a state-of-the-art HTML5 development environment; making the most of HTML5’s canvas tag, SVG vector graphics, and WebGL 3D; and targeting diverse mobile and social platforms. It’s all here: from the essentials of online game design to the nitty-gritty details of performance optimization.
About the Website
All code samples and answers to chapter exercises are available for download at www.informit.com/title/9780321767363 and on Github at https://github.com/jwill/html5-game-book.
Coverage includes
· Understanding the HTML5 innovations that make it possible to create amazingly rich games
· Setting up a state-of-the-art open source HTML5 game development environment
· Using JavaScript to drive sophisticated interactions between users and games
· Building basic games fast, with the prototype-based Simple Game Framework (SGF)
· Generating movement and gameplay with the canvas tag and surface
· Creating games with SVG vector graphics using the RaphaëlJS Javascript library
· Using Three.js to build powerful WebGL 3D games with far less complexity
· Developing games without JavaScript, using Google Web Toolkit (GWT) or CoffeeScript
· Building a complete multiplayer game server using Node.js and WebSockets
· Planning and choosing tools for mobile game development with HTML5
· Optimizing game performance with offline cache, minification, and other techniques
Learning HTML5 Game Programming is the fastest route to success with HTML5 game development—whether you’re a long-time game developer or a web/mobile programmer building games for the first time.
Chapter 1 Introducing HTML5 1
Beyond Basic HTML 1
JavaScript 1
AJAX 2
Bridging the Divide 2
Google Gears 3
Chrome Frame 3
Getting Things Done with WebSockets and Web Workers 4
WebSockets 4
Web Workers 4
Application Cache 5
Database API 6
WebSQL API 6
IndexedDB API 7
Web Storage 7
Geolocation 8
Getting Users’ Attention with Notifications 10
Requesting Permission to Display Notifications 11
Creating Notifications 11
Interacting with Notifications 12
Media Elements 13
Controlling Media 13
Handling Unsupported Formats 14
HTML5 Drawing APIs 15
Canvas 15
SVG 16
WebGL 16
Conveying Information with Microdata 16
Chapter 2 Setting Up Your Development Environment 19
Development Tools 19
Installing Java 19
Installing the Eclipse IDE and Google Plugin 20
Google Web Toolkit 22
Web Server Tools and Options 23
Google App Engine 23
Opera Unite 23
Node.js and RingoJS 23
Browser Tools 24
Inside the Chrome Developer Tools 24
Chrome Extensions 25
Safari Developer Tools 26
Firebug 26
HTML5 Tools 27
ProcessingJS 27
Inkscape 27
SVG-edit 27
Raphaël 28
3D Modeling Tools 29
Blender 29
Chapter 3 Learning JavaScript 31
What Is JavaScript? 31
JavaScript’s Basic Types 31
Understanding Arithmetic Operators 32
Understanding JavaScript Functions 32
Functions as First-class Objects 33
Comparison Operators 34
Conditional Loops and Statements 35
Controlling Program Flow with Loops 36
Delayed Execution with setTimeout and setInterval 38
Creating Complex Objects with Inheritance and Polymorphism 38
Making Inheritance Easier with the Prototype Library 39
Learning JQuery 41
Manipulating the DOM with Selectors 42
JQuery Events 43
AJAX with JQuery 43
Cross-Site Scripting 44
JSON: The Other JavaScript Format 44
JavaScript Outside of the Browser 45
Mobile Platforms 45
JavaScript as an Intermediary Language 45
JavaScript on the Desktop 46
Server-Side JavaScript 48
Chapter 4 How Games Work 51
Designing