parser icon indicating copy to clipboard operation
parser copied to clipboard

Add a warding processor

Open micaelbergeron opened this issue 8 years ago • 12 comments

~~Please consider this as a draft~~

This processor may be used to track down warding events, such as Counterwarding, Placement or Expiry. It uses the combat log events correlated with entity life state tracking.

Sample log output:

-- Ward placed
{"time":13,"type":"obs","key":"[78, 80]","slot":0,"x":78,"y":80,"z":130,"entityleft":false,"ehandle":4195051}
{"time":11,"type":"sen","key":"[78, 80]","slot":0,"x":78,"y":80,"z":130,"entityleft":false,"ehandle":4850406}

-- Ward expired
{"time":251,"type":"sen_left","key":"[78, 80]","slot":0,"x":78,"y":80,"z":130,"entityleft":true,"ehandle":4850406}
{"time":373,"type":"obs_left","key":"[78, 80]","slot":0,"x":78,"y":80,"z":130,"entityleft":true,"ehandle":4195051}

-- Ward countered
{"time":22,"type":"obs_left","key":"[78, 82]","slot":0,"attackername":"npc_dota_hero_abaddon","x":78,"y":82,"z":130,"entityleft":true,"ehandle":14631244}
{"time":50,"type":"sen_left","key":"[78, 80]","slot":0,"attackername":"npc_dota_hero_abaddon","x":78,"y":80,"z":130,"entityleft":true,"ehandle":9208152}

I still need to test for controlled minions counterwarding.

Feel free to add your thoughts.

micaelbergeron avatar Sep 14 '16 18:09 micaelbergeron

@spheenik please have a look at the processor.

micaelbergeron avatar Sep 14 '16 18:09 micaelbergeron

Did you consider submitting this directly to clarity?

howardchung avatar Sep 14 '16 18:09 howardchung

Yes I did, but as opendota would be the first project to use this code I think it could be extracted down the road. I don't know how often you update the clarity's version, so I'd rather have this code here than in clarity-examples.

micaelbergeron avatar Sep 14 '16 18:09 micaelbergeron

I might be porting the SpawnsAndDeaths processor from clarity-examples to clarity, so that it's events would be available to everyone. Then your Wards-Processor could be simplified.

I think instead of include the SpawnsAndDeaths, I think a OnFieldPathChanged(Class entityClass, FieldPath path) would be a more useful implementation. Just a suggestion.

One thing that came to my mind: What happens if a ward dies of old age, and another one gets countered on the same tick, and the update of the lifestate for the one dying of old age comes first?

Your question is very good, in fact I didn't yet found a way to handle these. I have a replay which represent this exact problem and the output is wrong. This is my next problem to tackle, but I could use your insights on this one.

--- 4 wards killed on the same tick, notice the order (sen, obs, sen, sen)
{"time":74,"type":"DOTA_COMBATLOG_DEATH","value":0,"attackername":"dota_unknown","targetname":"**npc_dota_sentry_wards**","sourcename":"dota_unknown","targetsourcename":"npc_dota_sentry_wards","attackerhero":false,"targethero":false,"attackerillusion":false,"targetillusion":false,"inflictor":"dota_unknown","gold_reason":0,"xp_reason":0}
{"time":74,"type":"DOTA_COMBATLOG_DEATH","value":0,"attackername":"dota_unknown","targetname":"**npc_dota_observer_wards**","sourcename":"dota_unknown","targetsourcename":"npc_dota_observer_wards","attackerhero":false,"targethero":false,"attackerillusion":false,"targetillusion":false,"inflictor":"dota_unknown","gold_reason":0,"xp_reason":0}
{"time":74,"type":"DOTA_COMBATLOG_DEATH","value":0,"attackername":"dota_unknown","targetname":"**npc_dota_sentry_wards**","sourcename":"dota_unknown","targetsourcename":"npc_dota_sentry_wards","attackerhero":false,"targethero":false,"attackerillusion":false,"targetillusion":false,"inflictor":"dota_unknown","gold_reason":0,"xp_reason":0}
{"time":74,"type":"DOTA_COMBATLOG_DEATH","value":0,"attackername":"dota_unknown","targetname":"**npc_dota_sentry_wards**","sourcename":"dota_unknown","targetsourcename":"npc_dota_sentry_wards","attackerhero":false,"targethero":false,"attackerillusion":false,"targetillusion":false,"inflictor":"dota_unknown","gold_reason":0,"xp_reason":0}

-- 4 triggered events (sen, sen, sen, obs)
{"time":74,"type":"**sen_left**","key":"[80, 80]","slot":0,"attackername":"dota_unknown","x":80,"y":80,"z":130,"entityleft":true,
"ehandle":2228562}
{"time":74,"type":"**sen_left**","key":"[80, 80]","slot":0,"attackername":"dota_unknown","x":80,"y":80,"z":130,"entityleft":true,
"ehandle":12026197}
{"time":74,"type":"**sen_left**","key":"[78, 82]","slot":0,"attackername":"dota_unknown","x":78,"y":82,"z":130,"entityleft":true,
"ehandle":13222238}
{"time":74,"type":"**obs_left**","key":"[76, 84]","slot":0,"attackername":"dota_unknown","x":76,"y":84,"z":130,"entityleft":true,
"ehandle":10502497}

To me that means the killer of the second sentry is wrong (and the obs too).

I'm wondering how frequent same-tick events happens though. Thank you for your time.

micaelbergeron avatar Sep 14 '16 19:09 micaelbergeron

Hmm, the problem is that the field path differs between different entity types, and there is no way to parametrize the annotation to tell it which fieldpaths you are interested in. One could hack it by doing @OnFieldPathChanged(entityClassPattern, propertyName) and postpone the computation from propertyNameto fieldPath to when that can be done. You could then do

@OnFieldPathChanged("CDOTA_NPC_Observer_Ward(_Truesight)?", "m_hLifeState")
public void onLifeStateChanged(Matcher matcher, Entity e, FieldPath fieldPath) {
  // use matcher to find out if truesight or not, 
  // and get the current value from the entity using the fieldpath
}

spheenik avatar Sep 14 '16 19:09 spheenik

I've finally found time to finish this parser. I've tested on 5 replays with more than 10 counter-wards and I hit 100% success rate. I think this can be merged.

I'll start working on the UI.

micaelbergeron avatar Oct 24 '16 21:10 micaelbergeron

You can preview the wardmap here: http://beta.opendota.com/matches/2731466093/vision

It currently doesn't support timeline (it just displays all the wards placed when the user is selected).

howardchung avatar Oct 25 '16 02:10 howardchung

Can you sync master to this PR?

howardchung avatar Oct 25 '16 02:10 howardchung

@spheenik could you give this another once-over?

howardchung avatar Oct 25 '16 12:10 howardchung

@spheenik I'm not using the new stuff you've pushed to clarity 2.2, I'll wait for opendota to catch up the version before doing this.

micaelbergeron avatar Oct 25 '16 14:10 micaelbergeron

You can bump the version to 2.2 in this PR. I don't believe there are any breaking changes.

howardchung avatar Oct 25 '16 17:10 howardchung

Needs to be rebased against master (and I think clarity 2.2 has some functionality that can make this PR simpler)

howardchung avatar Apr 08 '17 18:04 howardchung