June 7, 2007 will

Game Objects Commandments

I've moved Game Objects to Google Code. It's new home is http://code.google.com/p/gameobjects/. There are source and Win32 packages available.

Game Objects is intended to be a collection of classes to assist with the creation of games, or other realtime applications. Currently there is a 2D and 3D Vector class, and a well optimized 4x4 Matrix class, but eventually Game Objects will contain code for general route finding, entity management, AI and other cool stuff. I'm happy to take suggestions, and if you would like to submit code - even better! All classes should following these commandments.

  1. Easy to use. Thou shalt be no more complex than absolutely necessary, and thou shalt protect the user from doing stupid things.
  2. Fast. Thou shalt be fast, unless it comes in to conflict with 1.
  3. Pure Python. Thou shalt be in pure Python. Optimized C versions may exist as long as the interface is identical.
  4. Few dependencies. Thou shalt not require external modules, other than the standard library. External modules may be optional if they increase performance.

Current version is 0.0.1, but don't let the low version scare you, the current classes are quite stable. Most of my previous little PyGame experiments have used old versions of Game Objects, so I have ironed out most of the kinks. I plan on putting together a collection of samples, so there is something to play with. Any suggestions for interesting projects that make use of Game Objects will be gratefully received.

Update: I have created a Google Group for discussion of Game Objects (http://groups.google.com/group/gameobjects).
Use Markdown for formatting
*Italic* **Bold** `inline code` Links to [Google](http://www.google.com) > This is a quote > ```python import this ```
your comment will be previewed here
Richard Jones

Great stuff!

Robb Drinkwater

Per my previous post (below) I now see that you *are* the author of these modules... great work! These should be in every developers toolbox (and not just gamers).
I haven't had time to look over every method, but if you need it I be glad to share some affine classes I've created.

Also, Is it ok to add a GLP license? As well as a credit? Not that I will be destributing your code... but I will be sharing it with my collaborators, and I like to see credit given where it's due. (and you deserve a lot of credit for this!)
And if you want I'll be glad to add some doc_strings

Feel free to email me.


Hi Robb,

Glad you found Game Objects useful. I'll put copyright statement in the next release. As for license, I want to make it completely free for anyone to use, even commercially, with no draconian rules and regulations. Personally I'd like to use the term 'public domain', but everyone wants a 'license' these days. Let me think about it!

If you would like to submit something to the project, then you are more than welcome! Although, please work with the latest version from SVN, it's changing constantly.


doesn't this have any documentation or something?
Hi Will!

I've been learning Python out of your book, and I have to say it's been a big help so far. I've just started getting into Chapter 5 and a lot of the material that wasn't clicking before is falling into place.

But I've just downloaded your game objects package, and I can't seem to install it onto my Mac OS X system. No worries though, I think I can just copy the files into the folder I'm using them in to use them, but it would be nice to have some documentation.

If I can help with it, please let me know.
George L Schafer IV
Scratch that last post. I just misread the instructions.

Either way, great book and I'm learning a lot!
When reading your book (wonderful introduction to Pygame and easy and funny to read even for a french woman), I wrote my own Vector2 class copying the code you gave, but I couldn't make the game at the end of chapter 5 without gameobject. Is it possible to know how to be able to multiply a vector and use float numbers in the multiplication so I can make the game with my very own Vector2 class ?
Will McGugan
Doudoulolita, Do you mean something like this?

 myvec = Vecctor2D(1, 2)
doublevev = Vector2D * 2

Have a look at Listing 5-13 in the book…
Thank you so much for your help ! I'll try it as soon as can.
I always wonder how other people have learned programming. Did you learn at school, in books, on the internet or alone ?
I find it easier to have a good book than reading tutos on internet, every thing is mixed up and you cannot read it easily in the subway or at the beach. But internet is great to ask for more help.
It would be nice to explain how to make a sprite walk (or eat fugu, for exemple) in your next book ! It seems rather difficult with pygame (or i'm toot stupid…)
How, just another thing: when I tried to multiply a vector in one of my programm, I received an error in the terminal, that's why I thought it is more complicated. I'll try to find out where there was this problem exactly.
hey will

ur book is great ! i started learning python through learning python but it was too vast ! ur book is quick and concise , especially since i know the basics of OOP through C++ . but i have a problem when i was going through chapter7 . i keep seeing this function call get_distance_to . but i dont see the function defined anywhere previously in the code . is it present in Vector2 ?
Sumeet Dube
Hi will I liked your book very much.
I had a problem: when i ran the keymovement.py code from your book which uses the gameobjects library i encountered the following error…
Traceback (most recent call last):
File “C:\Python32\pygame codes\keymovement.py”, line 7, in <module>
from gameobjects.vector2 import Vector2
File “C:\Python32\Lib\gameobjects\vector2.py”, line 134
raise IndexError, “There are 2 values in this object, index should be 0 or 1”
SyntaxError: invalid syntax

Can you please help me.
Thank you…