Count your hours played via FAForever
-
I've created a PowerShell script to count the amount of game time recorded in your FAForever replays. (Personne#4604) discovered that it didn't work for earlier formats of replays and that has been fixed up.
I'm using PowerShell 7.1.2 but I've successfully tested this in PowerShell 5.1
$replays = Get-ChildItem C:\ProgramData\FAForever\replays\*.fafreplay | Sort-Object LastWriteTime -Descending #$unixtime = (Get-Date 1/1/1970).AddHours((Get-TimeZone).BaseUtcOffset.TotalHours) #The replays incorrectly use your local time zone so I don't bother adjusting for it $unixtime = (Get-Date 1/1/1970) $playtime =0 foreach ($r in $replays) { Remove-Variable j -ErrorAction SilentlyContinue $j = (Get-Content $r.FullName)[0] | ConvertFrom-Json if ($j.launched_at -gt 0) { $playtime += (New-TimeSpan ($unixtime.AddSeconds($j.launched_at)) ($unixtime.AddSeconds($j.game_end))).TotalSeconds } else { $playtime += (New-TimeSpace ($unixtime.AddSeconds($j.game_time)) ($unixtime.AddSeconds($j.game_end))).TotalSeconds } } $playhours = [Math]::Floor($playtime/60/60) $playminutes = [Math]::Floor( (($playtime/60/60) - $playhours) * 60) Write-Output "You've played for $($playhours) $(if ($playhours -ne 1) {"hours"} else {"hour"}) and $(if ($playminutes -ne 1) {"$($playminutes) minutes"} else {"$($playminutes) minute"}) in $($replays.count) replay$(if ($replays.count -ne 1) {"s"})."
-
677 hours over 1553 replays. That's sufficient time for three master courses at the university
-
Didn't we have a webtool reading that from the API somewhere? (So it works without local replays)
-
@Brutus5000 said in Count your hours played via FAForever:
Didn't we have a webtool reading that from the API somewhere? (So it works without local replays)
I've been told by (MostLostNoob#6672) that Gieb has a web tool available.
http://95.216.153.185/faf-web-collection-master/index.php
Just click 'timewasted'. -
1165 hours in total - that is sufficient for more than five master courses at the university
edit: I won't look at my steam time.
-
how does it count it?
If you count by replays then you will only see ingame timer and that does not account for slowdown.
If you use API then some replays seem to have broken timer, like as if game was played longer than a day (at least i think i saw something like that in the vault).also will it count early games that were not even a *.fafreplay but *.scfareplay ??
I don't think it really matter how long i have been playing, but having those stats is pretty fun, but i doubt they are accurate right now... would be funny to know lobbysim times
-
I'm catering for two versions of the .fafreplay files only at the moment. The two properties we have available are when the game was launched/started and the time when it ends. It doesn't use game time but system time so slowdowns shouldn't affect us.
My main goal/ inspiration here was to quickly work out how long I've played in FAF instead of Steam as Steam doesn't count the time we play in FAF. But then others informed me of the older format.
I took a quick look at the .SCFAreplay files now and it looks like the metadata is also present. I personally don't need that since I am just adding FAF play time to Steam play time. That said I'd absolutely help out if you want me to take a look at that. (Grabbing the metadata of the oldest replay you have will help me scope out possible version variations - also the path to your replays to be sure which should be something like %userprofile%\Documents\My Games\Gas Powered Games\Supreme Commander Forged Alliance\replays*)
Edit: Also it's worth noting that the standard Forged Alliance replays had to be saved by the user and weren't automatically saved.
-
@furyritchie i asked about scfareplay because FAF also used this format in early days and i have been playing since very early days...
also unfortunately i have been also playing by IP with friends before even playing at GPGnet and playing by ip+vpn using Hamachi, Garena, Tunngle while also playing in GPG before faf and before faf has been on steam... and ALSO xDD there was fa-ladder project before faf also was playing that... even tho i don't play to often i think my hour count would be pretty big (and they all don't save replay automaticly)
also in early days, if you had lots of replays in your local folder vault tab would take long to load, so about every 500 replays i'd had to copy them somewhere else so using this tool for me would be kinda annoying, probably would need to search in multiple folders and then addup results
-
@ZLO I'd be happy to help with that. Are you on discord?
-
Btw I have a cli tool that is able to parse the
.scfareplay
format. It can at least tell you the in game time for those replays, I don't know if they have the real time though (I kindof doubt it). I can send a windows binary if you want it.$ fafreplay info 9001733.scfareplay processing replay: 9001733.scfareplay Supreme Commander v1.50.3701 Replay v1.9 The Pyramid 5v5 (00:01:38) The Pyramid is now available for 5v5 gameplay. Map edit by Artifax Team 1 civilian (AI) 5 Team 2 NeoTek (0) Aeon
The source code:
https://gitlab.com/Askaholic/faf-replay-parser