Draft: room event log


  • Dev Team

    @tigga move action is not recorded (I don't see any reason why it should be, it's just a waste of resources). rangedMassAttack is recorded as multiple events for each affected target.



  • I think, ideally, any intent that may fail even after getting an OK, would be logged, so there's a straightforward way to check for success/failure/partial success. That would include move intents. To me, detecting collisions is about the same as checking for a failed/partial transfer, it's possible without event logs, but it's cumbersome.


  • Dev Team

    @eduter We wouldn't be able to maintain such amount of internal network traffic in our cluster. Also, it would increase CPU parsing cost for players as well.



  • I'm fine with no move, just checking. It'd be useful, but it's trackable except when they move to an exit tile (maybe EVENT_EXIT?), so that's fine.

    RMA is going to create a lot of events, but I guess it's rare so that's not going to be much of CPU hit in general.


  • Dev Team

    @tigga EVENT_EXIT looks interesting, we have to consider that.



  • It might also be useful to have an EVENT_ENTER instead of having to search every creep in the room for hostiles

    👍


  • Looks awesome, I like the idea of EVENT_ENTER & EVENT_EXIT.

    The only other event I can think of is EVENT_DIE, but this maybe covered by the new tombstone functionality.

    👍

  • Overlords

    How about EVENT_DESTROY? There is currently no easy way to see when a structure is destroyed except for storing all structures in Memory and comparing on a regular basis. It would be triggered on the use of destroy() or when the structure hitpoints reach zero. I think that would be very useful.


  • Dev Team

    @kamots What is the use case here? How do you check what structure is destroyed without storing it in Memory? We'd need to duplicate some structure info in the event data, which is not very optimal.



  • My use case for this would be to be able to do something specific when a structure is destroyed, such as trigger safe mode or add a new construction site to replace the destroyed structure.

    I would be happy to have a flag in EVENT_ATTACK to say whether or not the object was destroyed by the attack.

    👍

  • Dev Team

    @stevetrov I mean, how do you get rid of storing and comparing in Memory, if you only have targetId in the event data, and Game.getObjectById(targetId) === null?



  • @artch said in Draft: room event log:

    @stevetrov I mean, how do you get rid of storing and comparing in Memory, if you only have targetId in the event data, and Game.getObjectById(targetId) === null?

    The difference with server side code is that it is already processing the intents that caused the damage.

    Although thinking about it, IIRC destruction is not determined at the time damage is applied, its determined after the heal is applied. So an object EVENT_DESTROY would make more sense.

    Is there a reason you cant create the EVENT_DESTORY object at the same time that you detect the creep / structure is dead server side?


  • Dev Team

    @stevetrov You don't seem to get the point. I don't mean server-side logic, it's trivial. My point is that this event would look like this:

    {
      type: EVENT_DESTROYED,
      objectId: '54bff72ab32a10f73a57d017'
    }
    

    You have to store your structures info in Memory in order to do something useful with this objectId. But if you're storing your structures in memory already, it's trivial to check Game.structures[id], and it's easier than looking for EVENT_DESTROYED events every tick.



  • @artch said in Draft: room event log:

    Ah i c your point now

    How about:

    { type: EVENT_STRUCTURE_DESTROYED, objectId: '54bff72ab32a10f73a57d017' structureType: STRUCTURE_RAMPART, pos: { x :23, y: 35, roomName: "E1N1" } }

    And for creeps we could have

    { type: EVENT_CREEP_DESTROYED, name: "MyAwesomeCreep", deathReason: <oldAge|suicide|murdered> }

    The later would provide an alternative to comparing Game.creeps & Memory.creeps every tick.

    👏

  • Dev Team

    Keep in mind events are not user-specific, they are exposed to all users with an access to the given room in exactly the same form, so you cannot distinguish your creeps/structures from another player's this way. And we cannot add username property here for technical reasons.


  • Culture

    @stevetrov EVENT_CREEP_DESTROYED is already easy, tombstones already provide that information.



  • {
       type: EVENT_DESTROYED,
       structureType: STRUCTURE_SPAWN
    }
    

    would be enough for me. I don't care where it was destroyed, or what it used to be, but if an important structure goes down, I need to look at creating a new one and/or starting safe mode.



  • @artch said in Draft: room event log:

    Keep in mind events are not user-specific, they are exposed to all users with an access to the given room in exactly the same form, so you cannot distinguish your creeps/structures from another player's this way. And we cannot add username property here for technical reasons.

    Sounds like the EVENT_CREEP_DESTROYED functionality is covered by tombstones, so EVENT_STRUCTURE_DESTROYED should suffice and doesn't reveal any user specific information.


  • Dev Team

    @stevetrov Although, some rare use cases are still possible, when there are leftovers of another player's structures, and their destruction will likewise trigger these events.


  • Culture

    @stevetrov said in Draft: room event log:

    Sounds like the EVENT_CREEP_DESTROYED functionality is covered by tombstones, so EVENT_STRUCTURE_DESTROYED should suffice and doesn't reveal any user specific information

    Which reminds me, It would be nice to have a pile of rubble for some ticks when a building is destroyed. This way you'd have tombstones for structures.

    EVENT_STRUCTURE_DESTROYED seems overkill.
    I think the event EVENT_ATTACK would cover most of the issues here. Maybe add destroyed: true|false could be added so you won't do a Game.getObjectById(data.targetId) and get null back.

    👍