Game Scripting in Python
This paper was presented at the 2002 Game Developers Conference.
The PowerPoint presentation and the paper in MS Word format can be obtained here.
A sample build script - including e-mailing a simple report on errors - can be found here. Full error parsing still needs to be added.
Watch for more information - including more sample Python scripts - to be posted here in the future.
The updated list of games that use Python is:
Let me know if you have any experiences to share with Python in games, the HAP Debugger for Python, or anything else that seems relevant.
Correction: Terry Reedy pointed out an error in my paper where I overstated the performance implications of using Python. I'll let him explain my error:
This article is one of the best promotional blurbs for Python I have read. Nothing like actual, positive experience truthfully reported without exageration. There is one minor error that might affect your coding (as well as your readers). You wrote
While Python acts as if the second line is true, local variables within functions are currently, as a hidden optimization, looked up by index in a fixed-length hidden array. (Exception: you put something like 'from module import *' within a function so the compiler can't know what the run-time vars are.) Consequently, a particular chunk of code may run faster within a function than at top level. Also, code within a function may run faster by creating a local reference (alias) to global or builtin var or class members. While the effect on a single lookup is too miniscule to worry about routinely, lookups within a large repetition loop may benefit from this trick. Ie,
for i in range(10000): global_var(i)
might usefully be rewritten
local_alias = global_var
Thanks Terry for the correction and the nice comments.
Please contact me if you have any questions. Let me know if you find this information useful.
Bored with reading these technical papers? Go check out my cool fractal exploration program for Win32.