Feature Request: More event types



  • Could you guys please add more event types to Room.getEventLog? like creep enter room, structure decayed, creep spawned, etc.



  • I personally think it's best to keep the event log to things that you cannot neccessarily detect through code. Keeps things lean. I'm not 100% sure why we have EVENT_OBJECT_DESTROYED as I can't think why that can't be detected through code, so maybe the devs don't have the same philosophy here.



  • @tigga It is true that events like STRUCTURE_DECAYED and CREEP_SPAWNED can be detected by user's code without too much cpu cost. However, I really cannot image how to detect an invader entering a room in an O(1) time complexity.



  • @liu233w said in Feature Request: More event types:

    @tigga It is true that events like STRUCTURE_DECAYED and CREEP_SPAWNED can be detected by user's code without too much cpu cost. However, I really cannot image how to detect an invader entering a room in an O(1) time complexity.

    room.find(FIND_HOSTILE_CREEPS).length should be good enough. That'll almost always return 0. When it doesn't, checking them against exit tiles is easy enough. Yeah, it scales with number of hostile creeps as find has a clone inside, but parsing the event log is also not free.

    EDIT: I guess you could mean O(1) in tick count. That's fair enough. Cost is about 0.001 CPU though. I guess if you're already parsing the event log every tick (which I guess is more expensive than 0.001 CPU...) then maybe an event would save you a tiny amount of CPU.



  • @tigga I just read the source code of how Room.find works and found that the result of Room.find(FIND_HOSTILE_CREEPS) (and other structures) are constructed every tick no mater whether I read it or not... Maybe it's not a good idea to parse the event log instead of just looping through the result of find 😞



  • @tigga pretty sure the destroyed event was put in to identify specifically which creep made the kill, which would not be able to be identified in code 100%. I remember that discussion when events were new.


  • Dev Team

    @semperrabbit it's not really possible to say who or what killed a creep due to how it's being calculated. Consequently, EVENT_OBJECT_DESTROYED can't expose that data.