RealmsMUD Core Library
This is the core library for RealmsMUD. It's written in LPC and targets the LDMud driver (https://github.com/ldmud/ldmud - as of this writing, 3.6.X).
The goal of this project is twofold: First, there is a barrier of entry into the fascinating world of LP MUDs. On a typical LP MUD, in order for a person to create content, one must create a program. It has been my experience that this requirement does turn away a lot of would-be creators. The added flexibility LPC provides (ie: if you can imagine it, you can build it given that LPC is a fully-featured programming language) is hampered by the barrier-of-entry wherein you must be an adept programmer to do much with LPC. This doesn't have to be the case. Second, I have a lot of ideas about what I thought would make a great game - mixing concepts from modern AAA RPGs (conversation trees, rich quests, detailed crafting, etc), grand strategy games (the ability to wage wars, engage in diplomacy, etc. with a few hundred AI or human-controlled entities), city building games, and likely a few others things.
To this end, this lib has implemented a custom system including:
The following is by no means a comprehensive installation/setup guide but it should give you details about a fairly straightforward means of getting a mud running using the library.
For various reasons, I decided that a database was the best approach for persisting game data. I chose MySQL not because I particularly like it, but because it was the path of least resistence. This should be the only major prerequisite for compiling the mud driver. When you install it, be sure to note both where it was installed and what the login/password for the administrator account for it is.
I have not tested this mudlib with drivers other than the LDMud driver. There are definitely some nuances specific to the LD dialect of LPC and while it is certainly possible to transition to a different driver, it's not recommended. In particular, as new development with LD - particularly with respect to coroutines is introduced, it will almost certainly break compatibility with the other drivers as I intend to make full use of them. In addition, while I currently do not have any python efuns implemented, there are future plans to do so. In short, unless you have a really good reason to not use the LDMud driver, I strongly encourage you to do so.
When compiling it, you will need to keep a few things in mind:
There are some differences between the native regular expression engine and that provided via PCRE. While it's a task in my backlog to resolve the issue so that PCRE can be used, I have not yet done so. For now, make sure thatPCRE is disabled using the --disable-use-pcre flag.
There is a great deal more executional complexity when using this mudlib over typical libs. On the down side, there are most definitely many activities that will require more evaluation time and call stack depth than is customary on a standard mud. On the bright side, this isn't the early 1990s and processors are significantly more powerful than they were 30 years ago. However, in order to add some of the more intricate game mechanics using what I felt was a good approach, several of the default driver values proved to be woefully inadequate and quite a few configurable parameters should either be set to unlimited or significantly bumped above the default values. See the "configure script" flags I used below for reasonable suggestions.
You will need to set up a database user/password and grant it several database actions. To do this, you can use the perl script I created in /secure/simulated-efuns/database/installDatabase.pl if you want a semi-automated means of doing so. This script will create a user named 'realmslib' with the password it echoes out and will also create an empty database named RealmsLib. Otherwise, you can manually add a user and database. The database can be named anything you'd like, but if it is not named RealmsLib, you will need to modify the RealmsDatabase() method in /secure/simulated-efuns/database.c to return your desired name. After you create a database user for the library, you will need to make sure that the credentials can be used by the driver. Getting access to your database is a security problem. This can be resolved in a couple ways. The more secure method is to modify pkg-mysql.c in the LDMud source. Search for the call to mysql_real_connect in that file and modify the call. For example, I did this:
if ( !mysql_real_connect( tmp->mysql_dat, "localhost"
, user ? get_txt(user) : "My DB user"
, password ? get_txt(password) : "My DB password"
, get_txt(database)
, 0, 0, 0))
Another less secure option would be to modify db_connect in the mudlib itself (in /secure/simulated-efuns/database.c) If you search the db_connect() method, you will see the following:
// handle = efun::db_connect(database, DBUSER, DBPASS);
handle = efun::db_connect(database);
Simply uncomment the top line and remove/comment out the second. Change DBUSER and DBPASS as appropriate. For example:
handle = efun::db_connect(database, "My DB", "My Password");
// handle = efun::db_connect(database);
Rather than go through all of the intricacies of which options can/should be set to what, here's an example that led to a successful installation. I admit that several values are overkill, but it's what I use:
# <install mysql>
# <get the LDMud source code tarball and extract it>
# <get the Realms Lib and place it in a directory>
# <lib dir>/secure/simulated-efuns/database/installDatabase.pl
# cd <location of extracted LDMud/src>
# ./update-autoconf.sh
# ./configure --prefix=<your mudlib directory> \
--with-read-file-max-size=0 \
--with-portno=<your port> \
--enable-erq=xerq \
--with-udp-port=<your port> \
--with-catch-reserved-cost=10000 \
--with-malloc=smalloc \
--enable-dynamic-costs \
--enable-opcprof \
--enable-verbose-opcprof \
--enable-yydebug \
--with-time-to-clean_up=864000 \
--with-time-to-swap=86400 \
--with-time-to-swap-variables=86400 \
--with-evaluator-stack-size=131072 \
--with-max-user-trace=131072 \
--with-max-trace=131172 \
--with-compiler-stack-size=65536 \
--with-max-cost=268435456 \
--with-max-array-size=0 \
--with-max-mapping-size=0 \
--with-htable-size=65536 \
--with-itable-size=32768 \
--with-otable-size=65536 \
--with-hard-malloc-limit=0 \
--disable-use-pcre \
--enable-use-mysql=<path to mysql>
# make
When you run the driver for the first time, it will create your database schema and will give the first user created ownership access to the MUD. Additional wizards can be added from within the MUD.
Other installation notes:
You will also want to copy the documentation for your lib into the /doc directory. If you do this, these will be usable in-mud by the lib's help system.
The mudlib has been broken down into what I felt was a sensible directory structure:
All lib functionality is exercised in the /lib/tests directory. In order to see how to use something, you can simply look at its associated tests to glean ideas on how to implement it. The /lib/tests/support directory contains "test helpers" in addition to some concrete examples of items, quests, guilds, research, and so on.
For example, suppose you want to create a guild:
If you'd like to contribute to this project, contact Allen. Adding component to the library is a pretty straigthforward process, but the steps must be followed: