notifyWhenAttacked(enabled) should not be const (0.2 CPU)


  • SUN

    Dear awesome Devs,

    I'd like you to rethink the 0.2 CPU of the notifyWhenAttacked function.
    Since it is enabled by default, the only reason to use it is to disable notifications...
    Which reduce the cpu pressure on the server.

    For example, I disable them on my miner and fighters in keepers room since they create notification bloat/spam.

    I don't think we should have to 'pay' in CPU term for this.
    Also I don't consider these notification to be part of the Game state in term of gameplay, but this is opinionated so not very important.

    Potentials proposal:
    * disable it by default and make it cost 0.2 to ACTIVATE it.
    * make the value as an optional arguments in Spawn.createCreep function.
    * Remove the (0.2) CPU cost of this function call altogether.

    PS: not sure if it should be in technical issues or feature request.
    PS2: the amortized CPU cost of the call is very low, I know it is a bit nitpicking.



  • I don't mind paying the 0.2 cpu to disable it, but the fact that you can't tell what state it's currently set to is what I dislike. If we could check what state it's in and decide whether or not it needs to be changed, we could reduce that to a single const action for the creep's lifetime, which I feel would be a good start.



  • The proposal to add this as a parameter to Spawn.createCreep would have a net reduction of impact upon the server performance in all static cases, and would be beneficial.



  • Prime's solution is the cleanest imho.