[Crossfire-wiki] [Crossfire DokuWiki] page changed: dev_todo:unified_event_system

no-reply_wiki at metalforge.org no-reply_wiki at metalforge.org
Sun Sep 24 00:24:41 CDT 2006


A page in your DokuWiki was added or changed. Here are the details:



Date        : 2006/09/24 00:24

User        : rednaxela

Edit Summary: Add proposal from the mailing list



@@ -1,5 +1,36 @@

  ====== Unified Event System ======

- FIXME Insert edited proposal based on the mailing list thread.

+ ===== Reason =====

+ These things that exist or are planned all use some event-like construct
s:

+   * the plugin system

+   * the callbacks from common to server

+   * the proposed refactoring to have "method-like" function pointers for
 objects and/or object types.

  

- ==== More information ====

-    * [[http://thread.gmane.org/gmane.games.crossfire.general/2193|Crossf
ire mailing list: Unified event system]]

+ All three of those things could be set up to use a unified event/callbac
k system, which would:

+   * benefit plugins by making it more flexible

+   * get rid of ugly stub hacks

+   * reduce repeated effort on the "method-like" system for objects.

+ 

+ ===== Proposal =====

+   * Event hooks however can be: global, per-map, per-arch, and per-objec
t.

+     * All events can be hooked as a global event

+     * Events pertaining to a map or an object in a map can be hooked per
-map

+     * Events pertaining to objects can be hooked as per-arch or per-obje
ct

+     * This essentially means, everything that can be hooked per-object o
r per-arch, can be hooked per-map, and everything that can be hooked per-m
ap can be hooked globally.

+ 

+   * Event hooks can be given priority, with 0 reserved for core server h
andling of the event. Priority stored in an SINT8, so it can range from -1
27 to 127, and negative means it happens first. This allows useful things 
such as setting hooks to run after a player is teleported, or before.

+ 

+   * The return type of calling an event depends on the event, and some e
vents don't return a value; events act as callbacks of sorts, however mult
iple callbacks can be assigned to an event.

+ 

+   * For events that return a value, hooks may or may not return a value.
 Hooks can be set to active or passive, active ones have a chance of retur
ning a value whereas passive will not. When an active hook returns a value
, active hooks of lower priority will not be run, though passive ones stil
l will be.

+     * This is to in principal allow hooks that may override the default 
return of a callback, while also allowing passive hooks to still run both 
before and after.

+ 

+   * Events with no return value only allow passive hooks

+ 

+   * For events without return values, hooks may at runtime opt to force 
priority 0 (default server internal) or lower, not to run.

+     * This is to allow hooks for events without return values, to stop d
efault server code from running. This achieves the same purpose as only th
e first active event that returns a value, running for events that return 
a value.

+ 

+ ===== Concerns =====

+   * Though I wrote the original proposal, I am somewhat concerned that t
he proposed logic for active/passive hooks and when not to run other hooks
 is over-engineered, however I cannot think of another method to achieve t
he same usefulness which is simpler. Does anyone have any suggestions? ---
 //[[user:rednaxela|Alex Schultz]] 2006/09/24 00:20//

+ 

+ ===== More information =====

+   * [[http://thread.gmane.org/gmane.games.crossfire.general/2193|Crossfi
re mailing list: Unified event system]]





IP-Address  : 66.222.158.169

Old Revision: http://wiki.metalforge.net/doku.php/dev_todo:unified_event_s
ystem?rev=1158961937

New Revision: http://wiki.metalforge.net/doku.php/dev_todo:unified_event_s
ystem



-- 

This mail was generated by DokuWiki at

http://wiki.metalforge.net/





More information about the crossfire-wiki mailing list