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.

thanks

Dani AI

Generated

Brief thread summary and practical next steps based on the posts from , , and .

The snippet posted is a useful minimal proof-of-concept for a local text engine (Room/Player + a main loop), but it also shows common beginner pitfalls: use of eval, global loop state, and mixing I/O with game logic. Those make extension, testing and networking harder. A safer progression is: keep the single-process engine until core systems (world model, command parser, inventory/NPC rules) are stable, then add a network layer. This follows ’s point that MUDs get complex — build one feature at a time and write small tests for each system.

Concrete development path (starter -> networked MUD):

  • Replace ad-hoc direction strings/eval with a clear exits structure and a command-dispatch layer; separate parsing from action execution.
  • Add persistence (start with SQLite or a simple JSON save) so rooms/characters survive restarts.
  • Replace blocking input loops with a network-friendly interface before adding multiple players.
  • Add telnet/MUD negotiation and session handling last, after game logic works locally.

Networking/tooling recommendations:

  • Twisted is a mature event-driven networking framework often used for telnet/SSH servers and can save a lot of low-level socket work. (twisted.org)
  • For an asyncio-based approach, telnetlib3 provides a telnet server/client foundation built on asyncio. (telnetlib3.readthedocs.io)
  • Libraries like mudtelnet help handle MUD-specific telnet negotiation (NAWS, MCCP, MXP, etc.) so the server works smoothly with traditional MUD clients. (pypi.org)

If the goal is a working multi-user server instead of building everything from scratch, consider a modern Python MUD framework that already handles networking, persistence and a web client; Evennia is a full-featured option with tutorials and an active community. (evennia.com)

Final notes: avoid eval (security and maintainability), keep I/O out of core logic, use version control and small commits, and iterate—start tiny and expand.

Recommended Answers

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):
        self.name = 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):
        self.name = name
        self.currentRoom = currentRoom

    def go(self, direction):
        direction = direction.lower()
        directiontxt = "self.currentRoom."+direction
        try:
            if eval(directiontxt) == None:
                print "You cannot go " + direction + "."
            else:
                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):
        self.name = name
        self.player = player
        print player.currentRoom
        while end == False:
            cmd = raw_input(">> ")
            self.process(cmd)

    
    def process(self, cmd):
        global end
        cmdlist = cmd.split()
        if len(cmdlist) == 1:
            cmdtxt = "self.player." + cmdlist[0] + "()"
            eval(cmdtxt)
        elif len(cmdlist) == 2:
            cmdtxt = "self.player." + cmdlist[0] + "('" + cmdlist[1] + "')"
            eval(cmdtxt)
        else:
            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__":
    main()
Be a part of the DaniWeb community

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