Kill counting
Posted: Wed Aug 06, 2008 10:17 am
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.
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.