In-Engine Analytics & Visualization Custom Tools

App 1 Detail 1

Project Overview

This project focuses on the development of custom data analysis and visualization tools within Unity Engine, designed for analyzing gameplay data from a Minesweeper-inspired game. It leverages Python, SQL, and data science libraries to process and analyze large datasets collected during gameplay.

The tools enable exploratory data analysis (EDA), heatmap visualizations, statistical comparisons, and linear regression modeling directly within Unity. Additionally, machine learning agents (ML-Agents) simulate player behaviors, allowing for the study of exploration patterns and decision-making strategies across different skill levels and demographics.

Heatmap Visualization

This tool creates visual representations of player interactions on the game board. I can generate heatmaps showing click density, first clicks, or mine clicks, revealing patterns and tendencies in player behavior.

Click Trails

This tool allows for the visualization of click sequences made by players. With this feature, we can understand how different player types approach the game.

Exploratory Analysis

This tool allows for the examination of individual variables such as game duration, click count, and efficiency. It can generate histograms, box plots, and scatter plots to explore distributions and relationships within the data.

Group Comparison

This tool allows for the comparison of player groups. It can analyze whether there are significant differences in their performance using statistical tests and visualize the results with bar charts.

Regression Analysis

This tool investigates the influence of different factors on player outcomes. It can identify which variables, such as age or skill level, have a significant impact on metrics like win rate or score.

ML-Agents Simulation

ML-Agents Simulation

To gather diverse gameplay data, I used Unity's ML-Agents to simulate players with varying skill levels – low, medium, and advanced. Each agent represents a different demographic player profile, allowing me to capture a wider range of behaviors.

ML-Agents Simulation

This video showcases simulations of ML-Agents with varying skill levels (low, advanced, and medium) playing Minesweeper.

Profiles Table

Profiles Table

The data collected in this project is organized into three SQL tables: Profiles, Games, and Clicks.

Profiles Table:
Stores player information, including ID, age, gender, country, and skill level. A new profile is created at the beginning of each ML-Agent episode based on its assigned level, and this profile is sent to the SQL database.

Games Table

Games Table

Contains key details about each game session, such as:

  • Whether the player won or lost.
  • Total playtime.
  • Number of clicks.
  • Score and efficiency (score divided by number of clicks).
  • FloodFill activations – a Minesweeper algorithm that automatically reveals connected empty cells.
  • Average time between clicks.
  • Percentage of the board uncovered.

This data is sent to the server at the end of each ML-Agent episode.

Clicks Table

Clicks Table

Logs detailed data about every click action during gameplay, including:

  • Player ID and game ID.
  • Click number (first, fifth, etc.).
  • Click coordinates (x, y).
  • Whether the click uncovered a mine.
  • Distance from the previous click.
  • Time elapsed since the last click.

This information is recorded every time the ML-Agent clicks a cell.

Data Import Process

Data Import Process

To import the data stored on the server, the process begins with Unity sending an HTTP request.

Flask Middleware

Flask Middleware

Instead of querying the SQL database directly through a PHP script, Unity’s request is sent to a Python Flask server. The Flask server acts as a middleware between Unity and the database. It contains multiple scripts, each dedicated to handling requests for specific tools.

Data Processing

Data Processing

When Unity sends a request, Flask executes a SQL query to retrieve the required data from the database. After fetching the data, the Flask server processes it using Python libraries to generate calculations, visualizations, or formatted outputs. Flask then sends the results back to Unity in JSON format, dynamically integrating them into the tools for visualization and analysis.

Flask Processing Data

Data Processing and Integration

After fetching the data, the Flask server processes it using Python libraries to generate calculations, visualizations, or formatted outputs. Finally, Flask sends the processed results back to Unity in JSON format, where the data is dynamically integrated into the tools for visualization and analysis. This architecture allows me to perform complex calculations and statistical analysis outside Unity.

SQL