Game Development Using Python

Author: James R. Parker
Publisher: Mercury Learning
Pages: 298
ISBN: 978-1683921806
Print: 1683921801
Audience: Python developers
Rating: 3
Reviewer: Mike James
Games are a good way to learn Python and Python is a good way to learn about games.

There are a few books that teach game programming via the Pygame library and this is another, but with an emphasis on the academic. It starts off with chapter 0 - yes it's that sort of book - which gives a seemingly exhaustive classification of the different types of game. It is the sort of categorization that is typical when an academic tries to impose order where none is needed. It would probably make good material for a simple exam question.

Banner

The next  two chapters take you through the basic elements of 2D game construction using simple examples and explanations. In the main the explanations are once again overly academic for the subject matter - this is not a dummies' guide to games. 

Chapter 3 includes a very extended discussion of randomness which  leans towards the philosophical - again the ideas that are relevant to game construction could have been covered in a more concise way. There is also a very simple introduction to probablity theory. There is no attempt to introduce object-oriented ideas or approach. When the term "object" is used it means some entity that is drawn as part of the game. This is a shame because objects make your code more powerful. If you code a sprite as a class then you can have as many of them as you like simply by creating instances.

gamepython

 

Chapter 4 is strange in that it is titled Game AI: Collisions. I can't say that  I have ever thought of collisions as anything at all to do with AI and after reading the chapter I'm even more convinced it has nothing to do with AI - this shakes your confidence in the book somewhat. If you can ignore AI being dragged into it, the discussion of collision detection is quite good, if nothing to do with AI.

The AI nonsense continues into Chapter 5 which introduces control methods. The idea of a finite state machine is introduced - informally and confusingly - and this is used to define the behavior of a car. This is a standard technique in computer science and certainly not AI. The chapter ends with a look at the A* algorithm, which is usually considered to be an AI algorithm, but I'm not convinced its relevant at this point.

Chapter 6 is about sound and as you might guess we start off with the physics of sound. Eventually we get to programming and how to use pygame to create simple sounds and eventually positional sounds.

Chapter 7 introduces a large example - a jet boat race. It starts with an academic discussion of prototyping the game and then goes into a lot of detail. The project is "finished" in Chapter 9 with sounds and other embellishments. However as an interlude we have Chapter 8 on animation. This is something of a surprise as animation is key to game construction and it really should have been earlier. The idea of key frame animation is the main topic, but it seems to be based on manual cartoon creation. There is no mention of ideas such as easing functions or automatic tweening and no mention of vector graphics to make the job easier. The final chapter is about networking and it covers the basic ideas of using sockets. A networked Pong game is developed, which exposes the reader to some of the problems of latency without really providing solutions.

Parts of this book are good and, as long as you don't mind the intrusion of academic considerations, you might find it a good way to learn about game implementation. For me the book didn't really concentrate sufficiently on software principles - for example the word "sprite" doesn't appear in the index. Although Pygame is object-oriented, the book doesn't emphasize an object-oriented approach to game construction. When a ball is needed we don't construct a ball class but simply keep track of position and draw a circle as part of the game loop. You could argue that using classes and objects isn't efficient, but if efficiency is your major concern you wouldn't be using Python anyway. There are books on Pygame that are more fun and better structured.

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

 

  • Mike James is the author of Programmer's Python: Everything is an Object published by I/O Press as part of the  I Programmer Library. With the subtitle "Something Completely Different" this is for those who want to understand the deeper logic in the approach that Python 3 takes to classes and objects.

 

 

Banner


Essential C# 12 (Pearson)

Author: Mark Michaelis
Publisher: Addison-Wesley
Date: December 3, 2023
Pages: 1232
ISBN: 978-0138219512
Print: 0138219516
Kindle: B0CLKY8GNV
Audience: C# developers
Rating: 5
Reviewer: Mike James
The latest edition of a highly recommended book that combines reference and tutorial material.



Learn to Code by Solving Problems

Author: Dr. Daniel Zingaro
Publisher: No Starch Press
Date: June 2021
Pages: 335
ISBN: 978-1718501324
Print: 1718501323
Kindle: B08FH92YL8
Audience: People wanting to learn Python
Rating: 4
Reviewer: Mike James
Solving problems - sounds good?


More Reviews

<ASIN:1871962587>

<ASIN:B07S1K8KLW>

Last Updated ( Wednesday, 05 February 2020 )