[MUD-Dev] using DB to store game state

Eli Stevens wickedgrey at wickedgrey.com
Mon Jun 26 16:21:14 CEST 2000


I am having a hard time explaining what my current idea is, so instead let
me use an example.  What I am wanting to know is if what I am thinking is
feasible, etc.

The DB stores all the data about the world (X monster is at Y, carrying Z).
The DB also stores all the pending events that would modify the world (X
monster wants to drop Z).  When an event begins execution, it is flagged as
such, and when it completes the changes are comitted.  This leaves the DB
storing the same info as before; the (new) gamestate and the list of pending
events.

I am considering using MetaKit <URL: http://www.equi4.com/ > as my DB.  It
features "atomic commits" (my term, I think), which means that it keeps two
copies of the data on disk, the old version and the new.  If the server
crashes before the new one is fully written, the old version is used when
the DB is reopened.  The author claims that he has never had a report of a
server crash, power outage, etc. corrupting the data.

The combo of the two would mean that my DB could only be corrupted from
within, which to me seems like a good idea.  :)  It also means that if an
event crashes the mud, I can go back and examine the event flagged as
executing (or the next event to execute, same thing) and hopefully figure
out what is going wrong.

I have reservations about this scheme, because objects (I am using C++) in
memory will either not be persistent (they would be reconstructed from the
DB for every event that needed to touch the object) or I would have to
devise a cashing system that would mark when an object should be
reconstructed.  Another possibility would be to eschew OO, but I don't like
tha idea very much.

Perhaps what I need is an Thing class that takes a handle/pointer/view into
the DB and the class only loads the data as it is needed...  Since the items
on the floor or the room description are not needed when trying to exit said
room, this could be beneficial.  And since I plan on having a very sparse
object tree (still trying to decide if maybe all in game Things should be
the same class), this should be a fairly reasonable ammount of work.
*ponders more*

<//> Silence is golden           RUIN, v.  To destroy.            <\\>
 ||  Eli                         Specifically, to destroy a maid's ||
 ||  wickedgrey at wickedgrey.com   belief in the virtue of maids.    ||
<\\> www.wickedgrey.com            -- Ambrose Bierce              <//>






_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list