Python suitable for a game engine?

Alex Maranda amaranda at nospam.com
Thu Jul 1 10:41:27 EDT 1999


> 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.
you use confusing terms; I understand what you're saying, but you
shouldn't use the word 'thread' for anything else than its OS meaning.
You could say the 'the bulk of processing'. You might very well end up
using real Python threads; don't forget in this case to release/reaquire
the global interpreter lock in your C++ callbacks, if you make blocking
syscalls (unlikely in a game).

> 
> 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?
Unlikely. You won't know until you try. To my knowledge UnrealScript is
eventually translated to C++.

> - 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?
??

Cheers,
-- 
Alex Maranda         mailto: amaranda at spider dot com
Spider Software Ltd. Tel: +44 (0)131 4757036
Edinburgh, UK        http://members.xoom.com/Alex_Maranda
STREAMS based communications protocols for embedded systems




More information about the Python-list mailing list