How to Calculate Time Spent Gaming?

Headshot Haven automatically combines data from gaming platforms, calculates play time, and turns session history into reports, forecasts, and Discord notifications.

Headshot Haven is an original demonstration project: a comprehensive system for collecting, processing, and analyzing player activity data in real time. It integrates Steam, PlayStation Network, and Xbox Live to show user activity across hardware platforms.

The project brings together two use cases. Players gain insight into time spent on individual titles, achievements, and their own habits. Analysts get a central session database, Excel dashboards, and models that detect trends, anomalies, and likely future activity.

Demonstration Project · Gaming Analytics

3 gaming platforms

Steam, PlayStation Network, and Xbox Live

End-to-end ETL process

API data collection, transformations, storage, and reporting

2 perspectives

Real-time information for players and user behavior analysts

Prophet and XGBoost

Models for forecasting play time and activity

Discord

Notifications about sessions, progress, and play time

Headshot Haven — a demonstration gaming analytics system: tracking play time, player benchmarks, and Discord notifications.

This is more than a notification bot: it demonstrates data orchestration—from an event on a gaming platform to information that can inform a decision.

Problem

Play Time Scattered Across Platforms

Starting a game is easy. Answering how much time gaming took up over the past week requires bringing together several pieces of information: the platform, title, session start and end, and activity history.

The total number of hours alone does not show the whole picture either. It matters which games dominate, how session lengths change, when activity spikes occur, and whether users exceed set limits. From an analytics perspective, context about other players, game characteristics, and seasonality is also needed.

Headshot Haven was created to bring this data together in one process. It automatically records activity, calculates play time, and delivers the results where they are needed: in an analytics report or directly on Discord.

Without a shared process

Separate histories, manual summaries

Data remains scattered across services. Users have to check their own statistics, while analysts have to combine sources and prepare comparisons. Information reviewed only after the fact loses the context of a specific session and is less useful when deciding whether to keep playing or take a break.

With Headshot Haven

One activity history, two ways to use it

Sessions are added to a central database and then fed into reports and analytics models. Discord notifications give players real-time feedback. The same activity record supports summaries, benchmarks, limit analysis, and forecasts.

System Architecture

From Session Telemetry to Feedback

Steam / PSN / Xbox LiveAPI and automationMySQLExcel and ML modelsDiscord and reports

Data Sources and API Integrations

The system collects activity data from Steam, PlayStation Network, and Xbox Live. It detects when sessions start and end, collects information about titles, and tracks progress toward trophies and achievements. API integrations also include Discord and Microsoft Graph.

Users do not need to install an additional session-tracking app — they only need to start a game on a console or PC.

Data Orchestration and Transformations

Python, VBA, and Power Query support ETL process automation: collecting, transforming, calculating, and passing data to the next stages.

A shared process combines events from different sources into a player’s activity history. As a result, reporting does not require manually importing files or preparing summaries from scratch each time.

Central MySQL Database

Sessions are automatically saved to a MySQL database. The history includes game start and end times and the data needed to analyze play time, titles, and users.

Centralized records provide a shared foundation for reports, comparisons, and forecasts. Data from different devices can be analyzed in one place rather than treating each platform as a separate dataset.

Reporting and Visualization in MS Excel

Excel serves as the analytics and presentation layer. Integrations with Power Query and APIs enable reports to update automatically, without manual file imports or user-initiated refreshes.

Dashboards show, among other things, cumulative play time, daily activity distributions, user benchmarks, and limit overruns.

Machine Learning Models

The ML layer uses Prophet, previously known as Facebook Prophet, and XGBoost. It combines session history with game features and calendar context to forecast play time and user activity.

The activity history is complemented by an updated Excel database of games, including genre, game type, estimated completion time, player rating, and release date.

Discord Notifications

The Discord API delivers information about game starts and summaries of completed sessions. Messages can show play time, achievements, progress, and weekly or monthly totals.

The communication layer completes the process: data does not end its life in the database or spreadsheet, but returns to the user in the context of their activity.

Modules and Features

What Headshot Haven Shows

Automatic Session Tracking

The system runs in the background: it detects when a game starts and ends, saves the session, and counts the time spent on individual titles. It also tracks progress toward trophies and achievements.

This data is used to create weekly and monthly summaries. The collected data remains available for further analysis and forecasting, without an analyst having to collect and calculate sessions each time.

Play Time as Information for the User

Reporting helps players see which titles take up the most time and manage their free time more consciously. Players can use their history to set personal limits or goals — for example, spending less time on repetitive grinding in favor of discovering new games.

Clear summaries also make it easier to share progress and talk about gaming habits. The system provides information rather than making decisions for the user.

Notifications When a Game Starts and Ends

Discord notifications show what the user is playing, on which platform, and since when. At the end of a session, the system sends a summary: session length, achievements earned, changes in progress, and activity totals.

Example session summary:

  • Game: Hunt: Showdown.
  • Play time: 1 hr 43 min.
  • Trophies earned: +2.
  • Most recently unlocked achievement: “Wipe Them Out”.
  • Progress: from 38% to 41%.

This feedback reaches the player while the session is still fresh in their mind and the decision to keep playing or take a break is still relevant.

Why Discord

Discord is a place where players are already active. Notifications do not require checking email or opening a separate reporting service.

The Discord API supports clear embed-style messages with icons and colors. Webhooks also make it possible to send messages without maintaining a continuously running bot.

In this project, the communication channel is part of the analytics process: it shortens the journey from recording an event to helping the user recognize its significance.

