Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUDs ➜ General ➜ A book on programming a mud?

A book on programming a mud?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nick Cash   USA  (626 posts)  Bio
Date Sun 07 Nov 2004 06:39 AM (UTC)
Message
I was scanning through the books at gamedev.com (a great source for several things, i suggest you all take a look if you don't already) and I saw this:

http://www.gamedev.net/columns/books/bookdetails.asp?productid=317

Mud Game Programming by Ron Penton:
MUD applies to the genre of games that are designed to be multi-player communities. To create todays ultra-popular MMORPG’s, a solid background in MUD programming is necessary. "MUD Game Programming" teaches you everything you need to know about the protocols needed and concepts used for all sorts of multi-user-dungeon games. While this book is aimed at those who want to learn the basics of client-server based "dungeon" games, it is not limited specifically to a medieval theme. It includes coverage of basic networking, layered protocol format for the internet, text MUD concepts, graphical MUD concepts, and more.

Who woulda thought? I may just have to take a look at this book :P

~Nick Cash
http://www.nick-cash.com
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 07 Nov 2004 07:43 PM (UTC)

Amended on Sun 07 Nov 2004 08:17 PM (UTC) by Nick Gammon

Message
I bought that book a few months ago so I can tell you a bit about it. My jaw dropped when browsing through the local bookshop when I found a book about the very thing I was very interested in. :)

The book is about 666 pages with a CDROM at the back with the example code in it, including two MUD servers in source and executable form (executable for Windows).

The examples are written in C++, and use STL (the Standard Template Library) later on in the book for such things as list management (very wisely IMHO).

The example code supplied compiles (he says) on MS Visual C++ 6.0, MS Visual C++ 7.0 and gcc 2.95 and above.




Part 1 - the basics

Part 1 of the book introduces you to the basics of programming servers in general:


  • Network programming (some history, and a description of TCP and UDP)

  • Sockets programming - creating sockets, listening etc.

  • Multithreading

  • A basic library - numbers, strings, logging

  • A socket library





Part 2 - a Simple MUD

(Starting at page 191)

This describes making a simple MUD with the basic things you would expect.



  • Players, HP, attack, defense, experience

  • Inventory and objects

  • Rooms and exits - however each room has a maximum of four exits (north, south, east, west)

  • Shops

  • Training

  • Commands. Examples are: attack, drop, help, north, east, south, west, quit, who, use, remove, chat, whisper, say, inventory, stats, experience, time, look

  • Saving and loading things (like rooms)

  • Logon states (eg. ask name, password)

  • Game loop, fighting



You can compile and play with this, see the next post in the thread for an example of what the output looks like.




Part 3 - a better MUD

(Starting at page 355)

In this part the author basically expands his MUD design to add features more like an existing MUD, such as:



  • Regions (areas)

  • Portals (more sophisticated exits)

  • Accounts

  • Containers

  • Conditions (effects) like being on fire for a while

  • Scripting - using Python as a script language he adds scripted events (similar in concept to SMAUG mob progs). There is a lengthy discussion of Python in general, and the scripting interface in this game in particular.

  • Economy discussion


Python is supplied on the attached CDROM. A bit further down in this thread is an example of the output from this Better MUD.




Licences

The code he supplies appears to be free to use for your own MUD. He says "You're free to take them and modify them however you wish, and run them on your own".

His "Better" MUD seems to be very expandable, with its scripting and various database files. I haven't explored the source files in great detail.

Conclusion

If you are a beginner or intermediate coder you will find the material in this book very interesting. Unlike picking up something like SMAUG and trying to nut out how it works directly from the source, he explains in some detail about a lot of the design decisions.

The addition of scripting into the BetterMUD from the start means it is more central to the design than in SMAUG, where it looks more like an add-on.

You could use this book in a number of ways:


  • General information about how MUDs are written

  • Ideas for improving an existing MUD

  • Use his code directly for a new MUD, and expand on it.


The section in Python alone is quite interesting, including some C++ wrappers he wrote for interfacing Python scripts with a C++ program.

Also, even an experienced coder might want to take the code for his BetterMUD and simply make a new MUD from scratch, rather than making "another Diku MUD".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #2 on Sun 07 Nov 2004 07:44 PM (UTC)
Message

Example of the Simple MUD from his book...


Welcome To SimpleMUD v1.0
Please enter your name, or "new" if you are new: 
nick
Welcome, nick
Please enter your password: 
nick
Thank you! You are now entering the realm...
Nick has entered the realm.
[14/14] 
Town Square
You are in the town square. This is the central meeting place for the realm.
exits: NORTH  EAST  SOUTH  WEST  
People: Nick

[14/14] 
n
You walk NORTH.
[14/14] 
Street
You are in a small street. Litter is strewn about, and you see rats crawling in
 and out of the sewer grating.
exits: NORTH  EAST  SOUTH  WEST  
People: Nick

[14/14] 
s
You walk SOUTH.
[14/14] 
Town Square
You are in the town square. This is the central meeting place for the realm.
exits: NORTH  EAST  SOUTH  WEST  
People: Nick

