Home  +  Forums  +  C++ and Sockets  +  C++ and SQL: MySQL, sqlite, ODBC  +  Miscellaneous Projects
esta pagina en espanol

A Small MUD


This is a minimal mud implementation, with some mildly intelligent mobs running around creating rooms.

A few pointers when reading the source code... the World class contains the "cells" in the dungeon - all those are created randomly by the mobs. The MobFactory class contains and controls all mobs in the world - the class holds a reference to the World class. Cells are specified by the World::CELL struct and mobs by the MobFactory::MOB struct. The SmallHandler class contains the World, MobFactory, and active sockets list (via SocketHandler). Finally, the SmallSocket class handles all socket communication and the ListenSocket template class acts as the socket listen server.

New 2004-05-17: There is an ItemFactory class that can spawn random items in the world. Right now an item only has four properties: wield pos, physical, magical, and amount. The "cstring" class adds ansi color functionality. It's a std::string class with modified behaviour. The c_str() method returns the string with ansi control chars, the nc_str() method returns the string without color information, and when used as normal the string returns the ansi "shortcut" chars - read about them below.

ANSI controls

       Low int. Bright Background
 Red     &r      &R      &e  
 Green   &g      &G      &k  
 Yellow  &y      &Y      &p  
 Blue    &b      &B      &u  
 Magenta &m      &M      &a 
 Cyan    &c      &C      &f  
 White   &w      &W      &h  
 Black   &l      &L      &i  

  &n - back to normal 
  &F - flash 
  &U - underline 


2006-10-03 small-1.3.tar.gz Update to sockets library v2.1
2004-05-17 small-1.2.tar.gz added spawning of items and ansi colors
2004-03-21 small-1.1.tar.gz added persistent player names
small-1.0.tar.gz original release

Please note. This example was primarily developed on linux, and may require some tweaking to compile on other platforms.

Source code documentation (generated by Doxygen). Select "File List" from the doxygen index page to see a list of all files in the example. Then select "[code]" to read the source code of that file. Files beginning with lowercase are usually the main() starting point, and files beginning with uppercase usually contains a class of the same name as the file itself.

Class diagram

Generated by dp
Class Diagram


BTC 39jPVR6A2temP8WusathBrcxGcsiJ1TT4g

LTC MBymSdsJY1ig9s3kHYxXvGcaG8uQh5y1j9
Page, code, and content Copyright (C) 2020 by Anders Hedström