[MUD-Dev] Database vs. Disk

Kwon Ekstrom justice at softhome.net
Thu May 22 20:08:54 New Zealand Standard Time 2003

From: "Nicolai Hansen" <nic at aub.dk>
> Bruce wrote:

>> What are people doing out there?

> I once changed "my" DIKU to use mySQL instead of text
> files. Didn't do much of a difference really, but it made
> maintenance quite a lot easier.

> Despite my search I have never encountered a database that allowed
> me to store an object. I always have to write Object.Save() /
> Object.Load() methods which is a pain, especially when you want to
> change stuff. 

I've been using a hybrid system for my code, where different aspects
of the server use either a database or a serialized file (not all
file based systems use flat text).  I've found that a relational
database handled a complex object heirarchy poorly.  There are
several instances which required alot of additional forethought and
code to handle such as containers.  Additionally, each command or
token type (items, rooms, and mobs are considered tokens) could have
it's own list of fields to save.  The relational database didn't
easily support this level of flexibility.

I used a blob system where I serialized the data (such as token
types, or command functions) to a field in the database.  There were
other minor issues with the database, primarily the disproportionate
amount of time I spent maintaining the database and database code to
keep up with the speed of development that I eventually gave up and
opted for a serialized file system.

I still use the database for more static parts of the code such as
statistics, boards, logs, and utility tables.

For things like pfiles, and the command table, I serialize to a
file.  Granted, there are more efficient approaches, and given
enough forethought and some utility objects to handle the database,
it could have worked.

Given the circumstances of my game, the time to research it properly
for a database to work didn't equal the gains.  I've noticed a
tendency on this list to analyse systems as if they would be used at
an enterprise level of scalability and reliability (imho, this is a
factor in the decline of useful technical threads lately).  Most
MU*'s are hobby projects and at most need to scale to a thousand or
so simultaneous connections and maybe 10x as many total players.

I've personally found that at the small to medium scale that
performance is better with a file based system.

Anyhow... enough ranting.

-- Kwon J. Ekstrom

MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list