Skip to content

CloudyWSA/analysis

Repository files navigation

League of Legends ML Analysis

A learning repository focused on applying Machine Learning techniques to League of Legends professional match analysis. This project demonstrates real-world ML applications in esports analytics, including win probability prediction, teamfight detection, player positioning analysis, and strategic decision-making.

🎯 Project Overview

This repository serves as an educational platform for understanding how Machine Learning can be applied to competitive gaming data. Using real League of Legends esports match data (JSONL format), the project implements various ML models and algorithms to analyze gameplay patterns, predict outcomes, and provide tactical insights.

🧠 Machine Learning Techniques

Implemented Models

  • Logistic Regression: Win probability prediction based on game state features
  • Graph Neural Networks (GNN): Team synergy analysis and player relationship modeling
  • Markov Chains: Game state transitions and flow analysis
  • Contextual Analysis: Understanding game nuances (tempo, gold distribution, objective control)
  • Real-time Prediction: Teamfight detection and next objective forecasting

Key Features

  • Win Probability Calculator: Real-time prediction using multiple game features (gold, kills, objectives, vision)
  • Teamfight Analyzer: Detects and evaluates teamfights with outcome predictions
  • Skill Tracker: Monitors champion ability cooldowns and usage patterns
  • Tactical Positioning: Recommends optimal player positioning based on matchups and game state
  • Vision Analysis: Evaluates ward placement value and strategic importance
  • GNN-based Synergy: Analyzes champion combinations and team composition effectiveness

🏗️ Architecture

Data Pipeline

JSONL Events → Preprocessing → Feature Extraction → ML Models → Predictions
  1. Data Ingestion: Parses League of Legends esports event data (RFC461 schema)
  2. Feature Engineering: Extracts relevant features (gold diff, kill diff, objectives, vision)
  3. Model Training: Trains on historical match data
  4. Real-time Analysis: Provides live predictions and insights during match replay

Core Components

  • /ml/services: ML service implementations (teamfight analyzer, GNN, contextual analyzer)
  • /core/pipelines: Data preprocessing and feature extraction pipelines
  • /core/data: Type definitions for game events and match state
  • /components: React components for visualization (minimap, overlays, charts)
  • /state: State management using Zustand with State Pattern

🚀 Getting Started

Prerequisites

  • Node.js 20+
  • npm or yarn

Installation

# Clone the repository
git clone <repository-url>
cd analysis

# Install dependencies
npm install

# Run development server
npm run dev

Visit http://localhost:3000 to see the application.

Usage

  1. Upload a League of Legends esports JSONL file
  2. The system will:
    • Parse match events
    • Train ML models on historical data
    • Provide real-time analysis and predictions
    • Visualize player positions, teamfights, and strategic recommendations

📊 Features in Detail

Win Probability Analysis

Uses multiple weighted features:

  • Gold difference (30% weight)
  • Kill difference (20% weight)
  • Tower difference (25% weight)
  • Dragon control (15% weight)
  • Baron control (10% weight)
  • Vision control (5% weight)

Teamfight Detection

Identifies teamfights based on:

  • Player proximity (< 2500 units)
  • Minimum participants (3+ per team)
  • Recent kills in area
  • Duration threshold

Contextual Game Analysis

  • Game Phase Detection: Early/Mid/Late game classification
  • Game Style: Bloodbath, Normal, Slow, or Passive
  • Tempo Advantage: Measures proactive vs reactive playstyle
  • Gold Distribution: Analyzes resource allocation efficiency
  • Ward Value: Calculates strategic and informational value of vision

Graph Neural Networks

  • Node Features: Player stats (health, level, position, gold)
  • Edge Types: Teammate, proximity, and enemy relationships
  • Message Passing: 3 iterations of information propagation
  • Applications: Synergy scoring, decision quality analysis

🛠️ Tech Stack

  • Framework: Next.js 15 with React 19
  • Language: TypeScript
  • Styling: TailwindCSS
  • Animation: Framer Motion
  • State Management: Zustand
  • Data Source: Data Dragon API + Esports JSONL data

📚 Learning Objectives

This repository demonstrates:

  1. Feature Engineering: Extracting meaningful features from raw game data
  2. Model Training: Implementing and training ML models from scratch
  3. Real-time Inference: Applying models to live/replay data
  4. Data Visualization: Presenting complex ML insights in an intuitive UI
  5. Domain Knowledge: Combining ML with game-specific understanding
  6. Software Architecture: Structuring a complex ML application

🎮 Data Format

The project uses League of Legends esports data in JSONL format with RFC461 schema:

  • champion_kill: Kill events with participants and damage breakdown
  • building_kill: Tower/inhibitor destruction
  • elite_monster_kill: Dragon/Baron/Herald kills
  • skill_used: Champion ability usage with cooldowns
  • ward_placed: Vision control events
  • stats_update: Periodic game state snapshots

🔬 Future Improvements

  • Deep Learning models (LSTM for sequence prediction)
  • Reinforcement Learning for optimal decision-making
  • Computer Vision for minimap analysis
  • Advanced feature engineering (wave state, jungle pathing)
  • Multi-game training dataset
  • Model performance metrics and validation

📝 License

This is an educational project. League of Legends and all related content are trademarks of Riot Games.

🤝 Contributing

This is a learning repository. Feel free to fork, experiment, and learn from the code!

📧 Contact

For questions or discussions about ML in esports, feel free to open an issue.


Note: This project is for educational purposes to demonstrate ML applications in gaming analytics. It uses publicly available esports data.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published