Shortly before the holidays began I received a review copy of Core HTML5 2D Game Programming and amid all the holiday insanity, I’ve been slowly making my way through this title. As with all reviews, I don’t give star ratings, I think the value of a book is determined mostly by the perspective and requirements of the reader. Of course, some books are just simply bad. Bad grammar, bad topic choice, bad humour. Fortunately that is not the case here. From a technical perspective this is a good book (with one glaring flaw). Now the question is, is it a good book for you?
Ultimately this is a learn by doing book. Through the course of the book you are putting together a basic platforming game called Snail Bait, built using the assets of the open source Android title Replica Island. The game is available to be played online at http://corehtml5games.com… or at least, it’s supposed to be. When I go to that site I get:
Hmmm, that’s unfortunate. I am not sure if this is an ongoing problem, or just temporary. Judging by an earlier review on Amazon about the server being unavailable, this is a recurring problem. It is however a bit of a big problem, as many of the code listings in this book are actually partial, so having access to the complete project is very important. The book repeatedly references this site, so with it down, so is a great deal of the appeal of this book. Unfortunately the publisher doesn’t appear to make the code available anywhere else, at least not the book’s version.
Now back to the actual contents of the book. This book covers pretty much all aspects of what you need to make a complete 2D HTML5 game. One critical thing to understand with this title is everything is created from scratch. The book makes use of no existing libraries, so you learn how to do things from scratch. There is merit to learning how to do everything yourself at least initially. That said, you will probably make a better game using libraries that have already dealt with all the various cross browser issues and optimizations for you.
The book does cover a surprising number of topics, starting with handling the game loop and ending with basic network programming. For each topic there are a number of callout notes on game development or HTML5 idiosyncrasies. For the most part, they are topical and rarely feel superfluous. In between it covers animation, graphics, input, hit detection, dealing with mobile (controls and resolutions), particles, audio, easing and more. The coverage of each topic is fairly comprehensive and easily understood. One thing you might want to note, this book is entirely about using canvas for rendering, with absolutely no coverage of WebGL. Given the increasing support for WebGL ( IE and Safari are both finally on board ), this could be a pretty big negative.
As I mentioned earlier, the majority of the book is about creating a single game step by step using what you’ve learned up till this point. The code snippets are clear but without access to the finished whole, trying to figure out how it all fits together is difficult. There is however one chapter dedicated to putting all the pieces you’ve learned together to make a simpler but complete game, Bodega’s Revenge. Unfortunately, these are also partial code listings, so without access to the source code, readers may struggle filling in the pieces.
I would highly suggest the author or publisher make the code available on a much more reliable source, such as Github.