[MUD-Dev] Python script as stand alone MUD server...

Byron Ellacott bje at apnic.net
Thu Jan 29 09:45:44 New Zealand Daylight Time 2004

On Wed, 2004-01-28 at 07:20, Jason Slaughter wrote:

> Am I misunderstanding something, or am I correct in that (from
> your experience) Python is ORDERS OF MAGNITUDE slower than
> compiled code?  YIKES, that doesn't sound good at all!!!

Python is not inherently orders of magnitude slower than fully
compiled code, but that's not to say there aren't certain tasks at
which it will be significantly slower.  It could be that the
particular example in question hit a bad combination of Python
operations in a critical section.  My first step would have been to
profile the Python code, but that could be because I have an intense
disliking of C++ :)

> Hmmm... my second choice was to write the server in C++ for
> Linux... if this is the case, I will probably eliminate scripting
> (and keep it all C++ for simplicity), and just have a huge amount
> of pre-written and easy configurable behaviors that I can attach
> to mobs and objects.

I'll skip the anti C++ advocacy, and note that you can add scripting
to a C or C++ program quite easily by embedding an interpreter
engine. TCL, Python, Perl, Lua, and a host of others all make it
fairly simple to expose data structures and functions to the
scripting environment and evalute blocks of code.

If you are only intending to give scripting access to trusted users,
the problem is quite easy to solve.  Pick your favourite embedded
interpreter, expose the information you need to, and away you go.

It becomes more difficult when you consider levels of trust.  There
should be plenty of material in the MUD-Dev archives regarding
sandboxing and security for scripting languages, which might be a
good place to start.

bje, not speaking for my employer
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list