Find out if four titles on gaming are worth your time -- and money
Games programming is what got me into computers some 15 years ago. If youโre at all like me, then the magic, brightly colored animation radiating out of computer games attracts you like a moth to light. But being fascinated by computer games (and their internals) and being able to program them are two different things altogether. I had to learn the trade the hard way โ by staring at games for hours until you could see how they worked. These days you can cheat and take a short-cut: Pick up a book and just โmind meldโ with the experienced programmer who disgorges all his experience, tips, and tricks.
Bearing in mind that some Java books (see the Laura Lemay book listed below in the Resources section) these days want to lead you up different paths altogether, you could do worse things than trust an ex-(commercial)games programmer to review the currently available Java game programming books.
Four titles landed on my doorstep for this review:
-
Black Art of Java Game Programming, by Joel Fan, Eric Ries, and Calin Tenitchi (Waite Group Press)
-
Cutting-Edge Java Game Programming, by Neil Bartlett, Steve Simkin, and Chris Stranc (Coriolis Group Books)
-
Developing Java Entertainment Applets, by John Withers (Wiley)
- Teach Yourself Internet Game Programming with Java, by Michael Morrison (Sams.net)
Before I review the books in detail, letโs start with a table that gives you a birdโs-eye view of their main characteristics:
Table 1: Java Game Programming Books Overview.
| Title (Publisher) | Price(US$) | Pages | Chapters (Appendices) | CD- ROM? | Authors | Object- Orientation | Networked Multi-User Focus | Game Framework Focus |
|---|
| Black Art of Java Game Programming (Waite) | 49.99 | 933 | 20 (5) | Yes | 3++ |
Very Good |
Good | Good |
| Cutting-Edge Java Game Programming (Coriolis) | 39.99 | 523 | 21 (2) | Yes | 3 |
Very Good |
Very Good |
Very Good |
| Developing Java Entertainment Applets (Wiley) | 29.95 | 392 | 10 (0) | No | 1 | Poor | Poor | Average |
| Teach Yourself Internet Game Programming with Java (Sams.net) | 39.99 | 416 | 21 (3) | Yes | 1 | Average | Good | None |
To describe the table headings, the Object-Orientation column highlights to what extent the author(s) of the respective book used Java the way it is meant to be used: in an object-oriented way. Good Java books, whatever their focus, enforce good object-oriented practices. Inferior books use Java as if it was C or Pascal โ that is, in a procedural way. Games are very good candidate applications that benefit from being designed and implemented using object-orientation, so a good Java games book better be strong on OOA/OOD/OOP (OO Analysis, Design, Programming).
The Networked Multi-User Focus column highlights how much the book focuses on Javaโs strongest game programming potential: networked, multi-user games.
The Game Framework Focus column highlights to what extent the book relies on a game framework to explain and develop games programming. Game frameworks are state-of-the-art game APIs that eliminate many of the standard tasks that all games have to perform (sprite management, screen repainting, score keeping, and so on).
Now, a look at the books in detail.
Black Art of Java Game Programming
Black Art of Java Game Programming is one of those Bible-type books โ all 933 pages of it. The book is logically structured into three parts:
- โFundamentals of Java Game Developmentโ
- โAdvanced Game and Graphics Techniquesโ
- โGame Galleryโ
Part 1, which is written entirely by the bookโs main author (Joel Fan), expertly weaves the three subject threads of Java, object-orientation, and game programming fundamentals into one clear, refreshing, and coherent whole.
Part 2 focuses on networking and 3D techniques. One chapter develops a server-side high score management system while another develops an entire chat-room system. Both these systems entail client-side and server-side programs (applets and servers, in other words). The only two chapters dealing with 3D read like a book within a book: In over 110 pages Calin Tenitchi crunches through all the classic 3D basics and, in his second chapter, analyzes the use of a large but very well-designed 3D game framework called App3DCore. With the official Java 3D API on the horizon, this part of the book will soon be partially obsolete, although much of the framework deals with higher-level aspects than Java 3D so this is not a problem for the book. At any rate, having the insides of such a 3D framework explained is very enlightening.
Part 3, the Game Gallery, contains eight chapters, each of which develops an entire game. The games vary in sophistication, which gave me the impression that this part of the book was rather hastily put together. The individual design and implementation of the games is (overall) of the same high quality as the rest of the book, though. Thereโs a vector-based Asteroids clone, Othello, a Web-based Mahjong, a horizontally-scrolling, word-shooting edutainment game, two different magic-square games, and an incarnation of the classic Worm (or Snake, if you prefer) game.
Although the book is not without its share of glitches, errors, and so on (for example, one page contains a code listing that is mangled beyond belief), I liked it a lot. The book has many strengths and few weaknesses. It is strong on good program analysis and design. (Ah! you thought you could skip those stages just because theyโre games? Wrong.) The book uses various types of diagrams very effectively (object diagrams, class diagrams, flowcharts, state machine diagrams, screen prototype diagrams, and so on), and most of the code listings are very readable. (This aspect, like the writing style, does fluctuate from author to author. This is the inevitable flip-side of books written by several authors.)
Cutting-Edge Java Game Programming
Iโm usually very skeptical of titles starting with โAdvanced,โ โCutting-Edge,โ and the like, simply because, usually they arenโt! In the case of Cutting-Edge Java Game Programming, Coriolisโs marketing department didnโt hype anything up: The book definitely is not for beginners or intermediate-level Java programmers. In fact, all but the first and last chapters of the book are devoted to an in-depth, no-nonsense analysis of the design and implementation of two game frameworks. The first framework caters to single-user (stand-alone) games while the second is geared toward Internet-based, multi-user games.
Chapter 2 packs the complete implementation of an entire Asteroids clone thatโs playable, flicker-free, and uses smooth animation and sound. And that in just 250 odd lines of code โ or just 18 book pages! This chapter, therefore, ought to convince anyone that using game frameworks, and frameworks in general, is one of the best ways to achieve high levels of programming productivity by accentuating design reuse, rather than code reuse (but in the process also reusing mountains of code).
If Chapter 2 is a clear, promising sign of the high quality of this book, then Chapter 3 reinforces that impression by introducing us to the core theme of the book: the in-depth exploration of a (very) well-designed game framework. In passing, the author explains what CRC (Class/Responsibilities/Collaborators) cards are, the essence of Booch class diagrams, and object message interaction diagrams. By the way, this is not as page filling because the rest of the book uses these powerful software engineering tools to enhance the text!
The single-user game framework, called GameWorks, is based on the tried-and-tested game programming metaphor of a stage populated by actors. Using this intuitive abstraction, you can implement any type of game โ from classic board games to fast, action-packed arcade games. I was slightly disappointed that the authors picked card games as an example game style (I prefer something that gets the adrenaline flowing), although they nevertheless manage to weave in all the standard issues and techniques, and expertly so (among others: image processing, input management, sprites, optimized screen refresh, audio, randomness, artificial intelligence).
Although the book isnโt structured around parts, it should have been. There is a clear switch of focus from chapter 15 onwards. Chapter 15, โNetwork Game Programming,โ represents a definite shift to a higher gear, with a new author doing the writing. After introducing the main issues surrounding network-based games (connection topologies, latency, game state synchronization), the book develops a clone of Risk, the classic strategy board game (called Domination in the book). Domination is only an excuse to develop a new game framework addressing the generic class of network-enabled multi-user games. These last five chapters are tough going, and I strongly suspect readers without some data communication background will not feel comfortable with the more technical arguments. But thereโs no way you can skip these chapters: They contain a very thorough treatment of the critical issues of game state de-synchronization and latency problems, as well as a number of increasingly sophisticated solutions.
The book winds down with a chapter on code optimization and an interesting chapter on the design of FRED, a โDoomโ clone written in Java! FRED uses ray casting (yes, in Java) to achieve that classic โDoomโ feel, and this core technique is explained in detail.
To summarize, Cutting-Edge Java Game Programming is excellent. The writing is lucid and to-the-point. The software that the authors develop is of very high quality. The listings are clear and readable, and I donโt know about you, but after reading other peopleโs programs for 15 years, I donโt regard source-code readability as a luxury).
Developing Java Entertainment Applets
Developing Java Entertainment Applets is a very disappointing book. If a publisher gave you 400 pages in which to cram everything you know about programming games in Java (okay, okay, โJava En-ter-tain-ment App-letsโ), then you do not start with a chapter that reiterates, ad nauseam, the history of Java. Or continue with โJava Fundamentalsโ (Chapter 4), a totally superfluous rehashing of language basics (variables, Unicode, expressions, comments, control flow, objects, classes, packages โ you name it!). The author still doesnโt suspect that he might be focusing on the wrong subject entirely, so in Chapter 5, โMore Advanced Techniques,โ he drones on with arrays, vectors, strings, exceptions, multithreading, applets. Getting ever so slightly hotter is Chapter 6, โGraphics, Sound and Events.โ But youโll be hard-pressed to find any references to game programming here, either. Instead, precious page real estate is devoted to bringing you no less than 13 half-page screenshots of the trivial results of draw3DRect(), drawOval(), drawArc() and the like!
Half-way through the book (Chapter 7, page 219) we have the first appearance of some Java game code, in this case, an attempt at the Solitaire card game (decidedly, card games must be in season). The design of the game, the implementation of the game, and the readability of the listings are all so inferior compared to the same aspects of the other books in this review that itโs clear Developing Java Entertainment Applets has problems.
Some remarkable statements made by the author, and a general sloppiness or misuse of terms that have crystal-clear meaning, only helps to sink this book before it has a chance to sail. AWTโs layout management mechanism is criticized as follows: โThe way layout is handled is pretty botched up. Not that it doesnโt make sense and isnโt for a good reason, but it is still botched up.โ Javaโs networking API also is not to the authorโs liking: โThe way that Java hooks up to other locations on the Net is broken, and while it isnโt totally unusable, it sure isnโt very functional in its current state.โ Strange, I would have sworn that others and myself manage to create pretty exciting things with that same API (Web crawler, DAMPP โ see Resources below for references to my previous JavaWorld articles on these topics). That last quote comes out of Chapter 8, โMultiplayer Gaming,โ where we are nevertheless shown โa stupid little exampleโ (to quote the book) in the form of a chat application. (Other examples of language that I find hard to swallow in this book are โto cement it in your headโ (p. 283), โand spitting things over a socketโ (p. 284), to quote just two.)
Isnโt there anything good to say about this book? Actually, there is: Chapter 2, โThe Principles of Game Design,โ is an interesting analysis of what makes a good game good. Here the author shines by identifying several aspects that all good games have, like a well-designed game interface, veracity (level of realism), customizability, AI, and so on. The next chapter, โGame Design in Action,โ analyzes some real games and highlights their use of good game design elements. Then there is one large chapter (Chapter 9) devoted to a study and use of the Gamelet Toolkit (a public domain game framework, written by Mark Tacchi, that received a JavaCup International prize). These three chapters are the only parts of the book that are worth the paper theyโre printed on, Iโm afraid.
Teach Yourself Internet Game Programming with Java
Comparative reviews are tough because rarely are two (or more) books in exactly the same category. Teach Yourself Internet Game Programming with Java, according to its back cover, addresses users in the โnewโ to โcasualโ categories. Beginners, in other words.
With his intended audience in mind, the author takes his time explaining some very, very fundamental things โ like colors, coordinate systems, and sound waves. In fact, I found the book takes much too long to get down to business and give actual code examples. The first four chapters (or โdaysโ in Teach Yourself marketing speak), โGames on the Web,โ โJava Game Programming,โ โObject-Oriented Programming with Java,โ and โThe Basics of Graphics,โ all manage to avoid code examples. Only with Chapter 5, โJava Graphics Techniques,โ does code finally make a timid entrรฉ.
Because the book is targeted at an audience of beginners and would-be games programmers, youโd expect the author to jump at the opportunity to develop a game framework for his book, as part of preparing the book, and simply show the reader how to use it. Such an approach would be very attractive because it would allow one to concentrate on the high-level game design aspects and ignore nitty-gritty things like sprite management, background management, and so on. Morrison took the opposite approach, starting from scratch on all fronts, with sprites, input handling, audio, and so on. This means that the few games the book develops are very basic. The first โgameโ isnโt even a game at all: โSim Tarantulaโ animates some spiders without interacting with any player (this comes right after the chapter on โSprite Animation,โ so itโs really just a fancy test for the sprite code).
By the time we reach Chapter 10, the first real game is presented, called Traveling Gecko: Blistering Desert Fun. This gecko game is a reincarnation of a very old (but very playable) arcade classic: Frogger. (For those who missed that Golden Age of non-violent, thoroughly addictive video games, with Frogger the player guides a frog across a highway and then across a fast-flowing river filled with logs and crocodiles.) Traveling Gecko didnโt want to work properly in my Netscape Navigator 3.0, but giving it a shot with appletviewer finally let me enjoy the game in all its (silent) glory. Only after two more chapters on audio do you get the first game to feature some sound effects. The presented game has the player catching scorpions in the night and uses a set of sound samples very effectively, although the gameplay itself is ultra-simplistic.
Part 3 of the book is the โpiece de resistanceโ: After introducing the concept of game AI (artificial intelligence), Chapter 16 develops a clone of the game Connect Four with a solid computer opponent. The game is just a prelude to the bookโs climax: a Web-based (2-player) Connect Four that lets two geographically separated players play together via the intermediary of a Web server-hosted Connect4Server daemon.
The author chose to present large classes in a style that I donโt particularly like: Instead of including the entire source code for a class (the style I use), the author gives you bits at a time. Member variables, constructors, and methods are interleaved with the bookโs text. Only he often omits the import and class declaration clauses, which made me feel thoroughly โlostโ; the class clause is the first thing I want to read when exploring new classes, as it acts as a kind of mental anchor. Of course, because beginners havenโt yet formed habits or expectations relating to reading Java programs, the authorโs approach might actually be okay with them.
In summary, Teach Yourself Internet Game Programming with Java contains enough introductory material to have its targeted audience reading, learning, and experimenting for a while. The focus, however, is mainly the absolute basics of game programming, and not Internet-based game programming, which inevitably requires non-trivial network programming.
The bottom line
The four books in this review fall in two sub-categories: experienced and beginner. Black Art of Java Game Programming and Cutting-Edge Java Game Programming will appeal to mature, experienced programmers. Both books are very good and neither treats you as if youโre still in kindergarten. If you want a book that focuses very hard on game framework design, then the Coriolis book is it. If you prefer a bit more diversity in topics, approaches, and number of games developed, then Waiteโs book should be a perfect match. If youโre a beginner though, go for the Sams.net book. If youโre interested in high-level (language-independent) game design issues, then Wileyโs book contains some interesting insights, but stay away from it if you want to treat yourself to a great Java games programming book this summer.


