Learning HTML5 Game Programming



Similar documents
JavaScript Programming

Web Development with TIBCO General Interface

Google Web Toolkit. Introduction to GWT Development. Ilkka Rinne & Sampo Savolainen / Spatineo Oy

How To Develop An Html5 Based Mobile App

Programming in HTML5 with JavaScript and CSS3

Developer's Cookbook. Building Applications with. The Android. the Android SDK. A Addison-Wesley. James Steele Nelson To

place/business fetch details, removefromfavorite () function, 189 search button handler bind, B BlackBerry build environment

Building. Applications. in the Cloud. Concepts, Patterns, and Projects. AAddison-Wesley. Christopher M. Mo^ar. Cape Town Sydney.

Cross-Platform. Mac OS X ЧЯУ

Mobile Web Design with HTML5, CSS3, JavaScript and JQuery Mobile Training BSP-2256 Length: 5 days Price: $ 2,895.00

Learning HTML5 Game Programming

Programming 3D Applications with HTML5 and WebGL

Best practices building multi-platform apps. John Hasthorpe & Josh Venman

SYST35300 Hybrid Mobile Application Development

Cross-Platform Phone Apps & Sites with jquery Mobile

ios Hybrid Mobile Application Development

WEB DEVELOPMENT COURSE (PHP/ MYSQL)

Developing Cross-platform Mobile and Web Apps

How To Write A Web Framework In Java

Lucy Zhang UI Developer Contact:

Developing and deploying mobile apps

Upgrade to Microsoft Web Applications

CS297 Report. JavaScript Game Engine for Mobile using HTML5

Building OpenSocial Apps

Developing ASP.NET MVC 4 Web Applications MOC 20486

Making the Most of Existing Public Web Development Frameworks WEB04

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

