[Tutor] Implementing a MUD engine from scratch
Christer Enfors
enfors at enfors.net
Wed Dec 13 15:26:26 CET 2006
I'm new to Python, but I've been programming other languages for over 15
years. Now, I've decided that I want to code my own MUD engine from
scratch in Python. A MUD is a bit like a MMORPG (like World of
Warcraft), only it uses text instead of graphics. A MUD is the graphical
MMORPGs what books are to movies. A MUD acts like a telnet server - you
use telnet to connect and play. This makes it very easy to try new MUDs;
unlike graphical MMORPGs, you don't need specific client software for
each MUD. MUDs are also typically free to play.
To explain more clearly just what it is I want to create, I have to
explain where I'm coming from. For the past 12 years, I've been playing
on, and coding with, an existing MUD engine called LPMUD. The LPMUD
engine itself is coded in C, but it implements a interpreted language
called LPC. Once you've telnetted to an LPMUD, you can create monsters,
areas, powers, quests, etc by writing LPC programs. LPC programs can be
written and edited while the LPMUD is online, so there is no need to
restart an LPMUD (and thus disconnect all players) to fix coding errors
or add new game content. LPC is also inherently sandboxed, so a
malevolent coder can't affect filesystems outside of the dedicated LPMUD
directory, and so on.
I want to make something similar in Python. Like I said, the LPMUD
engine is coded in C, but uses the LPC language to create the actual
game content. I my case, Python will be used for both purposes.
Now on to my actual questions:
1) I want to be able to update parts of the code (the game content)
while the MUD (the engine) is running. Errors in the game shouldn't stop
the entire MUD - I guess I should use exceptions for this? Any pointers
as to where I should begin to research how to accomplish this? I'm
guessing that perhaps IDLE could be worth a look (since it is a Python
program that allows you to edit and run Python programs inside it).
2) Would it be realistically possible to sandbox my MUD, so that
arbitrary Python programs (written by appointed MUD staff) can't affect
the hosting machine?
Thanks in advance.
--
Christer Enfors
More information about the Tutor
mailing list