s2protocol
s2protocol copied to clipboard
'_gameloop' times being off?
Im converting my sc2Reply to json and for the last SPlayerStatsEvent
I am getting
{
"m_playerId": 1,
"_eventid": 0,
"_event": "NNet.Replay.Tracker.SPlayerStatsEvent",
"_bits": 1312,
"_gameloop": 38911,
"m_stats": {
"m_scoreValueVespeneUsedCurrentTechnology": 2925,
"m_scoreValueVespeneFriendlyFireArmy": 0,
"m_scoreValueMineralsFriendlyFireTechnology": 0,
"m_scoreValueMineralsUsedCurrentEconomy": 12475,
"m_scoreValueVespeneLostEconomy": 483,
"m_scoreValueMineralsUsedCurrentArmy": 4700,
"m_scoreValueMineralsKilledArmy": 12200,
"m_scoreValueVespeneCollectionRate": 1478,
"m_scoreValueMineralsUsedActiveForces": 4700,
"m_scoreValueMineralsCollectionRate": 2525,
"m_scoreValueWorkersActiveCount": 72,
"m_scoreValueVespeneUsedCurrentArmy": 3925,
"m_scoreValueVespeneLostArmy": 1917,
"m_scoreValueMineralsKilledEconomy": 5700,
"m_scoreValueMineralsUsedCurrentTechnology": 8625,
"m_scoreValueVespeneUsedInProgressArmy": 0,
"m_scoreValueMineralsLostEconomy": 3563,
"m_scoreValueMineralsCurrent": 39269,
"m_scoreValueMineralsLostArmy": 3622,
"m_scoreValueVespeneKilledArmy": 7900,
"m_scoreValueVespeneKilledTechnology": 25,
"m_scoreValueVespeneKilledEconomy": 0,
"m_scoreValueMineralsUsedInProgressTechnology": 100,
"m_scoreValueMineralsUsedInProgressArmy": 0,
"m_scoreValueMineralsFriendlyFireArmy": 0,
"m_scoreValueVespeneUsedActiveForces": 3925,
"m_scoreValueVespeneCurrent": 21883,
"m_scoreValueMineralsLostTechnology": 2139,
"m_scoreValueMineralsUsedInProgressEconomy": 0,
"m_scoreValueMineralsFriendlyFireEconomy": 0,
"m_scoreValueVespeneUsedInProgressTechnology": 0,
"m_scoreValueFoodMade": 1134592,
"m_scoreValueMineralsKilledTechnology": 350,
"m_scoreValueVespeneLostTechnology": 100,
"m_scoreValueVespeneFriendlyFireEconomy": 0,
"m_scoreValueVespeneUsedInProgressEconomy": 0,
"m_scoreValueVespeneUsedCurrentEconomy": 0,
"m_scoreValueVespeneFriendlyFireTechnology": 0,
"m_scoreValueFoodUsed": 647168
}
I know that ladder games are at a faster speed (x1.4) than real time. However, when I load the same sc2Reply into GGGreplays.com, they are telling me the total game time is 29minutes 50seconds. No matter how I do the math I cannot get my game times to line up with theirs - so am I completely looking at this wrong or is their math off?
Here is the replay in question - Eastwatch LE (251).zip
Thanks for the support,
- Nef
Looks like the replay length is 28:59 (so yes GGGreplays time is off)
How I get the game length for sc2replaystats is the following:
LOTV floor(m_elapsedGameLoops / 11.2 )
HOTS/WOL floor(m_elapsedGameLoops / 8)
You can use the SPlayerStatsEvent but that's harder to deal with, with team games.
For the PlayStatsEvents getting the game loop i'm doing (floor(($object->_gameloop/$this->_base_divide_time)/7)*7);
Since I know that the replay keeps track of the game loop every 7 seconds (for lotv) , so i'm finding the closest 7 seconds.
Where $this->L_base_divide_time = 22.29 for LOTV and 16 for HOTS/LOTV
Alright so for the above snippet, if I use this equation -
print((floor((38911/22.29)/7)*7)/60)
(how I understand your equation) -- I get 29.05 minutes
print(((floor((38911/22.29)/7)*7)/60))
-- I get 29.0 minutes
As a side note - where is 22.29 coming from, why is floor necessary, and why does blizzard just put these in seconds from epoch? haha
I don't recall where I got the 22.29 from, I believe it was from trial and error :)
I copied it quickly out of my code, you wont need the floor most likely. What I found is my 22.29 is not exactly correct, its more than close enough that I find the right value but it does cause some issues if I don't floor it for how i'm building the active army chart on the site.
At "Normal" game speed, the game runs at 16 gameloops per second. At "Faster" game speed, it runs 40% faster. So the accurate number to divide by is likely (16 * 1.4) = 22.4.
thank you guys for the support - I know for a fact that I never would of put that together.
and @amartin916 - I just noticed that dividing by 7 and then multiplying by 7 equals 1
(((38911/22.4) ~~/ 7~~ ) ~~* 7~~ ) / 60) = (38911/22.4) / 60)
Good catch! I will update my code :)