pyLoL
pyLoL copied to clipboard
League of Legends Replay Extractor Using CV : Open-Source VoD Analytics Tool for League of Legends
![](https://github.com/league-of-legends-replay-extractor/pyLoL/raw/main/assets/logo.jpg)
LoL Replay Extractor
![](https://github.com/league-of-legends-replay-extractor/pyLoL/raw/main/assets/logo.jpg)
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
- youtube_guide
Get started with pyLoL in nine steps:
- First, clone this repository.
git clone https://github.com/league-of-legends-replay-extractor
- Install Requirements
pip install -r requirements.txt
- Make python project to Package
python setup.py develop
-
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')
- 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)
-
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')
- 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
- Run replay => Save minimap capture video
- Option
- All) no fog of war
- Blue) fog of war in Blue team
- Red) fog of war in Red team
for replay in tqdm(replays,
desc = 'Extracting Replay_Minimaps from LoL Client... ', ## Print statement for progress at the front
ncols = 200, ## Adjust width for progress display
ascii = ' =',
leave=True
):
rs.run_client(rs,
replay_path = rf'{rs.get_replay_dir(rs)}\{replay}',
gameId = replay.split('.')[0],
start=5*60 - 5,
end=25*60 - 5,
speed=10,
paused=False,
team="All")
- 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)
๐ฏChampion Tracking Model( Using Minimap Frame dataset )
- Champion Tracking (Roboflow)
-
Then, You can use this tracking model ( Performance | mAP : 92.2% | precision : 91.3% | recall : 90.2% )
-
Infer on Local and Hosted Images To install dependencies,
pip install roboflow.
Then, add the following the following code snippet to a Python script:
from roboflow import Roboflow rf = Roboflow(api_key="API_KEY") project = rf.workspace().project("lolpago-multi-tracking-service") model = project.version(18).model # infer on a local image print(model.predict("your_image.jpg", confidence=40, overlap=30).json()) # visualize your prediction # model.predict("your_image.jpg", confidence=40, overlap=30).save("prediction.jpg") # infer on an image hosted elsewhere # print(model.predict("URL_OF_YOUR_IMAGE", hosted=True, confidence=40, overlap=30).json())
๐ 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
๐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}
}
kimsy1106 | tim000519 | cye_dev |
---|---|---|
developing replay extractor | manage "read the docs" | manage "read the docs" |