My book, Beginning Game Development with Python and Pygame, is finally finished! It was a labor of love, and a lot of work. Apress have graciously allowed me to give away a free chapter.

I chose chapter 7, which is on the subject of Artificial Intelligence. I selected this chapter because it is nicely self-contained and doesn't require much additional understanding of other game concepts. It is an unusual chapter, in that it contains the largest listing in the book. I tried to avoid really long listings, but in this case I think it was justified so that the code in the book actually runs; I hate leaving any code as an exercise for the reader.

Pdf Icon

Download Chapter 7, Take me to Your Leader

Chapter 7 discusses how to build a simple AI simulation of an ants nest using a state machine, a technique which can be applied to virtually any simulation that you might want in a game. You can download the code for the book below, it isn't interactive, but I think it is entertaining to watch for a minute or two! Download Ant Simulation

The ant simulation uses the gameobjects library, which you can install with the following comand:

easy_install gameobjects

The book will be available in all good book shops, and some bad ones, on October 24th. Thanks to everyone at Apress for guiding me through the writing process! Update: I blogged the Table of Contents

This blog post was posted to It's All Geek to Me on Thursday October 4th, 2007 at 7:23PM

16 Responses to "Free chapter of Beginning Game Development with Python and Pygame"

  • October 5th, 2007, 1:25 p.m.

    Awesome, thanks you!

  • October 5th, 2007, 3:23 p.m.

    Congratulations! I've had the book on order for some time and I can't wait until it arrives! Of course, I am still plodding through my two OpenGL books... There simply aren't enough hours in the day.

  • David Montgomery
    October 6th, 2007, 12:40 a.m.

    Congratulations, Will!

  • October 6th, 2007, 3:56 a.m.


  • October 6th, 2007, 10:32 a.m.

    Cool! I really hope the rest of the book lives up to the expectation this chapter creates. It's already on my whishlist. Good stuff ... :)

  • October 9th, 2007, 10:18 p.m.

    [...] free chapter of beginning game dev with python [...]

  • gab
    October 9th, 2007, 10:30 p.m.

    Would there be any online version available?

  • October 10th, 2007, 1:25 p.m.

    Actually yes, Apress will be offering an e-book version.

  • October 11th, 2007, 6:06 p.m.

    Even if I know much of the material already, I am looking forward to reading over this and handing it off to others. Congratulations!

  • Pete
    October 18th, 2007, 5:08 a.m.

    Just pre-ordered the book. I can't wait.

    I am actually looking at doing a simple top-down 2D tile game in the Ultima flavour and hope I can glean some things out of this book to help out.

    Any sections I should pay particular attention to?


  • Jon
    October 23rd, 2007, 10:53 p.m.

    Got mime today via Amazon :)

  • October 23rd, 2007, 11:01 p.m.

    Hope you enjoy it Jon! Maybe you could post a review on Amazon?

  • Mark Melvin
    October 23rd, 2007, 11:20 p.m.

    Lucky you! Mine is delayed again until November! :o(

  • Jon
    October 24th, 2007, 7:09 p.m.

    I will indeed, looks good so far!

  • Mark Melvin
    October 31st, 2007, 12:06 a.m.

    Sweet! My book arrived today! Time to get started...

  • eddyfosman
    November 28th, 2007, 5:12 a.m.

    thank you so much ^.^

Leave a Comment

You can use bbcode in the comment: e.g. [b]This is bold[/b], [url][/url], [code python]import this[/code]
Preview Posting...
Previewing comment, please wait a moment...

My Tweets

Will McGugan

My name is Will McGugan. I am an unabashed geek, an author, a hacker and a Python expert – amongst other things!

Search for Posts
Possibly related posts
Popular Tags
Recent Comments
def thousands_with_commas(number): new_number = [] number = str(number) mod_value = len(number) % 3 counter = 3 if len(number) 4: return ...
don't know why this was tempting.. (#1)import re from collections import Counter, OrderedDict cnt=Counter() with open(./t) as f: #--- strip ...
- Mike on Python Coder Test
Hello! I've seen this test and tried to do them. Result added bellow. First path: def thousands_with_commas(i): i = str(i) ...
Why another framework? what wrong with django, pyramid, flask?will be have answer for this question in the docs)
Hi! Really great code, good work! But trying to use it on a responsive site, it didn't resize images. So, ...
© 2008 Will McGugan.

A technoblog blog, design by Will McGugan