[DGD] Rooms implementation

Felix A. Croes felix at dworkin.nl
Mon Jan 13 14:21:16 CET 2003


Lord Lerkista <lordlerkista at yahoo.com.mx> wrote:

> I'm not sure if this is a question for this list

It certainly is.


> I want to make some type of array of all the rooms in
> my mud, something like a system of room's coordinates,
> to make easy things like interact with rooms around
> the actual room, i try to make a 3D array, xyz[][][],
> but it's so heavy for the mud,
> which would be the better implementation of that??

In the best implementation, each room would have an array (or mapping)
of neighbour rooms.  That way, you can ask the room what the surrounding
rooms are like.  Actually, this is very close to the list of exits
that must already be present in every room.

Suppose that there are a thousand rooms, in a grid of 100 by 100, with
10 different height levels.  Storing each room by coordinate in a
central object, you'd need an array of 100 * 100 * 10 = 100000
elements.  This amount possibly be reduced because not every element is
used, but it's still a large amount of information.

Now assume that instead, there is a list of 6 possible neighbour rooms
in each room object.  That's 6 * 1000 = 6000 elements -- a much smaller
amount, and what is even better, they are distributed across all the
rooms.  DGD can handle many small objects much more easily than one
single huge object.

Regards,
Dworkin
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list