Winner

17 views
Skip to first unread message

Weston

unread,
Jul 31, 2011, 7:32:36 PM7/31/11
to phpsc2replay
First of all I Love that you are writing this. thank you, thank you,
thank you.
I've got a quick question, Is there anyway to improve the success of
it determining the winner?

from my personal experience i had 100% success of it determining
winner of my ladder matches.
It did have some trouble with custom games.

Is winner parse 100% or close to perfect for ladder games?

spa...@sc2buddy.net

unread,
Jul 31, 2011, 7:36:35 PM7/31/11
to phpsc2replay
There must be a way as SC2gears gets the winner accurately.

The method this script uses is by who leaves the game last, which when
all buildings are destroyed is essentially whoever clicks "score
screen" first, so random.
I don't know enough about the format to work out any other way of
determining the winner, and i assume the guy who's doing it can't
either else they would have.

How did you manage to get 100% rate on ladder games?

ta

Lauri Virkamäki

unread,
Aug 1, 2011, 1:06:45 PM8/1/11
to phpsc2replay
The winner detection mechanism is as good as it can get. The only way
to do it is to determine the winner based on players leaving the game
and as you already pointed out, in games where all buildings are
destroyed the parser may get it wrong. Apart from this exception, the
winner should be parsed 100% accurately for 1v1 games.

The parser should also handle team games with multiple players/teams
correctly but with these it depends on when the recorder left the
game. For example take a 3v3 game, where first one player from team A
leaves, and the recorder of the replay is also in team A and leaves
right after that. This leaves the game with a 1v3 situation at the end
of the replay, and in this case it is obviously impossible to
determine who won. This, however, is reflected by the isWinnerKnown()
function which returns false if there wasn't enough data to determine
the winner.

For custom gametypes the parser may or may not work since the players'
teams are recorded in an interesting way that varies based on the
gametype. This should be fixable on a per-gametype basis but I will
need example replays that do not parse the winner properly (or in
which the parser goes otherwise broken).

Lauri

spa...@sc2buddy.net

unread,
Aug 1, 2011, 1:11:06 PM8/1/11
to phpsc2replay
Hi Lauri,

I have studied the files intensively over the last few weeks and agree
that I cannot see how the winner can be determined. however if you
take a look at sc2gears and hand it the all buildings destroyed
replays, it gets it right 100% of the time.

I've noticed it also logs references for each building that this
parser does not so maybe the replay stores when each building was
destroyed? and by determining that 1 user has no buildings left they
can determine the winner perhaps?

Graylin Kim

unread,
Sep 18, 2011, 9:32:48 AM9/18/11
to phpsc2...@googlegroups.com
I'm not sure if phpsc2replay looks at this yet so apologies if this is common knowledge.

A long time ago some random person came in and edited my wiki (without telling me or saying anything) and marked one of the unknown fields on the player struct as result. This has actually been pretty accurate in my experience, although sometimes it is "unknown". I use a player leave algorithm as a back up for "unknown" situations. Not sure how helpful it is though.

See this docstring and the accompanying code for more details.

~Graylin

Weston

unread,
Oct 3, 2011, 2:54:16 PM10/3/11
to phpsc2...@googlegroups.com
love that i'm getting CC'd on this!
I've heard several different things and it's been 3-4 years since I've
programmed anything significant.
So this is a bit of a shot in the dark but.
Is there anyway to tell from the parse if players had multiple
buildings before leaving?
Don't know if this function is out there but u look like pro programmers
known:
buildings created and at what time (actually don't know if u know this
but i think so)
buildings destroyed and at what time (actually don't know if u know this again.

if u know those two things u should be able to create a running total
with time stamps for total buildings. might be in the replay i dont
know.
example:
1 building :0
2 building :25
3 building 1:40
4 building 2:52
3 building 2:54 (cancelled)
4 building 3:15
5 building 4:12
6 building 3:30
5 building 3:45 (building killed)
4 building 3:55 (building killed)
3 building 4:05 (building killed)
(this is where i don't know if a player leaves does the count go to 0
instantly? or does it stay at 3?)

now for the logic side.
player is the first person to leave the game
if player leaves:
check opponent building history
(1.2.3.4.5.6.7.8.7.8.9.8.7.6.7.8.0?)VS(1.2.3.4.5.6.7.6.7.6.5.4.3.2.1.0)
if former odds are VERY good that player lost
if ladder odds are good that player won and left first at score screen
can double check with:
check player building history
(1.2.3.4.5.6.7.8.7.8.9.8.7.6.7.8.0?)VS(1.2.3.4.5.6.7.6.7.6.5.4.3.2.1.0)
if former then former should match ladder of previous history if it
does then player left before losing all his buildings
if ladder then ladder should match former of previous history if it
does then player lost and left first

if both formers are true then quitter quit
if both ladders are true then some simultaneous nuke happened... or
can't track building history like i thought.

i know i have a weird way of explaining things but numbers for build
orders were arbitrary was just trying to get a point across
the other thing it could do is destroy all buildings instantly so
(1.2.3.4.5.6.7.8.7.8.9.8.7.6.7.8.0?) while parsed would look like
(1.2.3.4.5.6.7.8.7.8.9.8.7.6.7.8.[7.6.5.4.3.2.1.0]) but the bracketed
part would be within like .5 seconds
if this is the case would have to add a latency cap and a building cap
and do double checks to make logical guesses. (in theory a player
could nuke an opponent's last three
buildings)(1.2.3.4.5.6.7.8.7.8.9.8.7.6.7.8.7.6.5.4.[3.2.1.0]) so they
all died within .5 seconds however then so would the other players and
i'd go with a most buildings lost in the last .5 seconds is the winner
cuz blizz destroyed all theirs not a nuke. barr some rediculous low
building nuke strat vs condensed buildings i think it'd be close to
100% aka 99.9%

If u don't understand parts of my theory or there are holes like u
can't get building counts with respect to time. please let me know and
i'll try to come up with something else. ty for all that you've done
and can't wait to see what u come up with :-)

Lauri Virkamäki

unread,
Oct 3, 2011, 4:44:26 PM10/3/11
to phpsc2replay
Unfortunately any deaths or building destruction are not recorded in
the replay, so the idea would not work. I have, however, added the
winner field from the sc2reader project with the earlier algorithm as
a backup, thanks for pointing that out (whenever I looked at it it
seemed to be 2 so I never made the connection). So, assuming it is
accurate, the winner detection should now be 100% accurate for all
cases in which determining the winner is possible.

Lauri
Reply all
Reply to author
Forward
0 new messages