Gaming the System with Python

Traditionally, scripting languages help administrators manage systems

with relatively small scripts. Python is used in this capacity as well

as for larger applications such as installation programs. The latest

effort, though, uses a library and tools from the PyGame effort to take

Python into the realm of interactive gaming.

PyGame (http://www.pygame.org) offers a Python-based game development

library built on the Simple DirectMedia Layer (SDL). SDL

(http://www.libsdl.org), the premier Linux library for graphics-heavy

games, provides multimedia capabilities on a number of platforms,

including Linux. SDL is similar to DirectX, but it supports multiple

platforms. A number of commercial games, especially those ported by the

now-defunct Loki (http://www.lokigames.com) use SDL. Possible Worlds, a

game covered here previously, also uses SDL.

SDL is an impressive effort. By building on top of SDL, the PyGame

effort lets Python developers take advantage of the richness in

multimedia that game users take for granted to build quite a respectable

game entirely in Python. Python developers should check out the nice

tutorial at http://www.pygame.org/docs/tut/newbieguide.html for an

explanation of PyGame's offering. PyGame also provides a code repository

at http://www.pygame.org/pcr/repository.html, which is full of small

routines to help speed game development.

SDL and Python, both already multi-platform tools, make supporting

multiple platforms a lot easier. One of the most advanced games written

with the PyGame tools, Civil, an American Civil War strategy game,

demonstrates SDL and Python's cross-platform prowess by supporting

Linux, MacOS X, Windows, and BSD UNIX versions of the game. Civil

(http://civil.sourceforge.net) is a turn-based strategy game that

focuses on small battles from the Civil War. An extensive manual

explaining how to play the game can be found at

http://civil.sourceforge.net/playing.html.

Civil's main drawback is that, so far, you need to download the code

from CVS in order to play (see

http://civil.sourceforge.net/download.html for details). That should

change, however, as the game nears a 1.0 release from the current 0.7

version. More importantly, the PyGame tools are slowly tearing down the

barriers preventing Linux developers from making good games, and I

expect the future will see more quality Linux efforts like Civil.

What’s wrong? The new clean desk test
Join the discussion
Be the first to comment on this article. Our Commenting Policies