Free E-Book on Game Development Using Python

Feb 27, 2010

Q: I wrote a book called “Invent Your Own Computer Games with Python” and put it on the web for free under a Creative Commons license at I wanted to write a book that young adults could read and immediately start making small games while learning programming. The book is project-centric and each chapter has the source code for a complete, small game. Do you know of any groups that could make use of this resource?

A: I’ve passed along the link to one of my developer friends who is more familiar with using python to make games, to see whether he has any thoughts or impressions to offer based on his experience.

[ …One day later… ]

My Python guy had overwhelmingly positive things to say in response to the book – I’ll include a link and some information about it in my February newsletter to help people that are looking to get started into Python game development find it. Thanks for passing this my way!

Fellow indie developer Jonathan Hartley’s notes on the free e-book:

The book is totally appropriate for someone who has never programmed before. Explains everything, right from the ground up. Overall, I would wholeheartedly recommend it for its target audience: kids who want to learn to program specifically so they can create games. An adult, or someone who knows programming but wants to learn Python, will find chapters they can skim over, but it isn’t condescending nor too simplistic.

In terms of Python, it does not remotely cover all language features (e.g. it doesn’t mention creating your own classes) however it covers everything that you absolutely need to be able to create your own games, and it conforms to a fair ‘pythonic’ programming style using the parts of the language that it does cover.

+1 for maintaining a lively style without dumbing down
+1 for friendly and effective hand-drawn diagrams
+1 for use of the word ‘poop’ on page 21.

Things the book doesn’t cover

* Splitting your program up into multiple files
* Creating new classes, object oriented development
* Getting ideas for games, designing the gameplay. Perhaps this is wise, maybe this is better addressed in other types of forum, not a programming book.
* More advanced programming: dynamic typing, the point of unmutable types, first order functions, higher order functions, decorators, classes & metaclasses, generators, generator expressions, coroutines, lambdas – but that’s OK: It succeeds very well in its remit of teaching the reader enough programming and enough Python to create their own simple games. A perfect first stepping-stone.

My breakdown of the contents:

The first 10 chapters do a great job of leading the reader through the creation of many small games in the text console, which cumulatively cover all the basics of programming: variables; datatypes; expressions; strings & their methods; booleans and if statements; loop constructs; functions; variable scope; lists; dictionaries; multiple references to the same object (although not creating new classes of your own); short-circuit evaluation; assignment operators; string formatting; ascii;

Chapter 11 is on Cartesian co-ordinates; negative numbers; abs(); two minuses make a plus. At first I was taken aback because this seems so simple, but presumably if you haven’t covered these things at school yet, then this is vital.

Chapter 12 to 15 create one new game per chapter, using the things we’ve learned thus far, and cover the creation of simple but effective AI.

Chapter 16 to 18 breaks away from the text console, using the Pygame library to display rectangles, polygons, circles and bitmaps in a window. This covers the Pygame event loop; reading the keyboard; animation; 2D collision detection of axis-aligned rectangles; reading the mouse; bitmaps & scaled sprites; sounds; music.

I was disappointed that the ‘flags’ parameter on the Pygame set_mode function was glossed over without any explanation (“you will never need this”.) This is used to create a fullscreen window. For me, fullscreen mode is a vital component for me to enjoy a graphical game. Personal foible.

Chapter 19 caps the whole thing off with a final game incorporating all the techniques discussed, with music and the works.

While I wouldn’t recommend just anything sent my way, as is clear from Jonathan’s notes above, Invent with Python passes the inspection of someone who is experienced in what the book aims to teach. And best of all: it’s free! So, if you’re still looking for a way into programming, why not take a minute see whether this e-book passes your inspection, too?

(Disclaimer: I don’t know the book’s author, I am in no way compensated for promoting this free e-book, and there’s nothing in it for me if the book gets more readers. I just want to help more people get started in hobby videogame development, and this presents a free, viable route!)

Originally posted as part of Vol. 11

Learn and practice team game development with Gamkedo Club.
Membership worldwide. Professional support. Proven process.

Subscribe by e-mail to receive weekly updates with Gamkedo.Community interviews and YouTube training videos for game developers!

Comments are closed.

All contents Copyright ©2017 Chris DeLeon.

Site production by Ryan Burrell.