Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ RiftGuru - AI-Powered Clutch Moment Detection

Automatically detect and highlight the most impactful moments from League of Legends matches using machine learning

Live Demo AWS Python License

๐ŸŒŸ Overview

RiftGuru uses hybrid rule-based and ML-augmented detection to identify clutch moments in League of Legends matches. Built for the AWS AI Hackathon 2025, it processes Riot API data through a serverless pipeline to generate AI-powered narratives of your best plays.

View Live Dashboard | Watch Demo Video | Read Documentation

โœจ Features

  • ๐Ÿค– ML-Powered Detection: LightGBM classifier with 1.0 validation AUC
  • โšก Serverless Architecture: AWS Lambda + DynamoDB + S3
  • ๐ŸŽฏ Real Riot API Data: Processes actual ranked match timelines
  • ๐Ÿ“Š Beautiful Dashboard: Vercel-hosted visualization
  • ๐Ÿ”„ Automated Pipeline: End-to-end data collection to visualization
  • ๐Ÿ“ AI Narratives: Bedrock-generated descriptions of clutch plays

๐Ÿ—๏ธ Architecture

Riot API โ†’ Lambda (Extract) โ†’ Lambda (Predict) โ†’ Lambda (Enrich) โ†’ DynamoDB โ†’ Dashboard
              โ†“                    โ†“                    โ†“
            S3 Matches         ML Model (S3)      Bedrock AI

Key Components

Component Technology Purpose
Data Collection Riot API + Python Fetch match timelines
Feature Extraction AWS Lambda Extract 30s windows with 9 features
ML Model LightGBM Binary classification (clutch/non-clutch)
Narrative Generation Amazon Bedrock AI-powered play descriptions
Storage DynamoDB + S3 Clutch moments + raw data
Frontend HTML/JS + Vercel Dashboard visualization

๐Ÿš€ Quick Start

Prerequisites

  • AWS Account with CLI configured
  • Python 3.12+
  • Node.js 18+ (for CDK)
  • Riot API Key

Installation

# Clone repository
git clone https://github.com/YOUR_USERNAME/riftguru.git
cd riftguru

# Install Python dependencies
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -r requirements.txt

# Install CDK
npm install -g aws-cdk

# Set up environment
export RIOT_API_KEY="your-api-key"
export AWS_REGION="us-east-1"

Deploy Infrastructure

# Bootstrap CDK (first time only)
cdk bootstrap

# Deploy stack
cdk deploy RiftGuruClutchPlayStack

Collect Data & Train Model

# Collect matches
python scripts/collect_match_data.py

# Extract windows
python scripts/extract_all_windows.py

# Auto-label data
python scripts/auto_label_windows.py

# Train model
python scripts/train_model.py

# Upload model to S3
python scripts/upload_model_to_s3.py \
  --model models/clutch_lgbm.txt \
  --bucket riftguru-models-YOUR_ACCOUNT_ID

Load Demo Data

# Quick demo with sample data
python quick_demo_test.py

View Dashboard

Open the live dashboard or run locally:

# Open in browser
open dashboard/index.html

๐Ÿ“Š Results

Metric Value
Matches Collected 20
Windows Extracted 362
Clutch Moments Detected 249 (68.8%)
Model Validation AUC 1.0000
Training Time < 1 second
Model Size 0.01 MB
End-to-End Latency < 5 seconds

๐Ÿง  Machine Learning

Features (9 total)

  1. kill_count: Kills in 30s window
  2. death_count: Deaths in window
  3. damage_taken: Damage dealt to enemies
  4. damage_received: Damage received
  5. objective_flag: Major objective secured (Baron/Dragon/Tower)
  6. crowd_control_time: Total CC duration
  7. position_score: Distance to enemy territory (0-1)
  8. role_score: Encoded role (1-5)
  9. team_tactic: Team coordination indicator

Model Performance

  • Algorithm: LightGBM Binary Classifier
  • Training Data: 362 labeled windows (289 train, 73 validation)
  • Validation AUC: 1.0000 (perfect on dataset)
  • Optimal Threshold: 0.6855
  • F1 Score: 1.0000

Labeling Strategy

Automated heuristic-based labeling:

  • Multi-kill (3+ kills in 30s)
  • Objective with kills
  • High damage + objective
  • Extended CC + kills
  • Team coordination + kills

๐Ÿ›๏ธ AWS Infrastructure

Services Used

  • Lambda: 9 functions for pipeline stages
  • DynamoDB: Clutch moments storage
  • S3: Match data + ML models
  • Step Functions: Pipeline orchestration
  • CloudWatch: Logging and monitoring
  • Bedrock: AI narrative generation
  • CDK: Infrastructure as Code

Cost Estimate

  • Development: ~$5/month (free tier eligible)
  • Production: ~$20/month (1000 matches/day)

๐Ÿ“ Project Structure

riftguru/
โ”œโ”€โ”€ lambda/                 # Lambda function code
โ”‚   โ”œโ”€โ”€ extract_windows/   # Window extraction
โ”‚   โ”œโ”€โ”€ predict_clutch/    # ML prediction
โ”‚   โ”œโ”€โ”€ enrich_narratives/ # Bedrock integration
โ”‚   โ””โ”€โ”€ store_clutch_moments/ # DynamoDB storage
โ”œโ”€โ”€ scripts/               # Training & data collection
โ”‚   โ”œโ”€โ”€ collect_match_data.py
โ”‚   โ”œโ”€โ”€ auto_label_windows.py
โ”‚   โ”œโ”€โ”€ train_model.py
โ”‚   โ””โ”€โ”€ upload_model_to_s3.py
โ”œโ”€โ”€ dashboard/             # Frontend
โ”‚   โ””โ”€โ”€ index.html
โ”œโ”€โ”€ models/                # Trained models
โ”œโ”€โ”€ data/                  # Training data
โ”œโ”€โ”€ clutch_play_stack.py   # CDK infrastructure
โ””โ”€โ”€ app.py                 # CDK app entry point

๐Ÿ”ง Configuration

Environment Variables

# AWS
AWS_REGION=us-east-1
AWS_ACCOUNT_ID=your-account-id

# Riot API
RIOT_API_KEY=your-api-key

# Model
MODEL_S3_BUCKET=riftguru-models-{account-id}
MODEL_S3_KEY=clutch_lgbm.pkl
CLUTCH_THRESHOLD=0.75

๐Ÿ“– Documentation

๐ŸŽฏ Roadmap

  • Fix damage feature extraction
  • Collect 5000+ training samples
  • A/B test Claude Haiku vs Sonnet
  • Real-time detection during live games
  • Mobile app
  • Multi-region support

๐Ÿค Contributing

Contributions welcome! Please read CONTRIBUTING.md first.

๐Ÿ“„ License

MIT License - see LICENSE file

๐Ÿ™ Acknowledgments

  • Riot Games for the API
  • AWS for the infrastructure
  • Amazon Bedrock for AI narratives
  • LightGBM team for the ML framework

๐Ÿ“ง Contact


Built with โค๏ธ for the AWS AI Hackathon 2025

About

RiftGuru uses hybrid rule-based and ML-augmented detection to identify clutch moments in League of Legends matches. <------------------------------------------>Built for the AWS AI Hackathon 2025 | Processes Riot API data through a serverless pipeline to generate AI-powered narratives of your best plays.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages