skadistats / clarity-examples

Example code for clarity
BSD 3-Clause "New" or "Revised" License
115 stars 38 forks source link

Duplicates in new combat log example #1

Closed SomeGuy87 closed 10 years ago

SomeGuy87 commented 10 years ago

Hello again :),

I'm currently trying to classify the positions of the players from the replay ("Bot, top, mid, jungle") and want to look at last hits on neutral creeps to decide if a player was jungling since the positions overlap with normal lane positions.

To do this I used your new example for the combat log, but noticed that the problem that I previously only knew from the chatlog applies: I get multiple messages for the same event.

Example for a single kill: 950.1229: npc_dota_neutral_ogre_mauler was killed by npc_dota_hero_furion 950.1229: npc_dota_neutral_ogre_mauler was killed by npc_dota_hero_furion 950.1229: npc_dota_neutral_ogre_mauler was killed by npc_dota_hero_furion 950.1229: npc_dota_neutral_ogre_mauler was killed by npc_dota_hero_furion

This was just a single neutral, but I have four messages nonetheless. I know that a similar problem exists with chat messages and can be solved by checking if the next peek is a NetMsg. Is the solution to this problem here the same?

If any good fix is known I'd suggest to include it into the example as well.

spheenik commented 10 years ago

Hey Chris,

please include the match id! :)

spheenik commented 10 years ago

Ah, and also another hint. If you use 1.1-SNAPSHOT, there is a new Iterator type, TickIterator. I made this to circumvent such problems -> it will aggregate all packets for a tick and then only hand over control to you once all packets from that tick have been applied.

If you look closely at the combat log example, it is used there.

I also had to change the tick border from NetTick to PeekTick to make the combat log example work, this means the NetTick is now sometimes not the first packet for a tick.

If you use the tick iterator though, you should not have any duplication problems...

SomeGuy87 commented 10 years ago

Wow, I'm so sorry! I just noticed that only my integration of the example had the issue. I simply didn't see the new TickIterator. I integrated that into my main loop now and now it works just fine.

Great addition to clarity, thank you for that.