[MUD-Dev] MUD Design Fundamentals (Was: Looking for

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Mon Sep 1 15:49:50 CEST 1997


:>[Ola F:]

:>I think you need to stop and hear about some of the systems that people
:>in this list have implemented before you go making blanket statements
:>like that.
:
:So why don't you tell me?!

Because there is too much of it and its not organized very much.
The archives from Chris L. are your only real alternative.

:>:				  And the fact remains, if you change your
:>:object-system (class-hierarchy if you like)	you need a wipe if the data
:>:stored in the internal structure is reflected on the secondary storage
:>:device. (which it will if you use straight persistence)
:>
:>Nonsense.
:>
:>    SetParent(AThing, NewParent)$
:>
:>Done.
:
:????

Just showing how you can change the parentage of an object ("thing") on
my system. Its just not a big deal. In a just previous post, you mentioned
that you have been talking about general-purpose programming languages
outside of the special MUD-realm. That has possibly caused a lot of
confusion - I think most folks in the list have been thinking that we
were talking about in-MUD languages, or languages specifically used to
program MUDs.

:>You are thinking only in terms of the C++ style of "objects". When all
:>objects are indirectly referenced (what "objected oriented" meant before
:>C++ came along and clouded the issue), such changes in the hierarcy are
:>fairly trivial.
:
:I think you need to pick up a book on computer language history. Simula67
:has references much like C++, which is natural since Stroustrup is of
:Simula breed.	Indirect referencing won't help you much if you split
:objects, does it?  If you change your objectsystem there is trouble in
:any conceivable efficient language.  Some changes are easier to do in
:some languages, but for the general case, you are in trouble.	Indirect
:referencing is of course great for a lot of things, and probably a
:weakness in C++ compared to the languages you use.  But not in this
:case.

My apologies for not being up-to-date on my computer language history.
It is over 25 years since I took a course in that at University. Please
explain what you mean by "splitting objects". As someone who isn't at
all in on the current C++ or OOP "scene", terminology used there is
mostly foreign to me. Explain also what you mean by "change your
objectsystem". Certainly if you decide to change the whole way your
use of objects is setup, so that properties are moving, being changed
from explicit to computed, etc., etc., then you want to redo your
system from scratch, regardless of what kind of language you are using.

If "in this case" means the case of changing the parenting of an object,
then my example above shows that it does make a difference. Please keep
in mind that we are not necessarily assuming a C++ style of "object" in
these discussions, so if that is what you mean, you'll have to keep
saying so, to keep us all on track.

To clarify for you (old stuff for others on the list), in my system,
an "object" is just an entity of type "thing", persistently stored in
the on-disk database, that is a small fixed structure (which includes
a "reference" to the parent, if any), along with a flexible array of
property/value pairs. The properties themselves are just "references"
to in-db structures. Thus, the expression "thingRef @ propRef" involves
fetching the thing referenced by 'thingRef' from the db, and scanning
the array of properties attached to it, looking for a pair whose first
element is 'propRef'. If found, the second element of the pair is used.
If not found, the search continues through the parent chain. If not
found at all, the system defines default values for all types of
properties (e.g. 0 for int, 'nil' for "references", etc.). So, as you
can see, changing the parent of a thing is not a big deal.

You may feel free to discard this type of implementation as hopelessly
inefficient, but I have found that it is quite practical for building
MUD systems. An aspect that many people miss here, is that doing this
saves me almost an order of magnitude in space, as compared to systems
like LPC where inheriting something means including a copy of it. When
first designing this system, I had planned to move things in the
array on a somewhat LRU scheme, but have never found it to be necessary -
the CPU costs are all elsewhere. There is usually quite a lot of
messing around to be done with each value fetched or stored. Typically
the big thing is straight text going in and out, especially when something
going on has to send text to several clients.

:Of course, if you care about efficiency/compiler optimization then
:dynamic resolving is shit.  If you use C++ (which sucks) you better
:care about efficiency.  I would think most people using algol-type
:languages care about performance.

Certainly I care about performance. I'm someone who learned game
programming on CP/M systems, where performance and memory usage were
critical. Those habits have not fully gone away.

:You know, diskbased systems is one of the traditional approaches to
:MUDs... :)

Is it? By "disk based" we don't mean something like the traditional LP,
where source files are parsed when loaded. Nor do we mean something like
Diku's where zone files are parsed and loaded. We mean something where
stuff can be written back to the disk representation when it is no longer
needed (e.g. the caching mechanisms have decided to punt it to make
space for something else).

:But this won't work in a dynamic system where "the wind is blowing",
:where you have global dynamics implemented by solving oversimplified
:differential equations.

What won't work. And why?

:			  What I was pointing at with coredumping was that
:there is more to persistence than to freeze the systemstate, so in a
:general programming language (OS-level) you somehow have to differentiate
:between those things that are valid between runs and those that are not.

There is more to persistence than saving the state of the entire system?
Huh? Please elucidate.

:I personally cannot see why anyone would design a diskbased system when
:RAM prices seems to be cut in half every 8 months or something, and
:most UNIXes have decent virtual memory systems.  In 4 years I'll probably
:have 1GB of RAM and 3GB of swapspace, what bothers me is not lack of
:memory, but memory accesstimes and distribution (multiple servers).

In a word - granularity. The granularity of virtual memory is the native
pagesize. The granularity of the structures in a MUD system can be more
than an order of magnitude smaller than that. That means that intelligent
caching can save you more than an order of magnitude in working set size.
That can have a big payback in your CPU cache hits, etc. Also, many MUD
servers run on systems where there is a policy governing how much machine
resources can be used. In any case, I would consider it "unwise" to
design a system that assumes it can have a multi-gigabyte memory footprint.
With the speed of disks today, any shakeup on the machine, which flushes
out a significant part of that, is going to cause one *big* pause in your
server! Not acceptable in something that is supposed to be "realtime".

:Then again, I am of course coloured by my own attitudes towards design
:of virtual worlds.

As are we all!

:But, I have nothing against a persistent store MUD system.  What I warn
:against is using persistent store general language support (OS-level)
:without making separate load/save functions for the most vital information.
:The only reason I pointed out some downs with a persistent object-store
:is that I recommended someone on the list to look up a persistent
:object-store library instead of building his own.  Later I felt obliged
:to warn against some downsides that this approach usually will bring
:with it.  Which I guess some die-hard persistence guys took personal.

Actually, as an off-time mental exploration, I've been idly thinking
about an OS which is heavily based on a persistent language. There are
several fascinating advantages to it. Gone are the zillion little
configuration files, each with a different GUI to play with them. My
ideas aren't firm enough to say much about it, however, so its best to
drop it. I just thought I'd mention it after your previous paragraph.

--
Chris Gray   cg at ami-cg.GraySage.Edmonton.AB.CA



More information about the mud-dev-archive mailing list