Many of you heard me ranting about this last week. I'm thinking about starting on a trigger system and am putting some thought into it's design. First I'd like to get some input from you guys. In order to design a trigger system we have to agree on the definition of a trigger. What comes to mind for me is something like this: A trigger is something that waits for a particular event or set of conditions to be met and reports it to the system. By "reports it to the system" I'm referring to the active listeners that are listening for the trigger to report (yes we should probably conform to our current observer pattern standards).
This of course is a pretty broad definition of a trigger compared to what I was thinking before. Initially I was thinking a trigger could only listen for particular instance/cell interactions, like when an instance enters/exits a cell. Now I think by keeping a broader definition of a trigger in mind it might keep the design a bit more flexible.
Here are some ideas I have for requirements of the trigger system:
- Conform to the observer pattern
- Allow client definable triggers/trigger types
- System can be disabled (save on a bit of overhead if they are not required)
- Trigger type that reacts to a instance+cell interaction messages
- A single trigger can watch an arbitrary set of cells
- A single trigger can watch an area of cells
- Cell interaction triggers can move (perhaps be attached to an instance/object and move along with it)
- Trigger type that reacts to an instance being changed (moved, removed from layer, etc etc)
Thats all I have for now. Thoughts?