If you know how to use HTML5 and want to branch out into web-based online games, you don't need to master Flash. With the help of the book Learning HTML5 Game Programming by James L. Williams, you can start exploring this fascinating terrain. Keep reading for our review.
Title: Learning HTML5 Game Programming: A Hands-on Guide to Building Online Games Using Canvas, SVG, and WebGL
Author: James L. Williams
Publisher: Addison - Wesley
Unquestionably, Flash has ruled web-based online games for a long time. Backed up by a solid, easily-pluggable platform, the popular Adobe application makes it relatively easy, at least to some extent, to create interactive, cross-browser games, even at the expense of having to deal with the oddities and twists of a custom scripting language like Action Script.
As HTML5 grows increasingly popular over time, however, it may turn into a powerful contender in the terrain of web games; in the long run, it might even compete successfully with Flash. Furthermore, if you’ve already tried out the new set of features that HTML5 brings to the table, and want to use them for creating games, the book Learning HTML5 Game Programming by James L. Williams is definitely a guide that you should read and keep on your shelves for reference.
That said, it’s time to see what’s between the book’s covers…
Getting started: a quick look at HTML5’s main features, SVG, WebGL and more
The book’s first chapter is pretty approachable. It provides you with a brief overview of what HTML5 is, its historical evolution, and a quick introduction to some of its key features. It goes beyond the typical use of the new markup elements. Readers will learn about a basic utilization of the flashy HTML5 dual-channel communication objects, that is web sockets and web workers, Geolocation, media elements, Web Storage, WebSQL, and the APIs you can consume to start drawing things on the browser. These latter include the previously-mentioned <canvas> element, SVG (Scalable Vector Graphics) and WebGL. While the chapter is in general readable, it does not complement its concepts well with concrete hands-on examples.
Gathering game programming resources: a long and exhausting journey
Before you develop your own HTML5 games, you must have a clear idea of the resources, IDEs and libraries that can assist you in the process. With this idea in mind, chapter 2 offers a complete summary of the wealth of resources that you can employ for creating your own games. The list cover a tremendous variety of options that range over both server and client sides, including the Java SDK, the Google Web Toolkit (GWT), Google App Engine, and Opera Unite, along with some popular browser utilities that you've probably encountered before, such as Chrome and Safari Developer Tools, and the always venerable Firebug.
In summary: if you need to have, all in one place, most of the resources available to begin creating functional, cross-browser HTML5 games, chapter 2 is a thorough reference that you should keep at hand.
What’s behind a real game? Playing with collision detections, sprites, particle systems and Artificial Intelligence
Feeling a bit frustrated after going through the previous chapter, I felt a little concerned about the rest of the book. Well, I have to admit I was wrong: in fact, chapter 4 is, in my opinion, the book’s most engaging and delightful section. It provides an excellent variety of graspable examples to teach you how to sketch out your first HTML5 game, including the definition of its genre, playing rules and title, and most importantly, how to implement the bulk of its logic.
While most of the code samples you’ll find in this chapter rely heavily on the API provided by the Simple Game Framework (SGF), a gaming library based on the trendy Prototype, the concepts behind them are framework/language agnostic. Among other things, you’ll learn how create from top to bottom a Pong game (a 2D version of the classic ping-pong) and programmatically simulate some “real-world” physics, ranging from simple object collisions to gravity and inertia. The chapter also offers a gentle introduction to typical games effects and logic, such as particle systems and Artificial Intelligence (AI), as well as a concise (yet solid) guide to grasping the internals of a real game. My advice for this chapter: don’t miss it, especially if you want to enter the gaming programming field on the right foot.