Categorygithub.com/Cludch/csgo-tools
module
2.8.2+incompatible
Repository: https://github.com/cludch/csgo-tools.git
Documentation: pkg.go.dev

# README

CSGO Demo Tools

The CSGO tool suit can automatically detect and download new CSGO official matchmaking demos using the GameCoordinator. In order to do this, a few API credentials and a separate Steam account is needed. The application creates a CSGO game sessions using the separate account and uses the Steam Web API to check whether a new demo can be fetched. If that's the case, the application sends a full match info request to the game's GameCoordinator. The GC then returns information about the match which also contain a download link.

Tools

The toolset currently features the following tools. All tools share one MongoDB database instance.

Auth

The auth service enables a user to sign in using his / her own Steam account. The generated token can be used with other services at a later point.

Faceit API client

The API client consumes Faceit's API to get the latest matches and prepares these to be downloaded.

ValveAPI client

The API client consumes Valve's game history API and saves the game share codes in the database. In order to add a new steam / csgo user, whose demos should be monitored, a user must be manually created in the database.

Game client

The game client uses the CSGO gamecoordinator to talk to the ingame "API". By doing so, the tool can request match information, history and most importantly the download links for each demo.

Demo Downloader

The demo downloader takes the demo urls from the database and downloads them if they are missing.

Demoparser

The demo parser parses the previously downloaded demo files and calculates the following statistics for each player:

  • Kills, Deaths, (Flash) Assists, Headshots and percentage
    • Information about the kill such as wallbang, flashed, through smoke
    • Also on per weapon basis
  • Player MVPs
  • Map
  • Team Scores

When a new demoparser version gets released, the tool will automatically reparse demos, which were parsed with an older version. Therefore, new statistiscs will also be added for older demos. This, however, requires the demos to be permanently persisted.

REST API

The REST api serves basic match and player stats via the following routes.

RouteDescription
/matchLists all available matches.
/match/:idServes information and outcome about one specific match.
/player/:idLists information about one player.
/player/:id/statsCalculates and serves average stats for one player.

Usage

Get the latest binary and set up your demo location and the config file.

config.json

Copy the config.json.example in the configs dir and rename it to config.json in the same dir.

The demosDir setting is the directory, in which the demos should be stored (e.g. demos/). The debug parameter can be enabled to receive a few more debug output.

You can also use ENV vars to override single or set all configuration variables. The formatting for the configuration is as with the JSON configuration. The ENV base is CSGO. The Steam two factor secret turns into STEAM_TWOFACTORSECRET.

Auth

KeyValueExplanation
hosthttp://localhost:8080The host url for the authentication callback.
secrethttp://localhost:8080The authentication token secret. E.g. openssl rand -base64 32

Steam

KeyValueExplanation
apiKey12345The Steam Web API key. Can be generate here
usernameuserSteam username
passwordtotally_secretSteam password
twoFactorSecretaGV5IQ==Base64 encoded two factor secret. Can be generated using e.g. the Steam Desktop Authenticator

Faceit

KeyValueExplanation
apiKey12345The Faceit API key. Can be generate here

Database

KeyValueExplanation
hostlocalhostThe database host
port27017The database port
usernamecsgoUsername of the database user
passwordbSecret password of the database user
databasecsgoThe database name to store the data in

Parser

KeyValueExplanation
workerCount5The amount of workers to parellely parse demos

Disclaimer

This is my first ever Golang project, thus you might find some bad practice and a few performance issues in the long run. The project structure is horrible but it works for now. If you have suggestions please go a head and create an issue. This would help me a lot!

This tool is not affiliated with Valve Software or Steam.

Other projects that helped me a lot

# Packages

No description provided by the author
No description provided by the author