[MUD-Dev] [CODE] unique items
fibhufky at erols.com
Fri Jan 7 15:05:02 New Zealand Daylight Time 2000
From: J. Coleman <stormknight at alltel.net>
>Does anyone know a good way to handle unique items? I want to have
>players able to make magic items themselves, that are completely custom.
>Magic items in my game will be fairly powerful because of their rarity,
>and the fact that they must be created, and not found. Is there a good
>clean way to keep an "index" file of all magic items that have been
>created this way, and to reference player files to it perhaps? How does
>everyone else do this?
On my mud, ALL items are unique. The way I handle items (all game "objects")
is rather differant from the standard diku method. The main concepts of my
system are as follows:
A: There is no distinction betweens mobiles and items. Both use the same
data structure, with certain AI distintions made within the objects
B: Each game entity can be a set of rooms, a mob, a player (which can be
either mob-like or an intelligent object), an item or structure of some
sort, a planet, whatever.
C: There are three basic components to any game entity. The Body (Physical
Data), the Mind (AI and mental data), and the Player (players data if the
entity is controlled by a player)
D: The mind is stored in the Body, the Player is stored in the Mind, and the
Body is stored within an Active Room
E: Rooms are stored as a grid of pointers to Room Data within the Body data.
F: Each body contains a linked list of active room structures (rooms on the
grid with other bodies in them). Each of these contains a pointer to the
room data (taken from the grid), the coordinate of the room (4 dimensional
coordinates, X, Y, Z, Body ID), and a linked list of bodies in the room.
G: There is code-created active room that serves like the root for all other
The way the system works, there IS no index of objects. When the database is
loaded, the root ActiveRoom is loaded, which is the only activeroom not
inside of a body. That room would contain a body which would have the main
world grid on it and all the active rooms within that world. All active
rooms within the body would be loaded after the body, and each body within
it would be loaded, also checking for active rooms, until everything in the
tree is loaded.
Parsing is similar. I parse the root room with an update_room, then
update_room loops through the bodies in the room, calling update_body on
each, then the update_body would call update_mind (which would update the
player player if there is one), and loop through all the active rooms,
This system is nice because it makes the world 100% persistant. Mobs
remember where they are after a reboot, as well as anything else. There are
no formal resets. However, I use special root room where "destroyed"
entities are sent by default. Any repop or resurrection would be handled by
There is one thing that might be viewed as a downside, and that is that each
entity is unique. This system works wonderfully for small worlds. For large
worlds (Like I plan mine to be), a special object copy command would be
Also, the rooms do use a sort of template system. The same room data can be
assigned to multiple rooms (with exit variables of course). This allows you
to make a large forest of the same statistics, and exit types. The exits can
be defined to either a specific coordinate or to an adjacent grid coordinate
(automatic, used for true templates, like the forest).
Sorry if I went a bit off topic from the original question and into a rant
about my own system. Hope this helps.
Head Coder: NirvanaDev
Head Admin: Timeless Journies
Email: fibhufky at erols.com
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev