Learning HTML 5 Game Programming

Until recently, without flash or java, the kinds of games you could create tended to be less action-orientated, though some enterprising types had built late 1970s favourites.

Almost anyone who’s learned to program at some point decides to create a game, so, naturally, web developers will want to give it a go. That said, until recently, without using Flash or Java, the kinds of games you could realistically create tended to be less action-orientated. However, some enterprising types had built late 1970s favourites.
The technologies developed under the banner “HTML5” promise to open up a lot more avenues for game developers. From creating bitmap games using the well-supported Canvas tag, to standardized support for audio and video (in case anyone wants to re-create Myst!) to even 3D with the newest releases of Firefox and Chrome (the two browsers arguably pushing ahead the fastest).

The first four chapters are what you’d expect: a bit of an overview of HTML5, how to set-up a developer environment, an introduction to JavaScript and games. The first chapter on HTML5 is good reading, just because “HTML5” is used as a catch-all for so many different things, it’s essential these days to figure out what someone means when they say “HTML5.” Considering too that on page 150, there’s mention of HP’s exit from the WebOS hardware business, which is barely two months old, this book is pretty up to date. It presents that different approaches being taken, for instance, in the case of a database where WebKit and Firefox have decided on two different types, and no formal HTML5 spec exists. However much of the bleeding-edge features are supported in different browsers specific ways, so the book introduces readers to a range of libraries are used in the book to get around the incompatibilities as well as easing the work of developers; in fact, that’s probably a good way of summarizing this book: a tour of the libraries you could build games using in the browser.

See also  Google Apps Hacks

A bit surprisingly, one library introduced is Prototype and its extensions to JavaScript’s object-orientation. There’s been a lot written about how Prototype tries to make JavaScript more like the Ruby language (which in its original role as a helper for Ruby on Rails made some sense) and the potential problems it can cause when used with other libraries, it’s the introduction here seems to be mostly for it is the foundation to the Simple Game Framework which is covered in chapter four, How Games Work. Besides jQuery and Prototype, the book introduces readers to a lot of libraries including Trient.js (canvas animation), RaphaĆ«lJS(SVG helper), Three.js (WebGL helper), and those are just the browser-side helpers.

Many books on game programming start with a simple game and gradually expand it throughout the book, or else introduce several mini-games to show different methods. This book doesn’t do that. It’s more of a tour of various libraries that can be used to build games. There isn’t a lot of the game mechanics I was kind of expecting, but that’s partly because many of these libraries take care of the basics for you, the other reason is a lot of the code is found on the book’s website, rather than re-printed in the book. Some readers might find it a bit un-focused since it doesn’t have an over-arching project and tries to cover a lot in its 200-odd pages. Everything from 2D with Canvas and SVG libraries to 3D with Three.js to JavaScript on the server with Node.js is covered. But for readers looking to figure out what’s available then this book is a good start.

See also  Prototype and Script.Aculo.Us