[14/14] 
e
You walk EAST.
[14/14] 
Avenue
You're on an avenue running through the town.
exits: EAST  SOUTH  WEST  
People: Nick

[14/14] 
e
You walk EAST.
[14/14] 
Avenue
You're on an avenue running through the town.
exits: EAST  WEST  
People: Nick
Enemies: Vagrant

[14/14] Vagrant hits Nick for 3 damage!
[11/14] Vagrant hits Nick for 1 damage!
[10/14] Vagrant hits Nick for 3 damage!
[7/14] Vagrant swings at Nick but misses!
[7/14] Vagrant hits Nick for 2 damage!
[5/14] Vagrant swings at Nick but misses!
[5/14] 
attack vagrant
You don't see that here!
[5/14] Vagrant hits Nick for 3 damage!
[2/14] Vagrant swings at Nick but misses!
[2/14] Vagrant hits Nick for 2 damage!
[0/14] Nick has died!
[0/14] You have died, but have been ressurected in Town Square
[9/14] You have lost 0 experience!
[9/14] Nick appears out of nowhere!!
[9/14] [11/14] 

w
You walk WEST.
[11/14] 
Alley
You're in a dark alley, where shadows obscure your view and hide dangerous
 things...
exits: EAST  SOUTH  WEST  
People: Nick
Enemies: Rabid Monkey

[11/14] Rabid Monkey hits Nick for 2 damage!
[9/14] 
w
You walk WEST.
[9/14] 
Narrow Alley
You're in a dark alley, where shadows obscure your view and hide dangerous
 things...
exits: EAST  WEST  
People: Nick
Enemies: Thug

[9/14] Thug hits Nick for 4 damage!
[5/14] Thug swings at Nick but misses!
[5/14] 
w
You walk WEST.
[5/14] 
Alley Junction
You're at a junction in the alley; it's barely visible here, but you can make
 out some small cages lying on the floor.
exits: NORTH  EAST  SOUTH  
People: Nick
Enemies: Monkey Trainer

[5/14] Monkey Trainer hits Nick for 18 damage!
[0/14] Nick has died!
[0/14] You have died, but have been ressurected in Town Square
[9/14] You have lost 0 experience!
[9/14] Nick appears out of nowhere!!
[9/14] 
e
You walk EAST.
[9/14] 
Avenue
You're on an avenue running through the town.
exits: EAST  SOUTH  WEST  
People: Nick

[9/14] 
e
You walk EAST.
[9/14] 
Avenue
You're on an avenue running through the town.
exits: EAST  WEST  
People: Nick
Enemies: Vagrant

[9/14] Vagrant hits Nick for 3 damage!
[6/14] 
w
You walk WEST.
[6/14] 
Avenue
You're on an avenue running through the town.
exits: EAST  SOUTH  WEST  
People: Nick

[6/14] 
s
You walk SOUTH.
[6/14] 
Training Room
This is the training room. An aged guru stands here, practicing his arts. He
 says "If you are ready to advance, young fellow, you may train here."
exits: NORTH  
People: Nick

[6/14] 
train
You don't have enough experience to train!
[6/14] 
i
Nick says: i
[6/14] 
inventory
-------------------------------- Your Inventory --------------------------------
 Items:
 Weapon: NONE!
 Armor:  NONE!
 Money:  $0
--------------------------------------------------------------------------------
[6/14] 
[6/14] 

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 07 Nov 2004 07:45 PM (UTC)
Message

This is example output from BetterMud - you can see I initially had trouble entering commands because of his idea of 'talking mode' which is like an AutoSay. Once that was turned off I could explore a bit.


            ######  ####### ####### ####### ####### ######
            #     # #          #       #    #       #     #
            #     # #          #       #    #       #     #
            ######  #####      #       #    #####   ######
            #     # #          #       #    #       #   #
            #     # #          #       #    #       #    #
            ######  #######    #       #    ####### #     #

                        #     # #     # ######
                        ##   ## #     # #     #
                        # # # # #     # #     #
                        #  #  # #     # #     #
                        #     # #     # #     #
                        #     # #     # #     #
                        #     #  #####  ######

Welcome to BetterMUD v1.0! If you are a new user, type "new" at the prompt
to create a new account. If not, just enter your user name and password to
log in.

If you have any problems or questions, please email the administrator at
RonPenton@Hotmail.com
Please prefix your email titles with MUD BOOK

Your Name: 
nick
Sorry, the account "nick" does not exist.
Please enter your name, or "new" if you are new: 
new
BetterMUD uses the concept of 'Accounts' to manage your characters inside
the game. You must first create an account, and then we can get started creating
your characters after that.

Enter your desired account name: 
Nick Gammon
Sorry, the account name "Nick Gammon" is unacceptible.
Please enter your desired name: 
Nick_Gammon
Please enter your desired password: 
nick
Thank you! You are now entering the realm...
-------------------------------------------------------------------------------
 BetterMUD v1.0 Main Menu
