BizMUD 0.1 Intro: - Written by Thyrr for PizzaParty's 32k MUD competition, Sept. 2005 - Free to use as long as you give credit in the source code and in the game. Requirements: - Python 2.4. May not work with 2.5 and beyond, whenever those are released. - Python is available from http://www.python.org - Make sure the "players/" directory is present. - A MUD/telnet client is probably a good idea ;) - The MUD assumes you have at least basic VT100/ANSI color support. Getting started: - python mud.py - telnet to localhost port 8500 Important notes: - Binds to all interfaces at port 8500 by default. - Any player connected from 127.0.0.1 can toggle admin status with "xyzzy". - Admins can toggle the admin status of any other player in the same room. - So be careful with reverse proxies, SSH tunnels, etc. Byte counts: - *.py 29108 (see methology below) - data.gz 1776 - socials.txt.gz 298 - help.txt.gz 941 - Total 32123 (under the limit of 32768) Source counting method: - See Erwin Andreasen's 16k.py script. Comments, blank lines, and trailing blanks are removed, indents of four spaces are converted to one tab. Options used: -h -b -p (see http://www.andreasen.org/16k) File size: 40296 bytes Lines: 1432 \r stripped: 40296 # removed: 34308 blank lines stripped: 33447 spaces to tabs: 29124 duplicate blanks stripped: 29108 Final result: 29108 Game Features: - Lope-style color codes, e.g. {R for red, {r for darker red - Player saving/loading - Persistent world that preserves NPCs and objects across shutdown/reboot - Socials (smile, laugh, scold, etc.) - A "combat" "system" with physical and social attacks (see "help combat") - Customizable prompt (e.g. type "prompt <$hp/$hpm $cash>") - Basic inventory system with get/drop/give/inv - Wearable clothing for the fashion-conscious. Look your best in battle! - Parser handles quotes and indexing ("give 'green tea 3' 'sugar daddy'") - Basic room building with string editor interface for rdesc - Players can rent property to gain room desc editing rights and run shops - Shops sell drinks with different "flavors" that can be combined - NPCs buy drinks from shops according to personal tastes which adapt to new flavors over time. - Basic AI allows NPCs to flock to shops with the best prices that also suit their preferences. Not implemented due to lack of time/space: - NPC/obj/flavor editing/creation. - Businesses beyond beverages, like pizza, ice cream, clothing, bowling. - (And limit "flavors" -- a chocolate shirt is weird, but polyester is fine). - More interesting competition, e.g. monopolies, mafia, advertising. - Limited NPC knowledge. Right now they're almost omniscient consumers. - Ability to transfer cash between players. - Different effects for each combat social. - Different costs for various flavors/ingredients. - Runtime efficiency. - Penguins. Known problems: - No penalty for falling behind on rent. - Bug: does not handle two connections creating players with the same name. - Players always load into the starting room. - Persistence is fairly fragile. And unconnected rooms will not be saved. - All player-run shops sell drinks. Thus you can have a "cherry apartment." - Lots of other gameplay issues. - NPCs are stupid. - No penguins. Admin commands: - xyzzy [victim]: become admin or make someone an admin - frotz: misc commands, currently $ (get cash) and wsave (world save) - goto <thing>: goes to the room containing any named object/actor/room - lease: modify rent and ownership - rdig <dir>: creates a new room in a particular direction - rlink <dir> <dest>: links an exit on both sides. <dest> is a room name. Using "none" for <dest> unlinks one side. - creload: reloads cmd.py from source - shutdown: does a clean shutdown (does a world save / player save as well) Reading the code: - Unlike in C, "if x: print 1; print 2" on one line is not a coding pitfall. - Common abbreviations: - S = self - t = text - l = line/text (often suffixed e.g. 'lv' for the name of a victim) - v = victim or viewer - c = connection - p = player - a = actor - r = room - f = file or function - any of the above suffixed with 's' for a list/tuple/iter of that type - pro = prompt - NL = newline ("\r\n") - Command to replace S with self in most cases: (for non-judges) sed -ie "s/\([^\"_'[:alnum:]]\)S\([^_'\"[:alnum:]]\|$\)/\1self\2/g" *.py - Yes, I used 'self' when writing this code and auto-replaced it later. Changes since 0.1: - Now auto-saves on quit - Disconnect now auto-quits - NPCs no longer visit out-of-stock shops - Shops now give sales revenue to the owner hourly - All shops should be restocked now - Logging in as an online player disconnects the old connection - Changed cost of restocking - Fixed throwing during a fight