Command line utility for parsing detailed Steam stat information.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
James Hofstra 7767aceba4 Added basic CSV export for global stat history. 1 month ago
LICENSE.md Initial commit 6 months ago
README.md Initial commit 6 months ago
steam_stat_utils.py Added basic CSV export for global stat history. 1 month ago

README.md

Steam Stat Utils

Command line utility for parsing detailed Steam stat information.

Background

steam_stat_utils.py fetches data primarily from two sources: the Steam client's local filesystem cache and the Steam Web API. With this information you can view global stats as well as signed-in users’ stats.

You can also dump raw data for local/offline playtesting, such as with Goldberg Emulator. Steam's copy of data can change over time and as your games receive major updates, so this process should be repeated regularly.

Usage

Usage details are in development and likely to change with future commits.

steam_stat_utils.py path/to/steam_dir appid [userid]

Requirements

  • Python 3.5 or higher
  • vdf

Tested Configurations

  • Python 3.5.3 on Debian GNU/Linux (WSL)

Planned Additions and Improvements

  1. Reading/writing average-rate type stats (currently treated the same as floating-point type)
  2. Adding and improving usage parameters
  3. Writing default values to stats.txt file format used by Goldberg Emulator

Limitations

  • Writing raw data back to Steam's local cache is not supported. If you want to manipulate your own player stats, look up Steam Achievement Manager.
  • The current version of Goldberg Emulator doesn't support achievements or global stats yet. To enable global stats support, I am using a custom build with the following changes (as of August 2019):
  1. In dll/local_storage.h add the following preprocessor directive next to the other defines near the top of the file:
#define GLOBALSTATS_STORAGE_FOLDER "globalstats"
  1. In dll/steam_user_stats.h replace the two GetGlobalStat placeholder functions with these implementations:
// Gets the lifetime totals for an aggregated stat
bool GetGlobalStat( const char *pchStatName, int64 *pData )
{
    PRINT_DEBUG("GetGlobalStat %s\n", pchStatName);
    if (!pchStatName || !pData) return false;
    std::lock_guard<std::recursive_mutex> lock(global_mutex);

    int read_data = local_storage->get_data(GLOBALSTATS_STORAGE_FOLDER, pchStatName, (char* )pData, sizeof(*pData));
    if (read_data == sizeof(int64))
        return true;

    return false;
}

bool GetGlobalStat( const char *pchStatName, double *pData )
{
    PRINT_DEBUG("GetGlobalStat %s\n", pchStatName);
    if (!pchStatName || !pData) return false;
    std::lock_guard<std::recursive_mutex> lock(global_mutex);

    int read_data = local_storage->get_data(GLOBALSTATS_STORAGE_FOLDER, pchStatName, (char* )pData, sizeof(*pData));
    if (read_data == sizeof(int64))
        return true;

    return false;
}