-------------------------------------------------------------------------------
 0 - Quit
 1 - Enter the Game
 2 - Create a new Character
 3 - Delete an existing Character
 4 - View Help
-------------------------------------------------------------------------------
 Enter Choice: 
2
--------------------------------------------------------------------------------
 Please Choose a Race For Your Character:
--------------------------------------------------------------------------------
 0 - Go Back
 1 - Human
 2 - Elf
--------------------------------------------------------------------------------
 Enter Choice: 
1
Please enter your desired name: 
nick
-------------------------------------------------------------------------------
 BetterMUD v1.0 Main Menu
-------------------------------------------------------------------------------
 0 - Quit
 1 - Enter the Game
 2 - Create a new Character
 3 - Delete an existing Character
 4 - View Help
-------------------------------------------------------------------------------
 Enter Choice: 
1
-------------------------------------------------------------------------------
 Your Characters
-------------------------------------------------------------------------------
 0 - Go Back
 1 - nick
-------------------------------------------------------------------------------
Enter number of character to use: 
1
Unrecognized Command: news
nick enters the realm.
Betterton Town Square
You are in the town square of Betterton, a small city in the realm of BetterMUD.
Exits: North - Garden Path, South - Stone Path, East - Bakery Door, West -
 Avenue
People: nick
Items: Fountain, 8281 Copper Coins, Scroll of Uberweight
take fountain
nick says: take fountain
help
nick says: help
n
nick says: n
north
nick says: north
go north
nick says: go north
/
nick says: go north
/n
You enter the Garden Path
Betterton Town Gardens
You are in the gardens of Betterton, where you can see much flora and fauna all
 around.
Exits: South - Garden Path, North - Mine Entrance
People: nick
/quiet
Usage: "quiet <on|off>"
/quiet on
You are now in QUIET mode
n
You enter the Mine Entrance
Dwarven Mine Entrance
You are at the entrance of the Dwarven Mines, an ancient collection of tunnels
 leading throughout Mount Worthington.
Exits: South - Mine Entrance
People: nick
Items: Dwarven Mine Pass
north
You don't see that exit here!
s
You enter the Mine Entrance
Betterton Town Gardens
You are in the gardens of Betterton, where you can see much flora and fauna all
 around.
Exits: South - Garden Path, North - Mine Entrance
People: nick
look flora
Betterton Town Gardens
You are in the gardens of Betterton, where you can see much flora and fauna all
 around.
Exits: South - Garden Path, North - Mine Entrance
People: nick
n
You enter the Mine Entrance
Dwarven Mine Entrance
You are at the entrance of the Dwarven Mines, an ancient collection of tunnels
 leading throughout Mount Worthington.
Exits: South - Mine Entrance
People: nick
Items: Dwarven Mine Pass
take pass
Unrecognized Command: take
get pass
You pick up Dwarven Mine Pass
i
--------------------------------------------------------------------------------
 Your Inventory
--------------------------------------------------------------------------------
 Dwarven Mine Pass, 
--------------------------------------------------------------------------------
 Weapon:       fists
 Total Weight: 50
 Max Weight:   2000
--------------------------------------------------------------------------------



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Kfarrell   (2 posts)  Bio
Date Reply #4 on Sun 13 Feb 2005 09:53 PM (UTC)
Message
Heyas,

I bought this book a few months ago from overseas, but I didn't receive a CDROM with it. You guys dont know where I can download the code from do you. The book is pretty much usless without the CD. *8(
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #5 on Sun 13 Feb 2005 10:12 PM (UTC)
Message
http://sourceforge.net/projects/bettermud/

Except, they haven't 'released' any files at the moment, however the are infact in the CVS repository:
http://cvs.sourceforge.net/viewcvs.py/bettermud/

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Kfarrell   (2 posts)  Bio
Date Reply #6 on Sun 13 Feb 2005 11:29 PM (UTC)
Message
Thanks man,

that's exactly what I was after.
Top

Posted by Nick Cash   USA  (626 posts)  Bio
Date Reply #7 on Mon 14 Feb 2005 01:11 AM (UTC)
Message
You could contact the publisher and ask for a disk. I know one of my books came with a *bent* disk, which quite obviously will not work. So they sent me a new one.

~Nick Cash
http://www.nick-cash.com
Top

Posted by Trask   Australia  (23 posts)  Bio
Date Reply #8 on Tue 18 Aug 2009 07:26 AM (UTC)
Message
Sorry to necro a dead post, however for anyone interested in the topic for which most frequent these boards, namely mud/mush coding this book is still very relevant I would imagine.

Although it's out of print, copies can be found through less *ahem* reputable means.

If you're like me and can't figure out CVS to save your life, thanks to David Haley's help I have a command to download the cvs repository, although this has not as yet been tested.

cvs -d :pserver:anonymous@bettermud.cvs.sourceforge.net:/cvsroot/bettermud checkout BetterMUD

Cheers.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


40,035 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.