Python suitable for a game engine?

Alan Daniels daniels at mindspring.com
Wed Jun 30 23:55:35 EDT 1999


I'm working on a Quake-style game engine, where my goal is to give it
a fully integrated editor, similar to the excellent ones in Starcraft
and Unreal. I'm planning on doing this by giving the game and the
editor as much back-end code in common as possible.

What I want to do is be able to design the level in the editor, and
then sprinkle objects and monsters around the level. All of these will
have default low-level behaviors, so that level designers don't have
to do monster AI from scratch. However, all the objects and monsters
will have simple properties manipulated through a property list,
similar to that in VB. This way, they can set properties such as, is
the monster aggressive or passive, etc.

Here's the thing. I want to have a script as its main property, so that
the monsters can have elaborate behaviors, such as being mournful when
their leader is killed, etc. The events would be things such as
"create", "monster sees player", "clock tick", etc. All the functions
in the script would be callbacks written in C++, to manipulate the
monster to do things such as "patrol area", "play an animation",
"sleep for X seconds", etc. In other words, the scripts would be glue,
not the main thread of execution.

I'm been using Python for a couple of years now, and it is my favorite
scripting language. But, I don't have much experience with embedding
it in a another program, and I don't know enough about the speed
issues. So, my questions are...

- Will Python be fast enough? Even with possibly 100 or 200 active
  items on a level?
- Especially when all of the scripts will be live, and usually in the
  middle of a callback?
- Should I use the interpreter in the library, or should I take an
  approach of crunching the byte-codes myself?

I've seen plenty of cases where Python is used as a "VBA" style
embedded language (load up the script, run it, and be done with it),
but I haven't seen anything like this mentioned before. My other two
candidate languages are Scheme and Perl, and I hate the syntax of
both. So I really REALLY want to use Python if its viable. :=) If
anybody can shed some light on this, I'd appreciate it. Thanks.

-- 
=======================
Alan Daniels
daniels at mindspring.com
daniels at cc.gatech.edu




More information about the Python-list mailing list