league-of-legends-replay-extractor / pyLoL

League of Legends Replay Extractor Using CV : Open-Source VoD Analytics Tool for League of Legends
http://pylol.readthedocs.io/
GNU General Public License v3.0
34 stars 4 forks source link
esports league-of-legends league-of-legends-python minimap spatio-temporal-data-mining


LoL Replay Extractor

!! LoL Replay Extractor is still in development, any bugs can appear !!

`LoL Replay Extractor 🌟` is a program for gathering positional data and providing analytics from League of Legends videos. It can be used to automatically gather spatiotemporal data (player locations over time) from a series of Youtube/locally stored videos

✔ Any PRs are welcome, Watch nightly branch for recent updates!

✅What is pyLoL?

pyLoL is 'League of Legends' replays data extracting program.

✅What can pyLoL do?

[1] can save replay files(.rofl) automatically.

[2] can get the location of players every one second.

[3] can get the location of wards.

🚀Quickstart

Get started with pyLoL in nine steps:

Open In Colab

  1. First, clone this repository.
git clone https://github.com/league-of-legends-replay-extractor
  1. Install Requirements
pip install -r requirements.txt
  1. Make python project to Package
python setup.py develop
  1. Directory settings

    In replay_scraper.ipynb, modify the path to suit your local environment

    • game_dir: League of Legends game directory.
    • replay_dir: League of Legends *.rofl replay directory.
    • dataset_dir: JSON replay files output directory.
    • replay_speed: League of Legends client replay speed multiplier.
    • scraper_dir: Directory of the scraper program.
rd.set_replays_dir(rd,folder_dir = r'C:\Users\username\Documents\League of Legends\Replays')  # replay download directory

rs.__init__(rs, game_dir = r'C:\Riot Games\League of Legends\Game',                          
            replay_dir = r'C:\Users\username\Documents\League of Legends\Replays',               
            dataset_dir = r'C:\Users\username\Documents\League of Legends\Dataset',              
            scraper_dir = r'C:\Users\username\Desktop\pyLoL\pyLoL\autoLeague\replays',
            replay_speed=40,
            region="KR")
ie.__init__(ie,dataset_dir=r'C:\Users\username\Desktop\pyLoL')
  1. API KEY You can get API KEY from riot developer portal : https://developer.riotgames.com
dg.__init__(dg, api_key='RIOT_API_KEY' , count=20)
  1. Gathering MatchIds filtered by {queue, tier, division, max_ids, patch_start_datetime}

    if you wanna download matchIds from 5000 MASTER I in SOLORANK users in specific patch,

dg.get_tier_matchIds(dg, queue='RANKED_SOLO_5x5', tier='MASTER', division='I' , max_ids=5000, patch_start_datetime='2023.10.26')

image

  1. Save replay files for the match IDs obtained above
from tqdm import tqdm
import time

for matchId in tqdm(matchIds_challenger[:1000], 
                    desc = 'Gathering Replay_files(.rofl) from LoL Client... ', ## Print statement for progress at the front
                    ncols = 130, ## Adjust width for progress display
                    ascii = ' =', 
                    leave=True):

    try: #if this match id outdated, skip
        rd.download(rd, matchId)
        time.sleep(7)
    except:
        pass

image

  1. Run replay => Save minimap capture video
  1. Extract Realtime KDA, CS using OCR
from autoLeague.preprocess.ocr_center_window import OcrCenter as oc
oc.__init__(oc, project_folder_dir = r'C:\Users\username\Desktop\pyLoL')
oc.get_ocr(oc)

image

🎯Champion Tracking Model( Using Minimap Frame dataset )

Then, You can use this tracking model ( Performance | mAP : 92.2% | precision : 91.3% | recall : 90.2% )

image

🌠Give this Project a Star

This project is an open source project. If you like what you see, please give it a star on github.

☕Buy me a coffee

Buy Me A Coffee

📝Citing this Paper

Win Prediction in MOBA Games Using Time-Series Location Data : Case Study in League of Legends (LoL)

  @article{김성윤2023시계열,
    title={시계열 위치 데이터를 활용한 MOBA 게임 승패 예측: 리그오브레전드 사례 분석},
    author={김성윤 and 이태홍 and 양희철},
    journal={한국통신학회 학술대회논문집},
    pages={1205--1206},
    year={2023}
  }

image

🖼️Update(Champ Detection Module)

kimsy1106 AkiaCode cye_dev
developing replay extractor developing replay extractor manage "read the docs"