16 October 2018
I am delighted to say that my latest book Mission Python has just been published. The book shows readers how to use Python and the Pygame Zero library to build a space adventure game. The game runs on a Raspberry Pi or Windows PC, using free software. We've provided all the images and sounds you need as a downloadable file.
Here's a short video showing the game in action (dramatic music added for the video):
There are several ways to enjoy the book. Some readers will want to play and solve the game first to avoid spoilers, and then use the book to understand how it works. (I have minimised spoilers where possible, but readers might notice some clues when they study the code). Other people might want to build the game, chapter by chapter, either by typing in the code or by using my example listings. At the end of the book, their finished game will be their reward. Still others might want to use the game as a starting point for their own customisations.
I've built in customisation opportunities that should enable every reader to do something unique with the game. Some readers might just want to put their friends' names into the game, and hack the text descriptions. Others will seize the opportunity to design their own room and put it into the game, add a new corridor, or even redesign the map entirely. For graphic artists who are looking for a portfolio project, there's the opportunity to reskin the whole game by replacing our graphics with new image files. More ambitious coders might want to take the engine for the game and replace the maps, descriptions, images and puzzles to create an entirely new game set in a new world. Most chapters include Training Missions, which are small exercises to test your knowledge, with answers at the end of the chapter.
When writing the book, I often thought of the kinds of things I enjoyed programming when I was at school. Back then, I was programming an Amstrad CPC computer and I learned a lot from studying listings in magazines and books. I would have loved a book like this to guide me through building a whole game. There are lots of great Python books out there, but the examples tend to be limited to a couple of pages to demonstrate a coding feature. Mission Python provides a single in-depth worked example that allows readers to really get their teeth into a substantial coding project. The program gradually builds, chapter by chapter, in digestible chunks, so readers see the game come together in a similar way to how I did when I first built it.
The book is printed in full colour throughout, and produced to the high standards you would expect from the publisher NoStarch. Thanks to the team who worked on this title including the editors Liz Chadwick and Riley Hoffman, NoStarch CEO Bill Pollock, and Rafael Pimenta who did such a fabulous job of creating the game art. Tech editor Dan Aldred helped test the listings, and Daniel Pope created Pygame Zero which I'm using for images and sounds in this project.
I'll be sharing some more insights into the book and some extra resources for readers too over the coming weeks, so keep an eye on this blog or follow me on Twitter for updates. You can find links to order the book here, and more information on the book at its webpage here.