Build an HTML5 Game

Author: Karl Bunyan
Publisher: No Starch Press
Date: March 30, 2015
Pages: 224
ISBN: 9781593275754
Print: 1593275757
Kindle: B00V3WS8EY
Audience: JavaScript programmers
Rating: 4
Reviewer: Mike James 

 

If you want to build an HTML5 game is this the book you are looking for?

It seems a very long time since HTML5 was new enough to get into a headline, but add it to JavaScript and CSS and you can indeed build a game that should run in any modern browser. This book is about doing just that and as you can imagine there is still plenty of scope for creating web-based games. 

The main thing to say about this book is that it isn't for the beginner in programming or in using HTML and CSS. It also takes for granted that you know what the DOM is and roughly how to work with it. It also make heavy use of jQuery and Modernizer. 

Chapter 1 explains the details of the game that is the subject of the entire book. It is a simple animated bubble game. You shoot bubbles off and they collide and when you get a big enough group they pop. It is a simple game, but it is a fairly complete one that you might even consider putting in an app store and hoping that it goes viral. The point is that this isn't a cut down demo - it is the real thing. 

Chapter 1 also explains how to get all the necessary libraries installed and how to use Divs as a way of dividing up the screen real estate. It goes into how to use the debugging tools, but not into how to use an IDE to develop Javascript programs. This is a bit of a shame as there are free IDEs that make writing web apps a lot easier - NetBeans being my favourite. 

 Chapter 2 is a fairly standard account of sprite-based animation using the DOM. We have a lot of working out of angles and directions and here you might wish you had paid more attention to trigonometry.

Chapter 3 is about making things look better, drawing the board and managing the sprites. The second half of the chapter is about collision detection which is always something that seems as though it should be simple, but in practice always turns out to be more difficult and subtle than you imagined.

The final chapter of the first part of the book is on DOM-based animation and tidies up things that have been overlooked so far - popping bubbles and removing them, dealing with orphaned bubbles and so on. You get to see both CSS and JavaScript approaches to animation.

 

buildAnHTML5game

 

Part II of the book works over the game a second time, but now using Canvas rather than the DOM approach. There are programmers who might think that this is the only sensible approach and the DOM is for pre-HTML5 games. However, DOM/CSS animation is still worth knowing about.

Chapter 5 introduces CSS transitions and transformations. Then on to Sprites implemented directly in Canvas in Chapter 6. As this is just a case of drawing bitmaps to the Canvas object it seems simple and straightforward. Chapter 7 introduces simple ways of creating game sounds, implementing high score displays and how to keep track of the user. 

The final chapter is a overview of things that have been left out of the book. Topics include Ajax, websockets, webworkers and WebGL, each treated in a short paragraph. Next we have a section on deployment which is probably the topic the book misses out on the most. Writing a web app means you can deploy it as a Chrome or Firefox app or even as a native app using PhoneGap. In this chapter you get to learn about handling touch events and scaling and there's a quick look at PhoneGap. The final few pages are on optimization and security.  

The descriptions of all of the ideas are clear and easy to follow but only if you already know something about the technologies being used. This is not a book for trying to learn JavaScript or even HTML/CSS. It would make a good second level course on the techologies, but only if you were interested in building a game. There is a lot of code in this book and to get the most from it you are going to have to try it out. Keep in mind that the book is about different approaches to implementing the same game - i.e. there is only one big example. If you aren't interested in the game then the chances are you will get bored with the book quite quickly.

 

Banner


Go Programming In Easy Steps

Author: Mike McGrath
Publisher: In Easy Steps
Date: January 2021
Pages: 192
ISBN: 978-1840789195
Print: 1840789190
Kindle: B08NF958NM
Audience: Non-programmers wanting to learn to code in Go
Rating: 5
Reviewer: Mike James
Getting going with Go - great idea!



SQL Server 2022 Administration Inside Out

Author: Randolph West et al
Publisher: Microsoft Press
Pages: 992
Print: 0137899882
ISBN: 978-0137899883
Kindle: B0C4VKVP27
Audience: DBAs and developers
Rating: 5.0
Reviewer: Ian Stirk

This book aims to update your DBA skills to cover SQL Server 2022, how does it fare?


More Reviews

 

 

Last Updated ( Wednesday, 15 April 2015 )