|
DevelopmentOverview
IntroductionThe goal of this wiki page is to give developers who may be potentially interested in using this MUD framework an overview of how to get it working, and special information needed to develop with it. Getting StartedThe only dependency you need to obtain is Stackless Python.
All other dependencies are already included within the contrib sub-directory. Steps:
Directory StructureThere are three directories under which scripts are located.
The games DirectoryYou might have noticed that there are several subdirectories under the games directory. The framework only uses one of these at a time, and at this time the one used by default is "room - simple", which aims to implement a simple room-based game model. You can read more about how this is configured in the ScriptDirectories wiki page. Creating Your Own GameThis is a matter of simply copying one of the existing subdirectories under the games directory (export it if you are using a checkout of SVN), and modifying bootstrap.py to point to it as described in the ScriptDirectories wiki page. Special namespacesThe code under the games and mudlib directories is managed by a special framework which adds two special features.
The code reloading framework is described in the CodeReloading wiki page. And the way in which code under each directory is mapped to importable namespaces is described in the ScriptDirectories wiki page. import mudlib
class ANewCommand(mudlib.Command):
def Run(self, verb, argString):
pass
import game
class ACustomObject(game.world.Object):
passBuilt-in ObjectsThe MUD framework automatically puts in place special global objects which are available to all game and mudlib code. The sorrows objectThis object provides a direct references to all the services which are running. Some of these may be mudlib services, and the rest will come from your game. if sorrows.users.UserExists("richard"):
print "User richard exists"
commandNames = sorrows.commands.List()
print "There are %d commands available" % len(commandNames)
body = sorrows.world.GetBody("richard")
roomDescription = body.Look()
print "The description of the room richard is in:"
print roomDescriptionServices are automatically inserted into this namespace as they finish starting up. The events objectThis object is a global event handler installed so that low-level events can be sent and received in an easy and natural way. You can read about how to use it in the SimpleEvents wiki page. But avoid using it for game events, as it is not suited for that purpose. events.UserLogin("richard")Note that because this framework is based around code reloading, it is best that event registration is done by the code reloading system automatically. This is described in the linked wiki page. |