You can make the data structure that holds who registered for a message be a tree: each node has a list of objects listening for that message and a hash map of children, with each level becoming more specific. For example, when someone registers with the root node, they get all messages. The root node has two children in its hash map, triggerOnTouch and buttonActivated (or whatever other messages). When an object registers with the triggerOnTouch node, it only gets all triggerOnTouch events. The triggerOnTouch node's hash map contains the nodes for a specific triggerID, so when an object registers with it, it would get only triggerOnTouch events sent by something with that specific id.
Its kind of like a BHV tree, but for messages. I've used this before and it works really well both from a usability and performance standpoint.
Show differencesHistory of post edits
#4turch
Posted 27 January 2012 - 08:24 AM
You can make the data structure that holds who registered for a message be a tree: each node has a list of objects listening for that message and a hash map of children, with each level becoming more specific. For example, when someone registers with the root node, they get all messages. The root node has two children in its hash map, triggerOnTouch and buttonActivated (or whatever other messages). When an object registers with the triggerOnTouch node, it only gets all triggerOnTouch events. The triggerOnTouch node's hash map contains the nodes for a specific triggerID. Its kind of like a BHV tree, but for messages. I've used this before and it works really well both from a usability and performance standpoint.
#3turch
Posted 27 January 2012 - 08:24 AM
You can make the data structure that holds who registered for a message be a tree: each node has a list of objects listening for that message and a hash map of children, with each level becoming more specific. For example, when someone registers with the root node, they get all messages. The root node has two children in its hash map, triggerOnTouch and buttonActivated (or whatever other message). When an object registers with the triggerOnTouch node, it only gets all triggerOnTouch events. The triggerOnTouch node's hash map contains the nodes for a specific triggerID. Its kind of like a BHV tree, but for messages. I've used this before and it works really well both from a usability and performance standpoint.
#2turch
Posted 27 January 2012 - 08:23 AM
You can make the data structure that holds who registered for a message be a tree: each node has a list of objects listening for that message and a hash map of children, with each element becoming more specific. For example, when someone registers with the root node, they get all messages. The root node has two children in its hash map, triggerOnTouch and buttonActivated (or whatever other message). When an object registers with the triggerOnTouch node, it only gets all triggerOnTouch events. The triggerOnTouch node's hash map contains the nodes for a specific triggerID. Its kind of like a BHV tree, but for messages. I've used this before and it works really well both from a usability and performance standpoint.
#1turch
Posted 27 January 2012 - 08:23 AM
You can the data structure that holds who registered for a message be a tree: each node has a list of objects listening for that message and a hash map of children, with each element becoming more specific. For example, when someone registers with the root node, they get all messages. The root node has two children in its hash map, triggerOnTouch and buttonActivated (or whatever other message). When an object registers with the triggerOnTouch node, it only gets all triggerOnTouch events. The triggerOnTouch node's hash map contains the nodes for a specific triggerID. Its kind of like a BHV tree, but for messages. I've used this before and it works really well both from a usability and performance standpoint.