Draft: room event log
-
There's no EVENT_MOVE in the example, is that also going to be an event? I'd also be interested in seeing what rangedMassAttack looks like.
Parse times seem like they should be small. I'd guess <0.1 CPU for most late game rooms.
-
@toolmaker No, it's not possible, otherwise we would need to duplicate filtered data in the backend.
-
@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.
-
@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.
-
@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.
-
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.
-
@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.
-
@stevetrov I mean, how do you get rid of storing and comparing in Memory, if you only have
targetId
in the event data, andGame.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?
-
@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 checkGame.structures[id]
, and it's easier than looking forEVENT_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.
-
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.
-
@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.