[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Very beginner level question



2009/2/6 Varsha Purohit <varsha.purohit@xxxxxxxxx>
Ok I got this part. But the screen is initializing and after that i get program not responding message. The screen becomes inactive and i have to kill the program. 

You might get a lot further, a lot faster, by finding a simple, working program to start with.

I totally endorse spending the money on Will McGugan's book, and here's why. I have downloaded and run almost all of the examples and they all work well and are very understandable. They are also complete programs, so if you find a program you like, you can learn by "messing with it."

I was especially delighted by the chapter on Artificial Intelligence, because it's a really thorough example that contains a world simulation and several kinds of objects: leaves, ants, and spiders. 

The ants have a kind of AI called "State Machines," which is a good technique that most games use for AI, and it's implemented in a  thoroughly object-oriented fashion -- each state is an object that has various properties (like when to move to another state, and what actions to take on entering or exiting a state), and each ant (object) has a state machine (object) that runs by jumping between states. It sounds like a lot of objects and a lot of overhead, but it runs very fast.

The only thing missing from McGugan's book is a Python reference, but I get by using web searches and a couple of eBooks. 

My own personal involvement: In college, I wrote two theses developing a game, for kids, about simulated animal behavior. I was inspired by the great games: Rocky's Boots, ChipWits, and Robot Wars, and by popular animal behavior articles by Konrad Lorenz ("King Solomon's Ring") and Niko Tinbergen ("The curious behavior of the stickleback").

I come from a Lisp background. As it happens, I wrote my college theses in a variant of Lisp just before Common Lisp (and later CLOS, the Common Lisp Object System) became standard, so my code became obsolete. I never rewrote it in any C-like language, because even simpe things like mapping a function over a collection of objects was either difficult or impossible.

When some college buddies went on to design the OLPC XO, I was impressed and moved, so I decided to write some code for it. Once I tried Python/Pygame, I realized it would be a fun and interesting project to re-create my thesis code.

So that's my project for the next several months or more: writing a fun animal behavior simulator where kids can design the "brains" and see how well they work, so that they start, as Alan Kay would say, "Thinking About Thinking." It is starting with code from McGugan's book, and I'm adding fun stuff like sprites and animation. Probably will end up being 100% different code, but it's a great example to start from.