Posted by
| Nick Gammon
Australia (23,070 posts) Bio
Forum Administrator |
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 |
|