Phython as In-Game scripting language

Jeff Petkau jpet at eskimo.com
Wed Mar 1 09:43:57 CET 2000


> > Shawn LeBlanc <wrlddomprod at hotmail.com> wrote:
> > As a slightly off topic question, which other languages like
> > Python could be embedded efficently in a game project? I've
> > seen that several games use Lua (Grim Fandango), and there's
> > got to be other games that use embedded languages. What
> > would be the advantages and disadvantages of using Python
> > in a game?
>
> IIRC, the first-person shooter set in the Star Wars universe (the name
> escapes me - Dark Forces?), uses internal scripting extensively.

A couple of years ago I was working on a commercial RPG
where we tried using Python for the script language. Eventually
we switched to Java for a couple of reasons. My experiences:

* Python was very easy to integrate with C/C++, which is a big
deal for game coding. Java was a pain. [And Scheme is both
slow and painful, and I really wish I didn't have to use it on
my Visor 'cause it's really hard to write a closing paren in Graffiti,
it always comes out as a question mark. Um, where was I...]

* Java is pretty fast, so we were able to do almost everything in
it, and only had to go to C++ for collision detection and rendering.
Python is pretty slow; it would be best to limit it to scripting the
high-level actor behavior.

Incidentally, if stackless Python or microthreads had existed
back then, we probably would have stuck with Python. I'm still
waiting for the day when there will be a programming language
as good for describing actors and state machines as Simula was
25 years ago. (Scheme has the language power but was disqualified
when a blood test found high levels of parentheses.)

I actually considered implementing continuations in Python, but
then we switched to Java so I implemented them there instead.
One of my silliest experiments ever.

--Jeff


ps. We switched to Java for three reasons:
- Speed

- We wanted to standardize on a language internally, across some
  other projects, and the other projects didn't like Python because
  of the whitespace thing.

- I really wanted something like microthreads, and implementing them
  in Java as a .class file postprocessor seemed like a nifty project.

pps. Eventually the game got cancelled, no doubt because I
spent too much time fooling with script languages instead
of actually making a game. Sigh.

I'll stop rambling now.






More information about the Python-list mailing list