Handle statistics
Description
Statistics need to be saved in the database. These include among other things, number of kills per each weapon, number of deaths per each weapon, hits with certain weapon damage type, etc.
How stats work
endpoint /ut/api/stats/accountId/{id}/bulk/window/{statsType} is used to retrieve all stats. and stats.json in cloudstorage contains score of last 5 played games.
All statistics are collected via analytics. that is on domain datarouter.ol.epicgames.com and endpoint /datarouter/api/v1/public/data + query that looks in my case like this:
?SessionID=%7BD9873B18-401E-A352-9120-D3BB8FB2E4CB%7D&AppID=UnrealTournament.Dev&AppVersion=1.0.0.0%20-%20%2B%2BUT%2BMain-CL-3525109&UserID=9c808754479eaa36e7efe896f204da11%7C0b0f09b400854b9b98932dd9e5abe7c5%7C3d42b762-3e87-4d29-90d8-7f36f619c3ae%7C%7COSS&AppEnvironment=datacollector-binary&UploadType=eteventstream
There is no way to reroute this domain through Engine.ini, so without client modification you need to use hosts file.
Helpful official source code
UT4 Source code comes in handy here because we can figure out all possible types of events that get sent out by studying file UnrealTournament/Source/UnrealTournament/Private/UTAnalytics.cpp.
reading Documents\UnrealTournament\Saved\Stats\stats.html is also useful as it contains all names and meanings of retrieved stat keys. This file is created after you look at stats inside the game.
Desired functionality
statsType in stats retrieval endpoint is either alltime, monthly, weekly, daily. There should probably be buckets for each of these. So all analitycs should at first be saved in a daily bucket, then after 24h all these should be moved to weekly bucket and so on. then at retrieval of say montly we would combine and return stats from daily, weekly and monthly.
Resources
I am also providing 2 fiddler classic session archives which contain all requests and responses to and from official epicgames servers. 1) stats and gameplay 2) just gameplay
URLs for resources are this same
I fixed the links
I will try to implement this feature, you can assign it to me.
@belmirp I think you must have made a PR before i can assign you. i'll remember you're working on it. and others will see in the comments hopefully.
Useful links:
- StatManager https://github.com/EpicGames/UnrealTournament/blob/clean-master/UnrealTournament/Source/UnrealTournament/Private/StatManager.cpp
- https://github.com/EpicGames/UnrealTournament/blob/clean-master/UnrealTournament/Source/UnrealTournament/Private/UTAnalytics.cpp
- https://github.com/EpicGames/UnrealTournament/blob/clean-master/UnrealTournament/Source/UnrealTournament/Private/StatNames.cpp (here you can find
RankedDuelSkillRating,RankedCTFSkillRating,RankedShowdownSkillRatingandRankedFlagRunSkillRatingleagueName - I saw this in my logs foraccount/{id}/league/{leagueName}yesterday - https://github.com/EpicGames/UnrealTournament/blob/clean-master/UnrealTournament/Source/UnrealTournament/Private/UTPlayerState.cpp#L1606