Using Python for Modular Artificial Intelligence code

Jim Meier fatjim at cs333457-a.sshe1.sk.wave.home.com
Sat May 1 07:13:25 EDT 1999


In article <7g94lp$mdu$1 at news.worldonline.nl>, Ilja Heitlager wrote:
>
>Where do you use C++ for anyway? GUI's? Build them in Python, forget C++
>until you are done and than use C++ to speed up critical sections
>
>Ilja
>
>
I'd have to agree there: make the game in Python and only code the
critical parts in c/c++ .. the graphics system(if you have one) and
what have you. I tried doing it the other way (deciding what was 
extensible and then trying to wrap Python around that) and it leads to
poor design and a lot of wasted time.

Not to make myself like an expert (I'm nowhere near!), but I would say
implement the WHOLE thing in python, using a simple wrapper around your
graphics libs, until you have the design for the thing worked out. As an
interpreted language, Python makes iterative design possible - a good 
thing. Then, build Python extensions for the specific parts that need to  
be in c or c++.. this leaves the bulk of your game extendable, without
having to designate it as extendible. A good design will also help you
and your designers experiment with different AI schemes. And don't
forget that if any of those schemes requires a few tight native code
methods, you can dynamically mix them in, even in the field after
distribution.

I have a very basic libGGI wrapper available (actually, I'd be a fair
bit embarrassed about releasing to the public as it is,so ask me to email
if you'ld like to see it) for this very purpose. Audio could be done the
same way.


-Jim Meier




More information about the Python-list mailing list