Re: [CODE] Events system

From: STW (stw@ARTICA.DEMON.CO.UK)
Date: 10/31/98


From: Andrew <object@ALPHALINK.COM.AU>
To: CIRCLE@post.queensu.ca <CIRCLE@post.queensu.ca>
Date: Saturday, October 31, 1998 12:37 AM
Subject:  [CODE] Events system

>I'm in the process of creating an events system at the moment. Please note
>that I am not after DG Events or anyone else's events package - I want the
>experience of making my own.
>
>My events will be set up like ACMDs, in the format of 'EVENT(FireBall2)'
etc.
>and I call the events by 'set_event(ch, FireBall2)'. However, all the
arguments
>in the ACMD where I call set_event() are not parsed onto the
EVENT(FireBall2)

We use a scheduler, which works like the task scheduler in an operating
system. Everything is an event, and is put into a queue together with an
execution time and a priority. Every so and so the scheduler picks the next
thing off the queue and executes it. For example: Players types input. The
sockets are polled 20 times a second using a polling event, the input is
detected and a "Got Input" event is created. The got input event is
processed and the command is parsed into tokens and then put back onto the
scheduler for execution whenever it is due - typically immeditely, but it's
still schedued in case the character is slowed, etc (the "slow" spell puts a
delay between you typing commands and the command being executed). Events
are also created when a character enters a room, casts a spell, picks up an
item, etc. e.g. When a character picks up an object, the object is also sent
a "you got picked up by X" event. The objects, characters, etc aren't
processes - an event sent "to" a character is actually sent to a parser
which calls the appropriate functions so it looks like the target is
reacting. The best thing about this is that we will be able to implement
multiple attacks by reducing the delay between attacks, and not by giving
more hits on each combat pulse. (Unfortunately, we havent got the combat
system up yet - still doing the OLC modules.

>function. I was thinking of making another argument to set_event() in which
>you parse the ACMD's argument, but then I'll have to apply two_arguments()
etc.
>to the argument in every single EVENT().
>
>This probably sounds very confusing. Sorry. But does anyone have any
>suggestions?
>
>Thanks,
>
>-- Andrew Ritchie.
>
>| Andrew Ritchie, object@alphalink.com.au.
>
>
>     +------------------------------------------------------------+
>     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>     +------------------------------------------------------------+
-----Original Message-----
From: Andrew <object@ALPHALINK.COM.AU>
To: CIRCLE@post.queensu.ca <CIRCLE@post.queensu.ca>
Date: Saturday, October 31, 1998 12:37 AM
Subject:  [CODE] Events system


>I'm in the process of creating an events system at the moment. Please note
>that I am not after DG Events or anyone else's events package - I want the
>experience of making my own.
>
>My events will be set up like ACMDs, in the format of 'EVENT(FireBall2)'
etc.
>and I call the events by 'set_event(ch, FireBall2)'. However, all the
arguments
>in the ACMD where I call set_event() are not parsed onto the
EVENT(FireBall2)
>function. I was thinking of making another argument to set_event() in which
>you parse the ACMD's argument, but then I'll have to apply two_arguments()
etc.
>to the argument in every single EVENT().
>
>This probably sounds very confusing. Sorry. But does anyone have any
>suggestions?
>
>Thanks,
>
>-- Andrew Ritchie.
>
>| Andrew Ritchie, object@alphalink.com.au.
>
>
>     +------------------------------------------------------------+
>     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
>     +------------------------------------------------------------+


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



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