Python game programming?

Ken Seehof kseehof at neuralintegrator.com
Sun Jan 6 17:52:03 EST 2002


Yes, perhaps it is possible to construct a benchmark example that makes
python appear 700x slower than C, but this is extremely misleading.  In real
applications, python can be almost as fast as C (sometimes faster because
the programmer has more time to think about better design).  I'm not
interested in a language war either, but it is important for people to not
be confused by benchmarks.

I've written plenty of code in both C++ and python, and the python
applications, on the whole, don't seem any slower.

The reason python is essentially just as fast as C is that most CPU time is
actually spent within library calls that are implemented in C, so that the
time spent in the python interpreter is negligible.  Of course, some common
sense is required, and the programmer has to make sure that most of the CPU
is in fact being spent in extension libraries (profiling can be useful
here).  Sometimes it is necessary write some of your code in a python
extension module for speed.

In the case of game design, 3d development is definitely -not- out of the
question, since the rendering is being done by a graphics engine implemented
in C.  In fact, python overhead would be negligible in this case.

On the other hand, I wouldn't want write a 3d renderer in pure python :-),
but the point is, you don't have to.

- Ken

> I'm interested in doing game development with Python, but I'm beginning to
> wonder about the feasibility.  Someone recently posted a real-world
example
> of Python being 700x slower than C, which would obviously be bad for
games.
> I realize that real-time 3d is probably out of the question, but what
about
> a 2d isometric engine like Baldur's Gate or Diablo?  Would it be possible
> to make something like that using PyGame?  If not, which lang should I use
> (I have some experience with C/C++, but I'd have to "refresh" my memory)?
> Would Delphi be a better choice than C/C++ for this sort of thing?  Thanks
> in advance for your time and help.
>
> Jordan
>
> P.S.  I don't want to start a language war.  I'm just looking for personal
> opinions.
> --
> http://mail.python.org/mailman/listinfo/python-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20020106/3ceec061/attachment.html>


More information about the Python-list mailing list