[MUD-Dev] data structure design in a new mud

pauli.saksa pauli.saksa at ztango.com
Wed Mar 14 15:15:18 CET 2001


> From: "Kwon Ekstrom" <justice at softhome.net>
>> From: <pauli.saksa at ztango.com>

>> In my opinion the negative sides of a central list are greater than
>> the positive sides.

> I'd like to know what these negative sides you're talking about are.

Main reason: extra code with no significant benefit.  Indexing would
also bring some problems.  If I have a huge list with all the items in
the world in it, there would be some problems to make a difference
between two similar items.

Also, I'm a big fan of encapsulation, meaning that there has to be a
good reason for a global data before I'm willing to implement it - and
in this case, as we saw it, there was not.

Negative sides aren't that big, but neither are the positive sides.

>> In our model each item has two different sets of attributes: item
>> type data (=shared) and item instance data (=unique).  Shared data
>> is actually shared in the memory as well.  In addition to saving
>> memory, this is a major step towards easier balancing: if some type
>> of a sword is too good, all swords of that type can be downgraded
>> in one place.

> I've seen similar systems, but in truth, it seems that you're saving
> memory at the expense of cpu.  Since if an item is part shared, and
> part unique, then the code will have to scan the object to see if
> the unique parts aren't really shared parts that have been changed,
> and then check the shared portion to build a list of it's current
> state.  Checking the shared portion on-loadup could allow the
> centralized balancing, but wouldn't save memory (but likely save
> storage space)

Hmm.. I didn't quite catch you here, so I'll have to assume we are not
talking about the same thing. Let me explain this with an example:

  possible attributes of a sword:

  1. - name
     - size
     - building instructions
     - battle attributes (damage etc.)

  2. - quality     (calculated from used material
                    and the skill of blacksmith, etc.)
     - condition

That first set of attributes is stored once in the memory and all
items of that particular type use the same shared memory.  The second
set of attributes is unique for all item instances and stored
separately for each item.  So if I have several similar swords, they
are all built from the same parts and named equally but their
qualities and conditions may differ.  I see no cpu loss here.

--
pauli.saksa at ztango.com
Enhanced Mud Implementing Team (EMIT)
_______________________________________________
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