python

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.)

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.

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!