warning: Creating default object from empty value in /home/dr_rick/onearmedman.com/modules/taxonomy/taxonomy.pages.inc on line 33.

python

Let's Begin!

Open the first file in the demo (01_lincolnkitty_basics.py) in a Python editor. This editor might be Idle, which usually comes with Python, your own favorite development environment, or even just a simple text editor.

This file is the skeleton from which you can build just about any prototype. It loads up the pygame and other important modules, creates a main function, sets up the screen, and start running (although only briefly, since nothing is happening yet.)

The most important thing to observe here is the "while" statement. This is the "main loop" of the application. It will repeat, over and over again, for every frame of the game sent to the screen (which we've set to be updated at 60 frames per second.)

The Basics

At their heart, games and other applications run on a very simple three-part structure.

  • The Controller
  • The Model
  • The View

Each is separate but dependent on the others. The controller takes all the input into the system, from the keyboard to the mouse to the internet connection. The model processes the inputs from the controller and makes decisions based on it. The view displays the results of those decisions as output to the screen.

That's it!

Setting Up

We'll be using a Python module called Pygame to prototype this demonstration game. To install Pygame, go to the links below.

Python and Pygame downloads, for Windows:
http://www.python.org/download/
http://www.pygame.org/download.shtml

For Mac:
Python 2.4:
http://pythonmac.org/packages/py24-fat/index.html
or Python 2.5:
http://pythonmac.org/packages/py25-fat/index.html
Be sure to get the Python, pyobjc, and pygame packages from the list if you don't have them already.

Also, you'll need the demonstration files I've prepared for this class. Download one of the "demo" files you see linked below, either the .zip or .tar.gz file.

Game Prototyping

Welcome to the Game Prototyping Workshop!

Making a game can be easier than you think. With a few simple concepts, you can start to piece together a prototype, in any language, that can help you test your mechanics, sketch out an interface, or examine different possibilities for artwork. In this workshop, we'll use Python to:

  • Build the "main loop"
  • Get input from the user
  • Process the rules of the game
  • Display the result on screen as graphics

all by making a simple version of Space Invaders! In one short evening!

Let's get started!

Extracurricular Activities

It's not just about what happens in class. Lots of good things going down all the time. I've been involved in:

  • Student Teaching: I ran several workshop sessions on various topics, such as:
    • Basic Python
    • RSS for Podcasting
    • Python and PyHP
  • 24-Hour Machinima Design Jam: Rough stuff, but well worth the effort.

Creativity and Computation

Theory with Sven. Really fun, wide range of assignments, and we get to make podcasts and other weird stuff! Check out some of my work so far:

Copyright Mike Edwards 2006-2009. All content available under the Creative Commons Attribution ShareAlike license, unless otherwise noted.

Syndicate content