Maintainer: LimpingNinja (Kevin Morgan)
Welcome to the heart of your MUD! The lib directory is where all your game content lives - from the Python scripts that define how your world behaves, to the rooms and creatures that populate it. Think of it as your MUD's content management system, all organized in a friendly, logical structure.
- Overview
- Python Game Logic (pymodules)
- World Data
- Help System
- Player Data
- Configuration
- Getting Started
The lib directory contains everything that makes your MUD unique. While the C code in src provides the engine, the lib directory contains the game itself. Here's what you'll find:
lib/
├── pymodules/ # Python game logic and commands
├── world/ # Zones, rooms, objects, and NPCs
├── help/ # In-game help system
├── accounts/ # Player account data
├── players/ # Character save files
├── txt/ # Text files (greeting, motd, etc.)
├── logs/ # Game logs
├── misc/ # Miscellaneous data
└── muddata # Main configuration file
This is where the magic happens! The pymodules directory contains all the Python scripts that define how your MUD works. Think of these as the "rules" of your game world.
Command Modules:
cmd_admin.py- Administrative commands (shutdown, copyover, etc.)cmd_comm.py- Communication commands (say, tell, chat)cmd_manip.py- Object manipulation (get, drop, wear, wield)cmd_misc.py- Miscellaneous utility commandscmd_inform.py- Information commands (look, inventory, who)
Game Systems:
account_handler.py- Login and account managementchar_gen.py- Character creation processmovement.py- How characters move between roomsinform.py- Message formatting and displaydisplay.py- Screen formatting and layoutcolour.py- Color code processing
Utilities:
utils.py- Common utility functionsroutine.py- Scheduled events and maintenancepath.py- Pathfinding algorithmshistory.py- Command history tracking
Here's the beautiful part: you can modify any of these files to change how your MUD works! Want to add a new command? Create a new function in the appropriate cmd_*.py file. Want to change how movement works? Edit movement.py. The Python integration makes customization incredibly flexible.
The __restricted_builtin*.py files handle Python security - they control what Python functions are available to scripts. Be careful when modifying these unless you really know what you're doing!
The world directory contains all your game content - the actual "stuff" players interact with. This is typically created using NakedMud's built-in Online Creation (OLC) system rather than hand-editing files.
Each zone (area) in your MUD gets its own directory under world/zones/:
world/zones/examples/
├── zone # Zone configuration and metadata
├── rproto/ # Room prototypes
├── mproto/ # Mobile (NPC) prototypes
├── oproto/ # Object prototypes
├── reset/ # Reset scripts (what spawns where)
└── trigger/ # Trigger scripts (special behaviors)
Room Prototypes (rproto/):
- Define the rooms in your world
- Include descriptions, exits, and special properties
- Example:
tavern_entrancemight be a cozy inn room
Mobile Prototypes (mproto/):
- Define NPCs (Non-Player Characters)
- Include appearance, stats, and behaviors
- Example:
gruff_manmight be a surly bartender
Object Prototypes (oproto/):
- Define items players can interact with
- Include weapons, armor, furniture, quest items
- Example:
rusty_swordorhealing_potion
Instead of hand-editing these files, you'll typically use in-game commands:
redit- Edit roomsmedit- Edit mobiles/NPCsoedit- Edit objectszedit- Edit zonestedit- Edit triggers
These commands create a user-friendly interface for building your world. The OLC system generates the prototype files automatically, maintaining proper formatting and structure.
The help directory uses an alphabetical filing system - help files are organized by their first letter:
help/
├── A/ # Help files starting with 'A'
├── B/ # Help files starting with 'B'
├── C/ # Help files starting with 'C'
└── ...
Each help file contains:
- Keywords: What players type to access the help
- Content: The actual help text
- Formatting: Uses MUD color codes for readability
Players access help with commands like help movement or help commands.
Accounts (accounts/):
- Player account information
- Login credentials and account settings
- One account can have multiple characters
Characters (players/):
- Individual character save files
- Stats, inventory, location, and progress
- Created when players make new characters
Important: These directories are automatically managed by the MUD. You typically don't need to edit these files manually.
muddata File:
The main configuration file that controls:
- Starting room for new players
- Server port and basic settings
- World file paths
- Player UID counter (puid)
Text Files (txt/):
greeting- What players see when they connectmotd- Message of the day- Other informational text
- Start with OLC: Use the in-game building commands rather than editing files directly
- Explore Examples: Look at the
exampleszone to see how things work - Read Help Files: Use
help buildingandhelp olcin-game - Start Small: Create a simple room or two before building complex areas
- Study pymodules: Look at existing command files to understand the patterns
- Test Safely: Make backups before modifying core game logic
- Use the Python API: NakedMud provides extensive Python bindings for game objects
- Check Documentation: See
doc/nakedmud_python.mdfor Python scripting details
- Backup Everything: Especially before major changes
- Test Incrementally: Make small changes and test them
- Use Version Control: Git is your friend for tracking changes
- Document Custom Changes: Leave comments for future you (and others)
Here's how it all works together:
- Player connects →
account_handler.pymanages login - Player types command → Appropriate
cmd_*.pyfile processes it - Command affects world → Changes saved to
world/files - Player needs help → System looks up files in
help/ - Player logs out → Character saved to
players/
The beauty of NakedMud's library system is its flexibility. You can:
- Modify existing systems by editing Python modules
- Create new content using the OLC system
- Add custom commands with just a few lines of Python
- Build complex worlds without touching C code
Remember: the lib directory is your creative space. The C engine provides the foundation, but everything in lib is where you make your MUD unique and special.
Don't be afraid to experiment! With good backups, you can try new ideas and see what works. The Python integration makes it easy to add features, and the OLC system makes world-building accessible to non-programmers.
Happy building, and welcome to the wonderful world of MUD creation!