Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Build your own 2D game engine and create great web games : using HTML5, JavaScript, and WebGL
Sung K., Pavleas J., Arnez F., Pace J., Apress, New York, NY, 2015. 496 pp. Type: Book (978-1-484209-53-0)
Date Reviewed: May 20 2016

Among the properties of desirable computer games is the quality of the graphical display. A good graphical display requires the creation of a large amount of supporting code and other software resources that have to be written and organized in a manner that allows developers to modify expeditiously the elements of the software foundation.

The foundational software library for a game is the game engine. A game engine is the middleware that provides the operational tools that power a game. The game engine is part of the suite of tools including the physics engine, which defines the physical properties of the entities in the game; the rendering engine, which produces the immediate graphical display; and the user interface, which allows the game developer to select elements of the toolset. There are many game engines, both proprietary and open source, available to game developers. Some of the most prominent proprietary game engines are Unity, UnrealEngine, and CryEngine, and similar open-source engines are Blender, Cocos2D, and Panda3D. Although a game developer can use a game engine “as is” without examining the internal structure of the software, this book allows readers to study the inner workings of a game engine by developing their own from scratch.

This book is a hands-on workbook that takes the reader from the first steps of downloading the software development tools to a completed engine. For the best results, readers ought to work through the examples by writing code and experimenting with software components as they are developed for inclusion in the completed engine. In the process, readers should discover how to extend and adapt the software tools to their own purposes. As can be expected with any learning activity, readers should expect to bring some prerequisites. They should know how to code in a high-level language; feel comfortable with geometry, algebra, and trigonometry; and have a foundation in physics such as that acquired in an initial university-level physics course sequence. Knowing some Hypertext Markup Language (HTML), Extensible Markup Language (XML), cascading style sheets (CSS), and JavaScript is beneficial.

This book complements several other books on using game engines within HTML5 and JavaScript [1,2,3,4].

The intended applications are games to be run on the web, in browsers, using HTML5, JavaScript, Canvas, and WebGL. Since full-featured web browsers can be found on full-scale computers, tablets, and handheld devices, the games that can be created within this software milieu can be run on any of these devices.

Since the book is a workbook, the first chapter begins with the gathering of software tools and their installation. The primary development software tool is NetBeans. There is a connector between Chrome and NetBeans that should be downloaded and incorporated to facilitate testing. The glMatrix math library is used in the engine to support mathematical transformations. In addition to collecting and installing the software tools, the discussion of the organization of the software elements is begun and is continually refreshed as the book continues into subsequent chapters.

Lessons on writing the necessary code begin in chapter 2, in which the HTML canvas tool in WebGL is used for drawing a simple object. This basic exercise is used to orient the developer to the grid system of the graphical display and then adds additional graphic functions from WebGL, such as GLSL, into the JavaScript code. The third chapter continues the drawing exercises with instruction on drawing multiple objects, control of the coordinate system, and increasing the level of abstraction of objects, mathematical transformations, and cameras. This is the stage in which use of the glMatrix library begins.

Animation, keyboard input by the user, and incorporating audio clips are among the topics begun in chapter 4. Since many games involve changes of levels and scenes, instruction on how to gracefully change a level and a scene is started. The primary emphasis in chapter 5 is the loading, rendering, and unloading of images into the game scene. This activity includes building more complex images from simpler components (in a sprite sheet). The physics of object interactions, such as collisions, is the emphasis of the sixth chapter.

Viewing the behavior of objects in the game through the eye of a camera is the topic of chapter 7. Even though the game takes place in a 2D world, the presentation of the behaviors of the objects can be viewed differently depending on how a virtual camera is used. The use of mathematical transformations begun in chapter 3 is deepened in this chapter, and the use of the mouse for input is added to the discussion. The quality of the graphical presentation is further developed in chapter 8, the longest individual chapter, in which illumination and shadows from light sources can be represented. Even in a 2D world, light sources, reflectivity of objects, and shadows can be present and enhance the quality of the game. The GLSL shading tools are the principal software components incorporated into the software engine. The physics of objects returns in the ninth chapter with a deeper analysis of collisions and particle behavior, including potential explosions. Moving objects must obey Newton’s laws of motion, and the chapter discusses numerically solving the equations arising from the movement of objects. Layered backgrounds and more sophisticated use of camera operations to increase user engagement are discussed in chapter 10.

The first ten chapters are intended to result in a fully functional game engine. Chapter 11 is a case study in using the game engine created in the first ten chapters to produce an actual game that requires both user agility and problem-solving skills. This is a brief chapter since all of the necessary code and graphical elements have already been developed. The emphasis is on the design of the resulting game and developing the game narrative. The game narrative graphics have been introduced in earlier chapters, but here they take center stage.

The authors and publisher have provided a complete set of solutions for the examples in each chapter for download as a large zip file. When expanded, there are 3,000 files organized in the folders as presented in chapter 1. They should be used only for reference when really stuck. The process of developing one’s own game engine under the direction of the authors of the book is the key experience. It is a laboratory between two book covers.

Reviewer:  Anthony J. Duben Review #: CR144432 (1608-0582)
1) Blackman, S. Beginning 3D game development with Unity 4 (2nd ed.). Apress, New York, NY, 2013.
2) Shimizu, R.; Furukawa, H.; Fushimi, R.; Tanaka, R.; Kratzer, K. HTML5 game programming with enchant.js. Apress, New York, NY, 2013.
3) Nagle, D. HTML5 game engines: app development and distribution. A K Peters/CRC Press, Boca Raton, FL, 2014.
4) Gregory, J. Game engine architecture (2nd ed.). A K Peters/CRC Press, Boca Raton, FL, 2014.
Bookmark and Share
  Reviewer Selected
Featured Reviewer
 
 
Games (K.8.0 ... )
 
 
HTML (I.7.2 ... )
 
 
Javascript (D.3.2 ... )
 
 
Language Classifications (D.3.2 )
 
Would you recommend this review?
yes
no
Other reviews under "Games": Date
How to beat your chess computer
Keene R., Levy D. (ed), Henry Holt, New York, NY, 1992. Type: Book (9780805023169)
Jun 1 1994
Relationships between fun and the computer business
Bushnell N. Communications of the ACM 39(9): 31-37, 1996. Type: Article
Apr 1 1997
NetWarriors online
Gradecki J., John Wiley & Sons, Inc., New York, NY, 1996. Type: Book (9780471135555)
Jul 1 1997
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy