Skip to content

fapulito/riftguru

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

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors