How it works inside?
By default engine support only 4 players in each team. To determine players in the world it can use "client indexes" or "character types". The character type is just value from 0 to 3 for your character like "Nick", "Ellis", "Coach" or "Rochell". Client index can be any value in range from 1 to 32. This is why game can't be more than 16vs16. Client index is a entity world identifier. For unique determine each player they has a "userid" which increased for each new connection.
But let's talk about how the "score calculation system" use this information.
In memory. Yes, it's simple. Left 4 Dead 2 have two interesting for us buffers:
- Current completion score for each player
- Completion score for each player before he die -- "death score". By default is -1.
Or if speaking in C-like programming language:
Score updated every second by special function (RecomputeVersusCompletion). After every call we got the updated buffer for current survivors team. If player die his score saved and don't compute again, just retreived from "death score" buffer. The another system use this information to show scull over progressbar.