Page 1 of 1

Kill counting

Posted: Wed Aug 06, 2008 10:17 am
by that guy
The question has arisen multiple times as to how to accurately determine how lethal the player has been. As I see it there are two possible approaches. Which to people prefer? Can people think of additional pros/cons. Note that this mechanism is entirely unrelated to the conedit interface.

1) Increment a counter every time there is a death for which the player is the killer. This was suggested by nick (it sounds obvious but its not the way IS did it). DDL has already written a function which detects deaths so it would simply be a question of modifying this function to determine the correct flag (code already exists to do this) and increment it.

Pros:
- Simple
- Dynamic (i.e. flag always contains the correct value)

Cons:
- In order to determine percentage of people killed you still need to know how many people there were originally which requires you to count living pawns. You get this count practically for free with the second method.
- Doesn't consider Alginon kills e.g. dropping a crate of tnt on someone (or killing an unconscious body). As such it has the potential to understate kills.
- Could get messy for special pawns (like Athena who can die multiple times).

2) Count living pawns on map exit and subtract from original living pawns to determine killed pawns. Carcii for which the killer is not the player or which are unconscious add to the living pawn count.

Pros:
- Already implemented

Cons:
- Kinda messy
- Only correct for a given map if the player is currently not in that map.
- Gets very messy (and possibly impossible) to handle pawns that leave the map through alternative means (e.g. the leaving state).
- If it cannot determine who killed a pawn (e.g. if the pawn was gibbed) it considers them to be killed by the player. As such it is likely to overstate the player kills.

Posted: Wed Aug 06, 2008 3:07 pm
by Jonas
Well, the pro on that second method is a very big pro.

But I'd say let it depend on how much work is involved in making the current system ignore pawns that leave without dying. A possible complication with any such fix is that some pawns are set to leave the map when they're fleeing, which means we can't always depend on pre-defined exceptions. But I'm not sure any pawns are set to that in maps we count kills on.

If you think it'd be easier to implement system 1 rather than fix system 2, go ahead.

Regardless of what you choose, you have to make it absolutely clear to me how the ConEdit interface works, because I can't figure out if it counts more than, less than, more than or equal to, or less than or equal to. It's a mess.

Posted: Wed Aug 06, 2008 3:18 pm
by DDL
You could always alter state leaving so that instead of destroying themselves they just leaveworld() or something similar.

Basically, you've already got your own pawn class, and it's really easy to distinguish between a pawn wandering off and being destroyed and a pawn taking damage, spawning a carcass and being destroyed.


Also, I already wrote a function which detects deaths? I did? I mean, I might've done (god knows I'm losing track) but I suspect I'm being given credit for someone else's work... :D

Posted: Wed Aug 06, 2008 3:23 pm
by Jonas
Well I'm no programmer, but that does sound like a pretty good solution!

Posted: Wed Aug 06, 2008 3:36 pm
by DDL
Also, for the former suggestion, it's also really easy to check a carcass's killerbindname/killer/killeralliance when it transitions from bNotDead to..well, dead: if they're not the same as the intigator of the damage that caused the transition..then oop: change em to reflect the fact that no matter WHO KO'd the carcass, it was THIS person that actually killed them.

Oh, and regarding killing people with crates (or TNT crates), doesn't the game store the instigator of the deco, and deliver the damage as if it were instigated by them?

And if so, simply make sure the instigator of a crate flying through the air en route to some poor firewalls cranium is..the person who flung the crate.

Posted: Wed Aug 06, 2008 4:21 pm
by that guy
Well technically the function already existed you just overrode it as part of the custom difficulty code.

I should point out that the not already implemented method is so trivial to implement it could almost be considered implemented.

You can detect pawns being destroyed through means other than being killed however the easiest way to do it is probably to just count them when they -are- killed. I'm not sure how difficult it would be to adjust the leaving state. I would assume not very though you don't really have the already implemented advantage when you start to modify it.

I had considered the instigator thing and I'm not honestly sure what happens. I suspect however that it would be possible to rig it so you're not the instigator.

Posted: Wed Aug 06, 2008 4:28 pm
by that guy
I've looked into it and it looks like you're right about damage the player is indirectly responsible for.

Posted: Wed Aug 06, 2008 6:24 pm
by Jonas
Christ, well I dunno. Just fix it ;)