[MUD-Dev] Creating a MUD - Overview of design
Valerio Santinelli
tanis at mediacom.it
Tue Jan 29 09:45:11 CET 2002
From: "Neil Edwards" <neil at anyisle.org>
> Firstly, object persistance. By this I mean that objects in the
> game (inc. rooms etc) are always stored in some form or another
> for backup and actual use. In my MUD I just read everything from
> text files (XML formatted) and then keep everything in memory
> until it periodically saves everything again in case of a crash
> (Not yet implemented online creation but should be easy enough). I
> was hoping to move this system to a database system (been looking
> at MySQL (free) ) but I don't think I fully understand what goes
> into the database or how it is referenced.
Having objects stored in XML files isn't that bad after all. If I'm
not wrong, people at Skotos use the same way to store items as you
do. Moving to an SQL database is a whole different thing. The first
issue that comes to my mind is the fact that with MySQL you don't
actually have all the objects loaded in memory, but rather they are
queryed off the database every time you want to access them. This is
a big overload if you've got plenty of users roaming in rooms with
many objects. Of course you could still do a query and load the
objects in memory from MySQL, but this way you lose all the "ons" of
a RDBMS.
> For example, if I have a table which holds all the items (swords
> etc.) that can be created in the game then do I also have another
> table that holds all of the actual items in use by the game and
> how do I reference these (by ID wouldn't work because two items of
> the same ID can be different (quality of sword, same sword less
> durable) so don't really know what to do there. At the momement I
> just have several Vectors in a room object that hold items,
> players, actors (NPCs) and other things. How would I change this
> to a database model? Should I even bother?
You could have a table with all your basic items, and another one
with extended attributes. So when you make a new sword you grab the
basic sword and put its id in the table where you're going to put
the custom attributes like quality, durability, etc. It's just one
of the many solutions available with RDBMS.
> Secondly, networking. I have read that tcp is overly slow and that
> I should use udp (at least, I think that's what I read!) but
> surely with so little information being sent (it is only text
> based after all) then does that really matter? Also at the moment
> I have some simple ServerSocket which accepts requests from
> clients and sends each client off on it's own thread which waits
> on it. I have read that it is better to just have a few threads
> polling each client to see if they have written anything. Could
> anyone give me some MUD specific examples because I don't really
> see how the to put the one's on Sun's website into practice.
For a MUD, TCP is well suited. You're going to need UDP if you are
working on a MMORPG or any other 3D game that need costant updates
of player movement. Otherwise you can still wait for some text to
arrive without having impact on the playability of your MUD.
--
Valerio Santinelli
HateSeed.com Founder (http://www.hateseed.com)
In Flames Italia Webmaster (http://www.inflames.it)
My Lab (http://tanis.hateseed.com)
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev
More information about the mud-dev-archive
mailing list