SharePoint Overview, Governance, and Planning. (^Rll^^fc^ i ip?"^biifiis:'iissiipi. Scott Jamison. Susan Hanley Mauro Cardarelli.

HTML5. Turn this page to see Quick Guide of CTTC

WEB DEVELOPMENT IMMERSIVE GA.CO/WDI

HTML5: Separating Fact and Fiction. #wipjam

BIRT: A Field Guide to Reporting

HTML5 as the Core Technology of the Mobile Enterprise

ios SDK possibilities & limitations

Beginning Facebook. Development. Game Apps. Wayne Graham. Apress*

Developing ASP.NET MVC 4 Web Applications

Facebook Twitter YouTube Google Plus Website . o Zooming and Panning. Panel. 3D commands. o Working with Canvas

Modern Web Development From Angle Brackets to Web Sockets

Development of Hybrid Applications with HTML

Web Designing with UI Designing

Dave Haseman, Ross. Hightower. Mobile Development for SAP* ^>. Galileo Press. Bonn. Boston

Operational Decision Manager Worklight Integration

The Data Access Handbook

RIA Technologies Comparison

Mobile App Infrastructure for Cross-Platform Deployment (N11-38)

INFORMATION TECHNOLOGY STANDARD

HYBRID APPLICATION DEVELOPMENT IN PHONEGAP USING UI TOOLKITS

Programming the Mobile Web

Preface. Motivation for this Book

Discovering new features in HTML5 Offline applications

Developing ASP.NET MVC 4 Web Applications Course 20486A; 5 Days, Instructor-led

GUI and Web Programming

Open Source Enterprise Mobile Campus Solution. September 30, 2011

... Introduction Acknowledgments... 19

Winning the Hardware-Software Game

Software Development Interactief Centrum voor gerichte Training en Studie Edisonweg 14c, 1821 BN Alkmaar T:

Development of a web-based card game engine

and the OPEN WEB PLATFORM HTML5Fest, Tel Aviv, Israel 25 Oct 2011 by J. Alan Bird, W3C

Deepak Patil (Technical Director) iasys Technologies Pvt. Ltd.

Introduction to Tizen SDK Alpha. Taiho Choi Samsung Electronics

Art of Code Front-end Web Development Training Program

Issues of Hybrid Mobile Application Development with PhoneGap: a Case Study of Insurance Mobile Application

Building native mobile apps for Digital Factory

Articles 742b: Networks & Transactions Spring 2014 Green Hall, Room 209/210 Tuesdays 1:30 5:30

AJAX. Gregorio López López Juan Francisco López Panea

Simply type the id# in the search mechanism of ACS Skills Online to access the learning assets outlined below.

HTML5 DESIGNING RICH INTERNET APPLICATIONS MATTHEW DAVID

maximizing IT productivity

Introduction to Oracle Mobile Application Framework Raghu Srinivasan, Director Development Mobile and Cloud Development Tools Oracle

Bridging the Gap: from a Web App to a Mobile Device App

Learning Web App Development

How to Choose Right Mobile Development Platform BROWSER, HYBRID, OR NATIVE

Coding for Desktop and Mobile with HTML5 and Java EE 7

Using HTML5 Pack for ADOBE ILLUSTRATOR CS5

Cross-Platform Mobile Application Development

WEBfactory Silverlight vs. HTML 5 Version 1.0. July

Study on Parallax Scrolling Web Page Conversion Module

Practical Android Projects Lucas Jordan Pieter Greyling

Lab: Developing Mobile Web Apps. Adage Technologies adagetechnologies.com

Vector Web Mapping Past, Present and Future. Jing Wang MRF Geosystems Corporation

Cross-Platform Tools

Professional iphone and ipod touch Programming. Building Applications for Mobile Safari

Making Sense of Mobile Development Options. Luis Sala Director, Technology

General principles and architecture of Adlib and Adlib API. Petra Otten Manager Customer Support

The Development Manager s Quick Guide to HTML5

Trends in HTML5. Matt Spencer UI & Browser Marketing Manager

All About Android WHAT IS ANDROID?

How To Write A Web Server In Javascript

MO 25. Aug. 2008, 17:00 UHR RICH INTERNET APPLICATIONS MEHR BISS FÜR WEBANWENDUNGEN

Republic Polytechnic School of Infocomm C308 Web Framework. Module Curriculum

Delivery. Enterprise Software. Bringing Agility and Efficiency. Global Software Supply Chain. AAddison-Wesley. Alan W. Brown.

4/25/2016 C. M. Boyd, Practical Data Visualization with JavaScript Talk Handout

2011 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media,

Introduction to WebGL

GLEN RIDGE PUBLIC SCHOOLS MATHEMATICS MISSION STATEMENT AND GOALS

Take full advantage of IBM s IDEs for end- to- end mobile development

Transcription:

Learning HTML5 Game Programming A Hands-on Guide to Building Online Games Using Canvas, SVG, and WebGL James L. Williams AAddison-Wesley Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid Cape Town Sydney Tokyo Singapore Mexico City

Table of Chapter 1 Introducing HTML5 Beyond Basic HTML JavaScript AJAX 1 1 1 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 Database API 5 6 WebSQL API 6 IndexedDB API Web Storage Geolocation 7 7 8 Getting Users' Attention with Notifications 10 Requesting Permission to Display Notifications Creating Notifications 11 Interacting with Notifications Media Elements Controlling Media 13 Handling Unsupported Formats HTML5 Drawing APIs Canvas SVG WebGL 12 13 14 15 15 16 16 Conveying Information with Microdata Chapter 2 16 Setting Up Your Development Environment 19 Development Tools Installing Java 19 19 11

Installing the Eclipse IDE and Google Plugin Google Web Toolkit Web Server Tools and Options Google App Engine Opera Unite 23 23 23 Node.js and RingoJS Browser Tools 23 24 Inside the Chrome Developer Tools Chrome Extensions 27 ProcessingJS 27 27 SVG-edit 27 Raphael 28 3D Modeling Tools Blender Chapter 3 26 26 HTML5 Tools Inkscape 24 25 Safari Developer Tools Firebug 20 22 29 29 Learning JavaScript What Is JavaScript? 31 31 JavaScript's Basic Types 31 Understanding Arithmetic Operators 32 Understanding JavaScript Functions 32 Functions as First-class Objects Comparison Operators 33 34 Conditional Loops and Statements 35 Controlling Program Flow with Loops 36 Delayed Execution with settimeout and setlnterval Creating Complex Objects with Inheritance and Polymorphism 38 Making Inheritance Easier with the Prototype Library 39 Learning JQuery 41 Manipulating the DOM with Selectors JQuery Events 43 AJAX with JQuery Cross-Site Scripting 43 44 42 38

viii JSON: The Other JavaScript Format JavaScript Outside of the Browser Mobile Platforms 44 45 45 JavaScript as an Intermediary Language JavaScript on the Desktop Server-Side JavaScript Chapter 4 46 48 How Games Work Designing a Game 51 51 Writing a Basic Design Document Deciding on a Game Genre The Game Loop 45 51 52 53 Getting Input from the User 53 Representing Game Objects with Advanced Data Structures 54 Making Unique Lists of Data with Sets 54 Creating Object Graphs with Linked Lists 56 Understanding the APIs in Simple Game Framework Core API 57 57 Components API 58 Resources API and Networking APIs 58 Building Pong with the Simple Game Framework Setting Up the Application 59 Drawing the Game Pieces 61 59 Making Worlds Collide with Collision Detection and Response 63 Understanding Newton's Three Laws Making the Ball Move 63 64 Advanced Collision Detection and Particle Systems with Asteroids 66 Creating Competitive Opponents with Artificial Intelligence 67 Adding Al to Pong 68 Advanced Computer Al with Tic-Tac-Toe Chapter 5 68 Creating Games with the Canvas Tag Getting Started with the Canvas Drawing Your First Paths 71 72 Drawing Game Sprites for Tic-Tac-Toe 73 71

Drawing Objects on the Canvas with Transformations Ordering Your Transformations 76 Saving and Restoring the Canvas Drawing State Using Images with the Canvas 78 Serving Images with Data URLs 78 Serving Images with Spritesheets Drawing Images on the Canvas Animating Objects with Trident.js Creating Timelines 78 78 79 80 Animating with Keyframes 81 Creating Nonlinear Timelines with Easing 81 Animating Game Objects with Spritesheets Simulating 3D in 2D Space 84 85 Creating a Parallax Effect with JavaScript Creating Copy Me 85 87 Drawing Our Game Objects Making the Game Tones 87 88 Playing MIDI Files in the Browser 89 Playing Multiple Sounds at Once 90 Playing Sounds Sequentially Drawing Our Game Text 91 91 Styling Text with CSS Fonts Chapter 6 83 84 Perspective Projection Parallaxing 92 Creating Games with SVG and RaphaelJS 95 Introduction to SVG 95 First Steps with RaphaelJS 97 Setting Up Our Development Environment Drawing the Game Board Drawing Game Text Custom Fonts 97 98 99 100 Specifying Color 103 Loading Game Assets 75 104 Converting SVG Files to Bitmap Images 105 77

Creating Our Game Classes Shuffling Cards 105 107 Drawing and Animating Cards Creating Advanced Animations Paths 110 moveto and lineto curveto 107 110 110 111 Exporting Paths from an SVG File Animating Along Paths 113 Extending Raphael with Plugins Adding Functions SVG Filters 112 113 113 113 Speed Considerations 114 Chapter 7 Creating Games with WebGL and Three.js 117 Moving to Three Dimensions 118 Giving Your Objects Some Swagger with Materials and Lighting 119 Understanding Lighting 120 Using Materials and Shaders 120 Creating Your First Three.js Scene Setting Up the View 122 123 Viewing the World 128 Loading 3D Models with Three.js 129 Programming Shaders and Textures Using Textures 131 134 Creating a Game with Three.js 136 Simulating the Real World with Game Physics Revisiting Particle Systems Creating Scenes 140 141 Selecting Objects in a Scene Animating Models Sourcing 3D Models 142 142 143 Benchmarking Your Games 144 Checking Frame Rate with Stats.js Using the WebGL Inspector 145 144 137

Chapter 8 Creating Games Without JavaScript Google Web Toolkit Understanding GWT Widgets and Layout 148 Exposing JavaScript Libraries to GWT with JSNI RaphaelGWT 151 Accessing the Drawing APIs with GWT Installing CoffeeScript 153 153 A Quick Guide to CoffeeScript 154 154 Functions and Invocation 154 Aliases, Conditionals, and Loops Enhanced for Loop and Maps Classes and Inheritance Alternate Technologies Cappuccino Pyjamas Chapter 9 151 153 Compiling CoffeeScript Files Basics 149 150 Adding Sound with gwt-html5-media CoffeeScript 147 147 156 156 157 158 158 158 Building a Multiplayer Game Server Introduction to Node.js 161 Extending Node with the Node Package Manager Managing Multiple Node Versions 162 Making Web Apps Simpler with ExpressJS Serving Requests with URL Routing Managing Sessions 161 163 163 165 Understanding the ExpressJS Application Structure 165 Templating HTML with CoffeeKup Persisting Data with Caching 166 168 Managing Client/Server Communication Communicating with Socket.10 169 169 Setting Up a Simple Socket.10 Application with Express 170 Making Web Sockets Simpler with NowJS Debugging Node Applications 172 171 162

xii Creating a Game Server 173 Making the Game Lobby 173 Creating Game Rooms with NowJS Groups 174 Managing Game Participants and Moving Between Game Rooms 175 Managing Game Play Chapter 10 175 Developing Mobile Games Choosing a Mobile Platform ios 179 179 179 Android 180 WebOS 180 Windows Phone 7 180 Flick, Tap, and Swipe: A Quick Guide to Mobile Gestures 181 Deciding Between an Application and a Website Storing Data on Mobile Devices 181 183 Relaxing in Your Lawnchair: An Easier Way to Store Data 183 Getting Started with Lawnchair 184 Client-Side Scripting Simplified with JQuery and Zepto 185 Using JQuery Variants Using Zepto.js 185 187 Architecting Your Applications with JoApp Choosing an Application Framework PhoneGap 187 188 188 Diving into the PhoneGap APIs Appcelerator Titanium 189 191 Diving into the Appcelerator Titanium APIs 191 Packaging Android Applications with Titanium and PhoneGap 191 Packaging an Application with Titanium Packaging an Application with PhoneGap 193 195

Chapter 1 1 Publishing Your Games Optimizing Your Game's Assets 199 199 Minification with Google Closure Compiler 199 Running Applications Offline with Application Cache 201 Hosting Your Own Server 203 Deploying Applications on Hosted Node.js Services Publishing Applications on the Chrome Web Store Describing Your Application's Metadata Deploying a Hosted Application 204 205 206 207 Deploying a Packaged Application 208 Testing Your Applications Locally 208 Uploading Your Application to the Chrome Web Store 208 Configuring Your Application 210 Deciding Between Packaged and Hosted Chrome Apps 212 Publishing Applications with TapJS Creating a TapJS Application 212 213 Packaging an Application for TapJS 215 Publishing a TapJS Application to Facebook Publishing Games with Kongregate 217 Publishing HTML5 Applications to the Desktop Index 219 215 217