im looking for a python mud game example which i could see the coding and make my own mud, the thing is that im very new to mud if i was able to see an example of a game working then i would be able to understand what coding classes etc... are used.
even if anyone knows any totorials plz let me know.


Recommended Answers

Mud as in MultiUser Dungeon?

Jump to Post

haha, it's quite a coincident. I'm actually developing a text adventure game engine.

This is what I got when I searched:

Jump to Post

All 6 Replies

Mud as in MultiUser Dungeon?

yes in python no other programming language

i want to learn how to make mud for improving my game code skill, so if you get any interest game, plz let me know, thx a lot

and i can give a hand if you need

Start with the basics, because muds get very complicated.
You can't expect to make one without a lot of experience it a broad range of coding topics.

I already post this elsewhere, I have coded (and still coding) a skeleton for the different classes and functions.

It is based off this extremely simpliefied version of it.

If you want to help, send me a PM and we can talk about it.

end = False

class Room(object):
    def __init__(self, name, description, north=None, east=None, south=None, west=None, up=None, down=None): = name
        self.description = description
        self.north = north
        self.east = east
        self.south = south
        self.west = west

    def __str__(self):
        return self.description

class Player(object):
    def __init__(self, name, currentRoom=None): = name
        self.currentRoom = currentRoom

    def go(self, direction):
        direction = direction.lower()
        directiontxt = "self.currentRoom."+direction
            if eval(directiontxt) == None:
                print "You cannot go " + direction + "."
                self.currentRoom = eval(directiontxt)
                print self.currentRoom
        except AttributeError:
            print "The direction you are going does not exist. Try harder next time!"

class Game(object):
    def __init__(self, name, player): = name
        self.player = player
        print player.currentRoom
        while end == False:
            cmd = raw_input(">> ")

    def process(self, cmd):
        global end
        cmdlist = cmd.split()
        if len(cmdlist) == 1:
            cmdtxt = "self.player." + cmdlist[0] + "()"
        elif len(cmdlist) == 2:
            cmdtxt = "self.player." + cmdlist[0] + "('" + cmdlist[1] + "')"
            print "You can only have a maximum 2 words for your command. Type 'help' for detail."

def main():    
    # This is a map of the proof of concept.
    # +-----+-----+-----+
    # |     |     |     |
    # |room1|room2|room3|
    # |     |    |     |
    # +-----+-----+-----+
    # |     |     |     |
    # |room4|room5|room6|
    # |     |     |     |
    # +-----+-----+-----+
    # |     |     |     |
    # |room7|room8|room9|
    # |     |     |     |
    # +-----+-----+-----+
    room1 = Room(name="room1", description="You're in room1")
    room2 = Room(name="room2", description="You're in room2")
    room3 = Room(name="room3", description="You're in room3")
    room4 = Room(name="room4", description="You're in room4")
    room5 = Room(name="room5", description="You're in room5")
    room6 = Room(name="room6", description="You're in room6")
    room7 = Room(name="room8", description="You're in room7")
    room8 = Room(name="room7", description="You're in room8")
    room9 = Room(name="room9", description="You're in room9")
    room10 = Room(name="room10", description="You're in room10")

    room1.south = room4
    room1.east = room2

    room2.south = room5
    room2.west = room1
    room2.east = room3

    room3.south = room6
    room3.west = room2

    room4.north = room1
    room4.east = room5
    room4.south = room7

    room5.north = room2
    room5.east = room6
    room5.south = room8
    room5.west = room4
    room5.down = room10

    room6.north = room3
    room6.south = room9
    room6.west = room5

    room7.north = room4
    room7.east = room8

    room8.north = room5
    room8.east = room9
    room8.west = room7

    room10.up = room5
    room9.north = room6
    room9.west = room8
    adventurer=Player(name="Adventurer", currentRoom=room5)
    game = Game(name="Proof of Concept", player=adventurer)

if __name__ == "__main__":
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.