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

Sean Middleditch elanthis at awesomeplay.com
Tue Jan 27 21:26:39 CET 2004

On Tue, 2004-01-27 at 16:20 -0500, Jason Slaughter wrote:
> Alistair Riddoch <alriddoch at zepler.org> wrote:

>> Performance was a big problem. As I got involved in development,
>> it quickly became apparent that we were going to need to do some
>> serious work if we were going to scale beyond a dozen or so mobs
>> and players per server.  I started to look at approaches to solve
>> this, and immediately looked at compiled code as the solution. I
>> am not an expert Python programmer, but the majority of the code
>> had been written by another developer who is very experienced,
>> and I had no reason to believe that the performance was due to
>> bad coding. I investigated and experimented with a few
>> approaches, including implementing performance critical
>> components as compiled Python modules, and finally settled on
>> re-writing the core of the application in C++, and keeping the
>> high level code as scripts.

> Where you doing something extremely elaborate with the mob AI? Or
> was there some overhead because WorldForge (as I understand it) is
> a 3D graphic game? Or is Python performance really that bad? I
> remember playing a mud (a DIKU mud I believe) back in the day
> running on and old 486 machine with 16 megs memory. It seemed to
> handle 50+ players and n number of mobs without a hitch. Even my
> Xbox can handle more than 16 mobs or players in a full 3D online
> action game! :)

> 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 isn't the fastest language around, altho it should be more
than good enough for something like a MUD if you code it properly.

Probably the place it'll show up the worst is in math intensive
code, because each math instruction in Python code turns in dozens
and dozens of machine instructions as the VM interprets the byte
code.  Or any tight loops that are run many times per "frame" (altho
these usually indicate piss poor design outside of a few specialized
use cases).

If speed is a true issue, there is Psyco, which compiles Python code
to machine code.  I'm told it can have huge increases in speed, tho
I've no personal experience with it.


As to the poster who commented that Python wasn't capable of
handling more than 12 mobs/players per server - your Python coder is
clearly incompetent, no matter what you or he thinks.  Python server
applications exist that handle loads no production MUD server would
dream of handling today.

Sean Middleditch <elanthis at awesomeplay.com>
AwesomePlay Productions, Inc.
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the mud-dev-archive mailing list