Python suitable for a game engine?

Nick Trout nick at NOSPAMvideosystem.co.uk
Tue Jul 6 13:18:57 EDT 1999


>I had a quick look, but not the time to check it completely.
>Does it have coroutines or small threads to do very
>quick context switches? This is something which
>Python will be able to do very fast, soon. You can have
>thousands of current contexts and switch them in no time.
>This can simplify the implementation of games in a scale,
>that the speed penalty might be compensated by that.
>Well, we have to try...

You don't need a proper threaded system to do game AI. Every object just get
s X ticks each frame. This is maybe getting a bit off topic. A context switc
h can be as quick as changing a global pointer to the new current context. I
think Unreal works as you explain, running lots of objects in parallel. When
you create a new "live" object it spawns a new "thread". Essentially this is
just a list of objects that have a member function tick() which gets called
every frame. Please correct me if I'm wrong.

The way I'd look at is: which languages are suitable ie. can do what you wan
t, can be embedded conveniently. And for games, which is fastest and most co
mpact?!! Lua and Python can do what you want and can be embedded but Pythons
byte code execution is slower than Lua's by about 50% or more and its a lot
smaller. Python is streets ahead for writing tools/parsers/simple utils with
a GUI. Although you can do all that in Lua as well!

I'm interested in your ideas. I have thought about doing similar things. I c
ame to the conclusion that Lua was more suitable for embedding in a game. Pe
rhaps you could elaborate on your ideas.

N







More information about the Python-list mailing list