[crossfire] (Python)

Brendan Lally brenlally at gmail.com
Tue Oct 11 08:55:56 CDT 2005


On 10/11/05, Mark Wedel <
     mwedel at sonic.net
     > wrote:
>
     
     >
        But all this doesn't really answer the question - when should something be in
     >
      python, and when should it be coded in C?
     
To my way of thinking about it, python is something that should for
the most part be tied to maps or objects. If an object needs to do
something special then python is flexible way to have it act in a way
that is unique without needing to add special cases to the server code
all over the place. This would for example include moving grim reapers
out to a python plugin (though there may be performance issues there)

If something doesn't have a particular tie to a single map or item,
then the server core seems a more sensible place for it, since many
things could make use of it.

This would mean that whereas the 'charm monster' spell could be done
in python (but probably shouldn't because it is already working in C,
and porting it would just be a way to introduce bugs), fire spells
shouldn't be because there are lots of them, all of which rely fire
propagating as it normally does - having the server deal with the fire
propagation is far more sensible because more than 1 object (spell in
this case) uses it.

The only other consideration is speed, python is slower than C to run,
although the number of times this matters is limited.

    


More information about the crossfire mailing list