Re: [Circle] [LAG] Priority ageing, optimization, ... ?

From: Chris Ryan (drizzt@visi.net)
Date: 08/24/96


I am not sure exactly how one would do this but my friend said he had
redone the entire processing system to use Que's.

I am sure that it could be very useful in several ways by using it as an
extension to the processing also.

But like i said in the origonal post it seemed an appropiate topic for the
mailing list. So play with it and I would like to see what other people
think, ect... (I am currently to busy to code for circle but like to see
idea's :)

BTW: The dig command was discussed briefly a while back about burying items
and diggiing them back up. I got my version workering but I am not sure how
stable the code is. And the TinTin probs where mentioned with this idea of
having TinTin do the command every time a char enters a new room and the
majority chode WAITSTATE as a good solution. (I could never get my wait
state to work the way I wanted :(

If anyone is interested i could put the code in the list for dig and bury

Chris
drizzt@visi.net
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+


From cat@vuse.vanderbilt.edu Fri, 23 Aug 96 22:52:17 -0500
X-SystemInfo: MyE-Mail: EMail
X-ReplyTo-No: 4020 (There are more replies.)
X-Message-No: 4022 (database)
From: Katzlberger Thomas <cat@vuse.vanderbilt.edu>
To: circle <circle@cspo.queensu.ca>
Subject: Re: [Circle] [CODE] Search buffering
Date: Sat, 24 Aug 96 04:52:00
Message-ID: <9608240352.AA02225@localhost.vuse.vanderbilt.edu>
Reply-To: katzlbt@vuse.vanderbilt.edu (katzlbt)
X-POP3-Rcpt: lk4150@per
Return-Path: <@QUCDN.QueensU.CA:owner-circle@cspo.queensu.ca>
Received: from QUCDN.QueensU.CA (QUCDN.QueensU.CA [130.15.126.2]) by per.cybercity.dk (8.6.12/8.6.12) with SMTP id FAA21692 for <lk4150@krull.dk>; Sat, 24 Aug 1996 05:58:32 +0200
Received: from cspo.queensu.ca by QUCDN.QueensU.CA (IBM VM SMTP V2R2) with TCP;Sat, 24 Aug 96 00:03:56 EDT
Received: by cspo.queensu.ca (SMI-8.6/SMI-SVR4)id XAA06984; Fri, 23 Aug 1996 23:52:37 -0500
Received: from vuse.vanderbilt.edu by cspo.queensu.ca (SMI-8.6/SMI-SVR4)
Received: from localhost.vuse.vanderbilt.edu by vuse.vanderbilt.edu (8.7.5/SMI-4.1/VUSE-1.24)
Received: by localhost.vuse.vanderbilt.edu (NX5.67f2/NX3.0S)
Mime-Version: 1.0 (NeXT Mail 3.3 v118.2)
X-Nextstep-Mailer: Mail 3.3 (Enhance 1.3)
Received: by NeXT.Mailer (1.118.2.RR)
References: <Pine.SOL.3.91.960823202354.19235A-100000@clark.net>
X-My-Email: katzlbt@vuse.vanderbilt.edu
Sender: owner-circle@cspo.queensu.ca
Precedence: bulk

You wrote:
> In case anybody else out there is stuck on a terribly slow server
> and have noticed zone reset lag (I've seen a certain zone take 2-3
> minutes to reset during busy hours), here's a simple fix to speed
> things up a little. All it does is buffer the last mob, object, and
> room so if you load the same mob twice it doesn't search the whole
> index again.
> 
> Add these three variables to db.c somewhere around the top:
> 
> /* search buffereing */
> sh_int mob_sbuf = NOBODY;
> sh_int obj_sbuf = NOTHING;
> sh_int room_sbuf = NOWHERE;
> 
> And replace real_room, real_object, and real_mobile with these (if
> anyone out there is still using obuild just change the xxx_sbuf
> parts). PLease excuse any typos. If there's trouble just copy the
> buffering lines.

I doubt that this will increase performance a lot.
Binary search (as used here) takes about 20 acesses on max.
64000 32000 16000 8000 4000 2000 1000 500 250 125 62 32 16 8 4 2 1
You don't save a lot in this case with your improvement.
The zonereset lag may be caused by virtual memory pageing of your 
host (this is more likely). The only solution for this is to
upgrade the host you run on with some simms. 

Cat.
---
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/                                                            _/_/
_/_/  Thomas Katzlberger                                        _/_/
_/_/  katzlbt@vuse.vanderbilt.edu                               _/_/
_/_/  @aWhiteNeXT.called.garfield                               _/_/
_/_/  http://www.vuse.vanderbilt.edu/~katzlbt/                  _/_/
_/_/                                                            _/_/
_/_/  "You can tune a file system, but you can't tune a fish."  _/_/
_/_/                                UNIX man page for tunefs.   _/_/
_/_/                                                            _/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+


From cat@vuse.vanderbilt.edu Fri, 23 Aug 96 23:36:17 -0500
X-SystemInfo: MyE-Mail: EMail
X-Message-No: 4023 (database)
From: Katzlberger Thomas <cat@vuse.vanderbilt.edu>
To: circle <circle@cspo.queensu.ca>
Subject: Re: [Circle][CODE][EVENTQ][LAG]
Date: Sat, 24 Aug 96 05:36:00
Message-ID: <9608240436.AA02430@localhost.vuse.vanderbilt.edu>
Reply-To: katzlbt@vuse.vanderbilt.edu (katzlbt)
X-POP3-Rcpt: lk4150@per
Return-Path: <@QUCDN.QueensU.CA:owner-circle@cspo.queensu.ca>
Received: from QUCDN.QueensU.CA (QUCDN.QueensU.CA [130.15.126.2]) by per.cybercity.dk (8.6.12/8.6.12) with SMTP id GAA21740 for <lk4150@krull.dk>; Sat, 24 Aug 1996 06:43:56 +0200
Received: from cspo.queensu.ca by QUCDN.QueensU.CA (IBM VM SMTP V2R2) with TCP;Sat, 24 Aug 96 00:49:22 EDT
Received: by cspo.queensu.ca (SMI-8.6/SMI-SVR4)id AAA07026; Sat, 24 Aug 1996 00:38:17 -0500
Received: from vuse.vanderbilt.edu by cspo.queensu.ca (SMI-8.6/SMI-SVR4)
Received: from localhost.vuse.vanderbilt.edu by vuse.vanderbilt.edu (8.7.5/SMI-4.1/VUSE-1.24)
Received: by localhost.vuse.vanderbilt.edu (NX5.67f2/NX3.0S)
Mime-Version: 1.0 (NeXT Mail 3.3 v118.2)
X-Nextstep-Mailer: Mail 3.3 (Enhance 1.3)
Received: by NeXT.Mailer (1.118.2.RR)
Cc: "Chris Ryan" <drizzt@visi.net>
X-My-Email: katzlbt@vuse.vanderbilt.edu
Sender: owner-circle@cspo.queensu.ca
Precedence: bulk

You wrote:
> I am not sure exactly how one would do this but my friend said he
> had redone the entire processing system to use Que's.
> 
> I am sure that it could be very useful in several ways by using it
> as an extension to the processing also.

Let's try to define an event:
(unverified code !! 5 min hack !! needs work !!):

/* Created by Katzlberger Thomas <katzlbt@vuse.vanderbilt.edu> */
struct Event
{
    Event* next;

    Character* ch;
    int when;
    char* doWhat;
    
    ASPELL(*spellfun); // optional
    ACMD(*cmdfun);     // optional
    ...
    
    Event(Character* c,char* what, int w=0)
    {
        ch=c;
        doWhat=str_dup(what);
        when=w;
    }
    
    tick(Queue* q)
    {
        if((--when)<=0)
            execute(q);
    }
    
    execute(Queue* q)
    {   command_interpreter(ch,doWhat);
        free(doWhat);
        q->remove(this);
    }
};


game_loop:

    eventQueue->tick()
        // calls tick in all Events, executed every 8th tick or so
                                                ^^^^^^^^^^^^

Usage:

    eventQueue->addEvent(new Event(ch,"say damn",8));
    // char says damn in 1 tick *grin*
    
    
Depending on the needs it takes - for better performance -
a Queue that sorts its events by the time they will occur.
and just processes the top element. This is the classical
application of a priority queue or heap.

> BTW: The dig command was discussed briefly a while back about
> burying items and diggiing them back up. I got my version workering
> but I am not sure how stable the code is. And the TinTin probs
> where mentioned with this idea of having TinTin do the command
> every time a char enters a new room and the majority chode
> WAITSTATE as a good solution. (I could never get my wait state to
> work the way I wanted :(

Well waitstate doesn't work for this purpose as 
it blocks any input from the player:
	WAIT_STATE(ch, PULSE_MOBILE)
	send_to_char("You start digging",ch);
This should keep him busy for 10 secs but you never 
get control back from the player unless he makes some input.
... here goes an event ...

> If anyone is interested i could put the code in the list for dig
> and bury

Yes I can try to fix it.
But where do you store the buried objects ?

---
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/_/                                                            _/_/
_/_/  Thomas Katzlberger                                        _/_/
_/_/  katzlbt@vuse.vanderbilt.edu                               _/_/
_/_/  @aWhiteNeXT.called.garfield                               _/_/
_/_/  http://www.vuse.vanderbilt.edu/~katzlbt/                  _/_/
_/_/                                                            _/_/
_/_/  "You can tune a file system, but you can't tune a fish."  _/_/
_/_/                                UNIX man page for tunefs.   _/_/
_/_/                                                            _/_/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+


From dan@fix.net Fri, 23 Aug 96 22:05:19 -0700
X-SystemInfo: MyE-Mail: EMail
X-Message-No: 4024 (database)
From: Dan Andersen <dan@fix.net>
Subject: Re: [Circle] [NEWBIE] Which OLC?
Date: Sat, 24 Aug 96 06:05:00
Message-ID: <199608240505.WAA05064@fletch.fix.net>
X-POP3-Rcpt: lk4150@per
Return-Path: <@QUCDN.QueensU.CA:owner-circle@cspo.queensu.ca>
Received: from QUCDN.QueensU.CA (QUCDN.QueensU.CA [130.15.126.2]) by per.cybercity.dk (8.6.12/8.6.12) with SMTP id HAA21761 for <lk4150@krull.dk>; Sat, 24 Aug 1996 07:10:22 +0200
Received: from cspo.queensu.ca by QUCDN.QueensU.CA (IBM VM SMTP V2R2) with TCP;Sat, 24 Aug 96 01:15:46 EDT
Received: by cspo.queensu.ca (SMI-8.6/SMI-SVR4)id BAA07068; Sat, 24 Aug 1996 01:05:07 -0500
Received: from fletch.fix.net by cspo.queensu.ca (SMI-8.6/SMI-SVR4)
Received: from [206.190.71.73] (lts3-073.snlo.dialup.fix.net [206.190.71.73]) by fletch.fix.net (8.7.4/8.7.3) with SMTP id WAA05064 for <circle@cspo.queensu.ca>; Fri, 23 Aug 1996 22:05:19 -0700 (PDT)
x-sender: danderse@fix.net
x-mailer: Claris Emailer 1.1
cc: <circle@cspo.queensu.ca>
Mime-Version: 1.0
Sender: owner-circle@cspo.queensu.ca
Precedence: bulk

>> Basically, which creator should I use....
>> 
>> Obuild or Oasis?
>> 
>
>I use elements of both... I use mob, object and room editing for obuild,
>the shop and zon editor from oasis.. and I have it all setup to use zone 
>permissions the way obuild assigns them.
>
>I personally do not like menu'd olc's.. it's faster to work with 
>commandline so you can see how everything relates and whatnot, but for 
>zon and shop editing speed isn't what you need, you need to be careful 
>about your settings, so I use menu's there because it's easier to see 
>everything...
>And the permissions setup for obuild is deffinatly superior in that 
>someone can have access to more then one zone...

Where can I download Obuild or Oasis?

Dan Andersen - dan@fix.net

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/07/00 PST