[MUD-Dev] Naming and Directories?

Hans-Henrik Staerfeldt hhs at cbs.dtu.dk
Fri Mar 12 13:46:28 New Zealand Daylight Time 1999

On Thu, 11 Mar 1999, Mark Gritter wrote:
> In MUDs I'm familiar with, directories seem to be done in a very ad-hoc=
> fashion.  Objects may have no name associated with them at all, or a
> name can be discovered only by exhaustive search.
> Dikus are a partiularly bad example here.  Doing a "tell" may involve=20
> scanning the entire list of online players.  Objects (I mean driver-lev=
> objects including mobs and items) are named only by their location in m=
> object prototypes have essentially meaningless integer IDs.

The easy way of speeding this up is by maintaining search tries for for
the entities. You maintain search tries for both lokalized areas as well
as for the whole game, according to your needs. Looking up a name now
takes roughly O(m) where m is the size of the name. And it is easy to
make this do the 'extended names' search for objects with names of
multiple words, like "dragon","red dragon","huge dragon" "dragon with
green eyes", returning simply the longest match made.=20

> A potential drawback I see is increased memory usage (perhaps prohibite=
> so.)  Benefits to CPU time by doing "smarter" lookups are probably not =
> to be a big win.

Such a trie would need to be managed every time objects 'move' localities=
that is both when units move from location to location and when they are
created and deleted from the game, and here you need an equivalent
maintenance time for the trie. And yes, the tries does cost extra memory,
but not much compared to the objects in memory. It most surely will speed
up lookup if your database covers hundreds of thousands of objects in
the game, and do global lookup often (if f.inst. used in an interpreted
language, that makes heavy use of it).

Hans Henrik St=E6rfeldt         | =20
email: bombman at diku.dk        |  voice:      +45 40383492=20
  hhs at cbs.dtu.dk              |  voice work: +45 45252425
phone-mail:                   |  address:
  40383492 at sms.tdm.dk         |       Hans Henrik St=E6rfeldt,
WWW-home                      |       Dybendalsvej 74 2. th,
  http://www.cbs.dtu.dk/hhs/  |       2720 Vanl=F8se, Danmark.
Student of Computer Science   | Scientific programmer at Center for
  and Information Psychology. |   Biological Sequence Analysis,
  at University of Copenhagen |   Technical University of Denmark.

MUD-Dev maillist  -  MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list