Python Debuggers

[ LiB ]

Python Debuggers

Python comes with a built-in pdb (Python Debugger) module that defines an interactive source code debugger for Python programs. The Python debugger supports a number of useful programming functions, such as breakpoint setting, stack frame inspection, source code listing, and so on, but unfortunately the debugger has been (historically) poorly documented and the windowing version module (wdb) is considered a bit primitive.

Since source-level debugging is such an important part of programming, a few improvements have been made to the existing Python debugger. Two popular free Python debuggers are commonly used. The first is PythonWin, the Python for Windows extension. Unfortunately it only runs on Windows. The second is the HAP (Humongous Addition to Python) debugger developed at Humongous.


PythonWin is a Python debugger and an IDE that runs on Windows. Versions for Python 2.2 and 2.3 are included on the accompanying CD under Python/debuggers. PythonWin is becoming the standard Windows debugger and is now included in some distributions of Python (for instance, in ActiveState's ActivePython). PythonWin has a GUI environment (see Figure 3.1) but can also be run via command line.

Figure 3.1. Opening shot of the PythonWin debugger


PythonWin is basically a wrapper for the MFC (Microsoft Foundation Class) libraries. PythonWin is copyrighted by Mark Hammond but is freely usable and distributable as long as the license (found in both the Licenses folder and the Python/Debuggers/PythonWin folder on the CD) accompanies the binary.

The Open Source HAP Debugger

HAP can be found among other open-source Sourceforge projects (http://hapdebugger. sourceforge .net/) and is released under the Gnu Lesser General Public Licenses (you can read the license in detail on the CD in the Licenses folder). The HAP debugger can be run remotely, which makes it an ideal tester for a computer game in a lab environment. The game can run on full screen on one machine while a second machine can debug it remotely.

The HAP debugger Version 3.0 is included on the CD, under the Python/debuggers/HAP folder. HAP was built with the idea that the debugger would move to console game development and development on the Macintosh, but currently it runs only on Windows 2000 and must be built with Visual C++. It provides a few features the standard Python debugger cannot, such as a full-screen mode and multi-threading . The debugger has two applications. The first is the editor and IDE, and the second is the remote debugging host. The first application runs whatever Python script is being debugged and then communicates to the IDE via a network socket.


Consoles don't have keyboards, mice, or multiple monitors , so the default Python debugger isn't so great when you need to test console type games written in Python. This is one of the reasons Humongous developed the HAP debugger: remote debugging frees you from the platform and allows you to debug in a comfy com puter environment.


One Game Script's History

Before Humongous Entertainment used Python, they had an internal tool named SCUMM (Script Creation Utility for Maniac Mansion). Maniac Mansion was a project originally under LucasFilm Games, and SCUMM was the custom scripting language and game engine used to develop Maniac Mansion.

SCUMM was created by Aric Wilmunder and Ron Gilbert when they worked for LucasFilm. When Gilbert later founded Humongous and Cavedog Entertainment in the Pacific Northwest, he brought with him SCUMM, which the new companies used to create over 50 different games, including Humongous's original popular Freddi Fish , Putt Putt , and Pajama Sam children's titles.

SCUMM's limitations became too restricting after a decade or so of use, and at that time the company switched over to using C++ and Python for game development. The first game it scripted with Python was Backyard Hockey . The Game Logic, AI, menu, and actual executable of Backyard Hockey were all Python, which called in C++ modules for heavy graphics and sound when necessary.

[ LiB ]

Game Programming with Pyton, Lua and Ruby
Game Programming with Pyton, Lua and Ruby
Year: 2005
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net