# Game Objects Posts

6 posts tagged with game-objects

The following is a list of the chapter titles for Beginning Game Development with Python and Pygame, and a brief explanation of the contents.

Any questions about the book contents, let me know!

Chapters:

Introduction to basic Python.

Goes a little deeper in to Python, covers Classes.

Explains how import and use Pygame.

Covers different ways of drawing to the screen.

Explains animation, vectors and time-based movement.

Covers how to read input devices and connect them to in-game motion.

Covers artificial intelligence.

Explains the basic 3D concepts, with samples.

Covers 3D maths and introduces OpenGL.

Sound and Music.

Covers textures and reading 3D models from files.

Covers lighting, blending, fog and other OpenGL features.

Appendices:

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.

Added a few functions to gameobjects.util that seemed worth sharing. The first two are two-dimensional versions of `range` and `xrange`. When iterating over something 2 dimensional (such as pixels in an image) you typically have an outer loop for the y coordinate, and an inner loop for the x coordinate. The `range2d` and `xrange2d` functions combine these two loops in to one and take range iterables as parameters.

Here's how you might use `range2d` to iterate over the coordinates in an image.

The `xrange2d` function returns a generator rather than a list, but works the same.

A novice games programmer learns he can move a sprite by adding a constant to its position every frame. For a while he is happy and mocks the master games programmer for having wasted many years learning. But soon the novice realises his sprites are unpredictable and move at different rates on different machines. The novice is despondent and visits the master for advice.

"Master. Why do my sprites not obey my commands? They jump when I ask them to slide."

"Frame rate is like the wolf, it can not be tamed", replies the master.

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.

I've just uploaded a new version of Game Objects. The 3D maths classes (Vector2, Vector3 and Matrix44) are reasonably stable now. I'd like to invite Python coders to play around with them, and suggest any improvements. My intention was to make something that was very easy to use, but well optimized. Game Objects is public domain. Do what you want with the code - go crazy!

There is no documentation at the moment I'm afraid, but here are a few edited highlights.