MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: RPG stuff




On Mon, 11 Mar 1996, Matthew Sanderson wrote:

> >How can I have a check running on every player that is checking to see
> >whether there health is 0 and they should be dead? I am not sure how you
> >get something to check the status of a property every few seconds or
> >something...

> Bad Thing Alert.
> This is really not something you want to do. This is horribly inefficient;
> it would slow the server considerably for no reason, forcing it to check
> the .health property of a few (hundred? tens of?) players every few
> seconds.

Actually, I'm not sure this would be such a Bad Thing.  Matthew's
suggestion of a single verb that would affect .health and also call
appropriate other verbs if .health <= 0 is indeed fine.  But I've been
running a "daemon" check verb on a MOO with over 1000 players for months
now, and we've suffered little if any noticible slowdown.  The verb
essentially looks like: 

@program $daemon_verbs:check_health()

for dude in (players())
if (dude.health <= 0)
	this:kill_player(dude);
endif
endfor
fork(5)
	this:check_health();
endfork

It is recursively called, and executes every five seconds + however long
the for loop takes (which, as it turns out, isn't too long.)  Remember, 
property checks take <= 1 tick.  

We're running this MOO on a dedicated linux box. 

Colin


References:

Home | Subject Index | Thread Index