[DGD]Reset systems.
balduin at uni-paderborn.de
balduin at uni-paderborn.de
Thu Apr 15 21:22:01 CEST 1999
Hi ;)
> Ive been able to figure out most things with regard to LPC muds,
> except I cant work out how to add a reset system. That is
> having items in rooms, rooms and NPCs regenerated every so often.
One way to do such a thing is to use timestamps in each room/object.
Start with writing a function you always call when a player enters a room.
Lets call it e.g. init_room(). In this function you do, if enough time
went by, a new reset. E.g. by calling a function reset_room().
You can do similar to your npc's and monsters by calling their
init function from the rooms init. Of course you must make sure
reset is done completely when you move the player into the room.
It's somehow weird to see npc's appear from the void, equip or
do other initialising stuff when you enter a room. And don't forget
to update the timestamp.
What do you gain ?
a) You make better use of dgd's swapping mechanisms, because you don't
have to swap in all objects on a regular basis. If a player enters
a room you'd need it in memory anyways.
b) rarely visited rooms and npcs are resetted less often, so you have
less cpu usage.
c) You can give different minimum reset times to each object (if you want)
What are the problems ?
a) You will probably reset some objects more often then others.
b) Since you reset objects on demand, entering a room tends to
become expensive. (You always have to check and probably do the reset)
c) You need the memory for the timestamp in each object.
d) coin heaps and such stuff don't grow with time (unless you make
the code in reset dependent on the "sleeping" period)
greetings Ludger
(grumbel in Xyllomer)
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list