Book Review: Foundation - HTML5 Canvas

"HTML5 Canvas, For Games and Entertainment" is one of the "FriendsOfEd" Foundation series of books Apress publishes.  It is a book on bit mapped graphics and animation and how to utilize animation techniques within the HTML5 framework using the HTML5 CANVAS tag.  It is not a beginners book with regard to HTML or Javascript although the preface would have you believe it is.  The techniques discussed can be applied to most graphical bitmapped environments, and the book addresses the specifics of performing graphic operations in the HTML5 Canvas environment.  The book is published in black and white (graytone) - which leads to some of the illustrations being useless as color is really needed to see what the author is talking about.  Thankfully the source code is available for download, so you can actually observe and play with the operations Rob Hawkes discusses.

The first two chapters attempt at introduce HTML5 and javascript to the reader but quickly looses the novice who has never coded in HTML or javascript, in that the terminology utilized will only be understood by experienced coders.     The first chapter which introduces HTML5, starts off with HTML version 4 as its basis for introduction, and goes on to talk about other web technologies that should not be construed as HTML5 but are used in conjunction with HTML5.  I am not quite sure why it is so important for the reader to know what exactly is in the HTML 5 spec, and what is not; you still need to use HTML 5 in conjunction with the other technologies.   The second chapter almost seems like the author is trying to justify his use of JQuery discussing page loading and event handling before he ever gets to the basics of coding in Javascript (which he does do - but the intro appears too late in the text for the novice coder - and appears as page filler for the experienced coder).

Finally, the third chapter gets into the subject of HTML5 Canvas, which is where most people with prior HTML/javascript experience) will want to start reading.  Readers who are familiar with bit mapped graphic implementations in other environments, be they in QuickDraw, Cocoa, or even X-Windows may find chapters 3 and 4 to be somewhat tedious in they go into every drawing mode, the coordinate plane, the concept of a graphic context and basic bitmap manipulation.  Chapters 5, 6 and 7 build upon basic bit map processing, getting into interrogation of bitmap representations, saving and reading them in, and dealing with video/animation.  This is where the meat of the book is, and one will spend the majority of time in this book, as it deals with physics and math, transformation matrices and calculations based upon collisions, bouncing off of boundaries, acceleration and momentum. Chapters 8 and 9 get into developing (2) applications/games illustrating key and mouse event capture to drive the animation techniques discussed upon to this point. The last chapter discusses the current limitations and considerations of using HTML5 - and what the future holds.

In conclusion, one has to wonder how serious the author is with regard to actually using HTML 5 and the Canvas for creating "real" Games, games you can distribute; This is what one might think the book was about from its title - instead you get the feeling it is simply showing how you can entertain yourself as a programmer, using HTML 5 and the Canvas.   The book (in my opinion) should have concluded with viability of using HTML 5 and the Canvas for a real commercial game, potentially providing the source code for what would be a more commercial looking game so we could see the performance hits one would take by using the HTML 5 Canvas. Interestingly the book does touch on how to support multiuser gaming - but If the author really wanted to appear serious about using Canvas and HTML 5 for games, he could have shown how to create an WebApp for distribution on the iPhone or Android. I grant you it is beyond the scope of this book to fully address WebApps.. but the author certainly could have covered writing the wrapper in terms of the procedure to follow or made reference to materials that document it.   Instead, based upon the tone of the last chapter, you think that the Canvas in HTML 5 -  is not mature enough to write applications with yet - only that it has a bright future. Yes, it has a bright future - but you can create real web apps today.

© The Logical Choice 2011