Python in game development?

Martijn Faassen m.faassen at vet.uu.nl
Wed Jul 19 11:52:59 EDT 2000


In comp.lang.python Newsgroup <newsgroup at neutron.globalnet.co.uk> wrote:
>> In the Open Source Crystal Space 3D engine we are working on a framework
> for python
>> scripting. It is already working reasonably well but you cannot yet do
> everything
>> that you'd want to do from a python script.

> Can anybody explain what you actually do to attach the python, or any other
> general purpose scripting language, to your game?

Sure, for Python the documentation is here:

http://www.python.org/doc/current/ext/ext.html
http://www.python.org/doc/current/api/api.html

Be sure to check out stackless Python, which has some advantages for
game scripting:

http://www.stackless.com/

> I'm making a game with a
> scripted engine and I have to write my own compiler to convert scripts into
> a length of integers and a virtual machine to convert it into game logic.
> Does python produce it's own compiled code and you then have to write a
> virtual machine based on this output?

Hm, Python produces its own compiled code (virtual machine instructions),
and Python includes a virtual machine. You just hook Python into your
game.

You also need to give your game a Python API
(a bunch of C wrappers; there are tools like Swig which can do this
automatically, though it isn't so hard to do by hand and is described
in the above documentation):

http://www.swig.org/

So no, you don't have to do all that; Python already includes a compiler
and interpreter that can be embedded into your game.

Regards,

Martijn
--
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list