kinduff / csgo_exporter

A Prometheus exporter for Counter-Strike: Global Offensive.
Apache License 2.0
19 stars 3 forks source link

Dashboard not compatible with FaceIT matches #40

Open simonszu opened 3 years ago

simonszu commented 3 years ago

Just a minor bug i have discovered in the Grafana dashboard: It is not compatible with matches played on FaceIt.

The panel for presenting the result of the match (win, loss, tie) is assuming the default round number in the official league, best out of 30 rounds. However, on FaceIT you won't get a tie if both teams have 15 round wins, but it will get an overtime with an additional 8 rounds, where your team will win once it has won 5 rounds. These overtime rounds are not calculated by the dashboard yet, therefore presenting the match as a tie, when instead we have lost.

Fortunately there is a metric called csgo_last_match_metric{type="rounds"} which can be used as a base for that panel instead of the hardcoded 15 value. I will submit a PR soon, but wanted to create this issue as a global issue, maybe we will find other incompatibilities for faceIT which can be tracked here.

simonszu commented 3 years ago

Something we may need to consider too: Weapon economy does not apply to any overtime round in FaceIt. Each player starts each overtime round with 16k in cash, so the economy factor is completely ruled out. The dashboard tracks the money spent in the last game, but it isn't comparing it to any previous game, so for now, we can ignore the fact. However, this makes reasonable comparisons like "kills per money spent" or detecting eco rounds nearly impossible.

kinduff commented 3 years ago

@simonszu I've come little by little with the realization that this exporter might need to parse demos instead of relying on the bad API stats that Valve exposes.

It's a big change, might come to v2 or in another project, but I've been thinking about this for a while. Does FaceIt matches part of demo UI from CS:GO? Or do you need to download them separately?

simonszu commented 3 years ago

I am not sure what you mean exactly with "demos".

FaceIt matches are technically speaking competitive matches on custom servers. FaceIt has a client for the matchmaking, team finding and map voting, and then you have a magnetic link inside the FaceIt client which causes the CS:GO game client to automatically connect to the custom server. Since the Steam API also reports stats for games on custom servers, you can extract the game stats of FaceIt via the Steam API.

Each FaceIt match is accompanied by a spectator bot which tracks the outcome of the match and general player stats like kills, assists, death, ADR and such to compute a player's elo, but to my understanding, nothing more. All more detailed metrics like weapon shots and similar are only tracked by the game itself. I am not sure if FaceIt provides an API for their internal stats, but since it relies on a freemium model for certain features, i assume that if they have such an API, you will need to pay for it.

kinduff commented 3 years ago

Demos are the replays from the matches, these can be parsed to get super accurate stats from a game, I've found that the library https://github.com/markus-wa/demoinfocs-golang does an awesome job for this.

It's pretty similar what csgostats.gg does, or CSGO Demo Manager.

simonszu commented 3 years ago

Ah, i see. I will check if any FaceIt matches will be locally available as a demo once i get the hands on my gaming machine later. However, there is the problem of how to connect all this together. Currently the exporter only translates between the Steam API and a prometheus instance, and is, in my case, running on the same server where prometheus and grafana are deployed as well.

Most probably the demo files are only available on the computer where csgo is running on, so the connection to the exporter is not really present. If one needs to upload the demo for being parsed by the exporter, a prometheus integration does not make sense in my eyes, since it is not such a automatically and constantly changing metrics set. But there is the exception for historical data.

Maybe it's possible to upload demos automatically to the exporter host? Or the can be somehow retreived from the cloud? Although i doubt the latter one, since Valve is charging the players for exactly this functionality since the end of Operation Broken Fang.

This could be a very interesting project, without any doubt. I am a bit sad that my golang skills are not really good. For now all i can provide is a bit of CS:GO enthusiasm and some experience with monitoring and automatisation a such ;)

kinduff commented 3 years ago

I will check if any FaceIt matches will be locally available as a demo once i get the hands on my gaming machine later

Thank you!

Valve is charging the players for exactly this functionality

Exactly the reason of why I started this project, it's so dumb to charge players for stats.

Or the can be somehow retreived from the cloud

This can be done! It's very very tricky and it's the secret sauce from a lot of websites that share stats, but I already managed to get the latest game demo a couple of weeks ago programmatically.