Phython as In-Game scripting language

Ken Seehof kens at sightreader.com
Sun Feb 27 17:48:49 EST 2000


Since you are talking about a real-time game, I'd say it would not be wise
to run a python script for every object on every frame.  A better approach
might be to use python to decribe -change- in behavior in response to -events-.

In any case, you'll probably want to keep python out of your inner loops.
How to do this depends very much on what kind of game you are writing,
but I'm sure there's a way to get the results you want (there always is).

It's faster to call C from Python than Python from C.  The important point
is that if you keep Python outside of your inner loops, you won't have a
performance problem.  If you are calling Python from C, your architecture
is probably inside out.

Write me as you get further along.  I'm developing a Neural Net IDE called
"Neural Integrator" (NI).  It might be fun to see if some AI would make your
bad guys more interesting.  Also, behaviors can be described graphically with
NI with it's visual editor.  And best of all, the front end is in python, but
the
engine is in C, so there is almost no perfomance cost at runtime.

- Ken Seehof
kens at sightreader.com


Shawn LeBlanc wrote:

> Greetings!
>
> Being totally new to Python and completely honest in saying that
> I have no idea of what I'm doing, I had a few questions.
>
> My team and I are thinking about embedding Python into our
> game engine on the Windows platform. The basic idea would be that the
> major entities, including enemies, would have a script attached to
> them to control behavior. This would allow the level/content designers
> to concentrate more on the game design side of things, since
> behaviors would be outside of the main game engine. Is it
> possible to have multiple scripts running at the same time?
> Would this involve creating multiple interpreter objects? According
> to the docs, this is possible but it isn't totally safe to do.
> What would be a good strategy for this?
>
> My other question was one of performance. Is it crazy to have
> ~10 different objects with each an individual script and hoping
> the game will be running at 30 frames per second? The question might not be
> valid, since I'm not sure how to implement it in the first
> place.
>
> And lastly, is it faster to call C functions in Python or vice-versa?
>
> with milk and cookies,
> Shawn
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com






More information about the Python-list mailing list