I am working on a module now, in this module, there is a Timer piece, which will send GKC to a group of Unit pieces in each turn, updating their Mana points.
This Unit group may vary each turn, for example, if some unit cast spell and consume some Mana, it needs to join this group to recover its mana points, and if some unit recover its Mana and reaches its max value, this unit will be removed from this group.
I have two plans to establish this mechanism and don’t know which one is better:
(1) Use auto-attach to all pieces with identical names in Attachment traits to bind Timer with every Unit on board, when fire GKC, using property filter to reach to units which needs to update mana points (I use some dynamic property to label which unit should be filtered out);
(2) In each term, for Timer piece, clear existing attachment list first, then attach units (which needs to update mana) to the Timer piece, after re-establishing the attachment relationship, fire GKC to Current Attachments.
So choice (1) basically will need to maintain a larger group of attachment network in which some units won’t be affected by GKC,
choice (2) will need Timer piece to re-establish attachment network each turn and this will surely cost some system overhead,
My question is from the point of performance, which choice will be better?
I know pieces with Attachment trait will maintain a internal list of pieces (like current attachment) to speed up GKC performance, but not knowing the details of this process, and whether maintain a too large attachment list will cause some setbacks or not.