Player Activity Benchmark

This module compares activity across games and users. It includes average session time, standard deviations, and identification of outliers — players or sessions that differ noticeably from the group being analyzed.

Benchmarking puts individual results in context. It helps assess not only the number of hours but also differences in engagement, unusual behavior, and potential areas for further analysis or recommendations.

Player activity benchmark dashboard broken down by games and users, displayed on a laptop screen.

Game Sessions Cumulative — Cumulative Play Time

The bar chart shows the cumulative number of hours for selected games and users over a specified period. It makes it easy to spot the titles responsible for the largest share of activity.

Automatic recording reduces manual reporting errors, while analyzing changes helps identify increases, decreases, and seasonality in engagement. This provides a foundation for behavior analysis and planning product activities or campaigns.

Screenshot of a mobile app showing player activity in Assassin's Creed Shadows, including playtime and achievement progress.

Game Sessions — Time Spent: Daily Activity Distribution

This visualization shows play time across successive days. It helps identify regular patterns, sudden spikes in activity, and periods of lower engagement.

Real-time data updates support analysis without manually refreshing the report.

  • Time tracking: See when and how long users play.
  • Detecting irregularities: Identify unusual changes in activity.
  • Day-of-week analysis: Identify recurring patterns that matter when planning events, promotions, and product development.
Game Sessions – Time Spend chart, showing daily playtime distributions and player activity in a visualization.

Alerts for Exceeding Play Time Limits

The system analyzes data from completed sessions and identifies when a set daily, weekly, or monthly limit is exceeded. It preserves the context: the user, date and time, and the game being played when the limit was exceeded.

Instead of searching reports manually, the analyst receives a specific event alert. This makes it easier to analyze behavior, detect anomalies, and prepare data-driven recommendations.

Game time limit exceedance alert system. Graph of time spent in games on a laptop screen.

Game Features and Dynamic Behavioral Context

ML models use an updated Excel database of games. The data describing each title includes:

  • Game title.
  • Game type: single-player or multiplayer.
  • Genre.
  • Estimated completion time.
  • Player rating.
  • Release date.

These features are combined with session history, time-of-day patterns, and cumulative play time. The context also accounts for the day of the week and time of year.

Combining game characteristics with user behavior makes it possible to analyze changes in interest in titles and create reports and alerts that use forecast activity.

Forecasts by Time Series — Prophet Forecasts

This module uses time series to forecast play time based on activity history. The visualization shows minimum, average, and maximum scenarios, helping assess a range of possible outcomes rather than just a single value.

The analysis can identify trends and seasonality and compare users and titles. It can also support estimates of when a game may be completed, event planning, and personalized recommendations. A forecast is an estimate based on historical data, not a guarantee of future behavior.

Headshot Haven playtime forecasting visualization using Prophet models, showing predicted time in minimum, average, and maximum variants.

Forecast by Behaviour — Forecasting Activity Patterns

This module analyzes past sessions to predict days with increased activity and peak times for selected players and titles.

This approach supports planning sessions and events, identifying periods of highest engagement, and estimating when a game may be completed. From a product perspective, it provides input for recommendations, retention activities, and experience personalization.

It moves from describing what has already happened to preparing for likely future behavior.

Excel chart forecasting player behavior based on historical patterns, showing predicted days of activity.

A Self-Awareness Assistant, Not a Parental Control System

Headshot Haven was not designed to block access to games. Its role is to observe, report, and support informed decisions.

Unlike approaches based on blocking and schedules, this project focuses on timely information: detecting when a game starts, summarizing sessions, analyzing progress, and tracking each title’s share of total activity.

Discord notifications can be available to both the player and their community. They encourage conversation about progress and play time rather than limiting communication to warnings. The central database combines data from Steam, PSN, and Xbox, while Discord serves as a shared channel for presenting it.

Solution Outcomes and Benefits

What Combining Telemetry, Analytics, and Communication Delivers

One History Across Platforms

Activity from Steam, PlayStation Network, and Xbox Live is brought together in a shared database. Reporting covers users and their games, not just an individual platform or device.

Less Manual Data Work

The automated process takes data from API collection through calculation to presentation. It reduces the need to import files manually, refresh reports, and prepare the same summaries repeatedly.

Telemetry with Context Preserved

Play time is linked to the user, title, and session details. This makes it possible to analyze not only total hours but also activity patterns, achievements, and the circumstances in which a limit was exceeded.

A Shorter Path from Event to Response

Discord brings information from reports to the place where players spend their time. A post-session summary supports reflection while the decision to keep playing or take a break is still relevant.

Analysis, Not Just Counters

Benchmarks, standard deviations, and outlier detection help explain behavior in comparison with other users. Raw session records become a basis for comparisons and recommendations.

A Foundation for Forecasting

Activity history combined with game features feeds Prophet and XGBoost models. This makes it possible to go beyond reporting on the past and analyze likely future engagement patterns.

Conscious Time Management

Players get the data they need to recognize their own habits, set goals, and talk about their activity. The tool supports independent decisions rather than enforcing them through blocking.

A Demonstration of an End-to-End Data Process

Headshot Haven shows how API integrations, a MySQL database, automation in Python, VBA, and Power Query, Excel analytics, and machine learning can work together. The value of the project lies in their cooperation in one process — from recording an event to a report, forecast, and notification.

You have data, but lack a process to turn it into action?

Origami Effect combines integrations, automation, and analytics — from understanding the problem to implementing reports, alerts, and decision-support tools.