- C 48.9%
- C++ 41.9%
- Python 9%
- Batchfile 0.2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| ai | ||
| gen | ||
| recorder | ||
| test | ||
| third_party/onnxruntime | ||
| train | ||
| .gitignore | ||
| ai.sln | ||
| FORGEJO_DESCRIPTION.txt | ||
| README.md | ||
LeagueBot
An automated League of Legends bot. A C++ Windows client plays matches end-to-end using an ONNX vision model and a kernel-level virtual HID driver for input; Python tooling records gameplay and trains the models.
Status: personal / research project. Running game-automation software against Riot's client violates the League of Legends Terms of Service and will get accounts banned. Use at your own risk, on accounts you are willing to lose.
Repository layout
ai/ C++ bot (Visual Studio, x64)
bot/ capture → ONNX inference → play loop
client/ League client launcher + screen-coord helpers
cloud/ GitHub-backed account rotation & config fetch
hid/ Driver install + user-mode HID I/O
lcu/ League Client Update API glue
resource/ Embedded assets (ONNX models, vhidev driver, onnxruntime.dll)
gen/ Small codegen helper
recorder/ Python screen+input recorder for building datasets
train/ PyTorch training + ONNX export
test/ Standalone HID / mouse smoke test
third_party/ Vendored onnxruntime SDK (headers + libs)
Components
ai/ — bot runtime (C++)
Single UAC-elevated Windows executable. On launch it:
- Checks whether the
vhidevvirtual-HID driver is installed; if not, extracts the embedded driver package from its own RCDATA and installs it (persists across reboots). - Opens the HID interface and takes over mouse/keyboard output.
- Pulls account credentials and runtime config from a private GitHub repo
via a fine-grained PAT (XOR-obfuscated at build time; see
ai/cloud/token_secret.h.example). - Launches the League client, logs in, queues, and hands off to the play
loop (
ai/bot/play.cpp), which runs the ONNX model embedded asai/resource/{blue,red}.onnx.
recorder/ — dataset capture (Python)
recorder.py captures screen frames with mss plus mouse/keyboard events
with pynput, writing side-by-side recordings into recorder/recordings/{blue,red}/.
train/ — model training (Python / PyTorch)
Trains the per-side vision + action model and exports to ONNX for the C++
runtime to consume. Entry points: train.py (training), export.py
(PyTorch → ONNX), play_test.py (sanity-check an exported model).
Build
C++ bot
Requirements:
- Visual Studio 2022 (v143 toolset), Windows 10/11 SDK
- Target platform: x64, configurations: Debug / Release
Steps:
cp ai/cloud/token_secret.h.example ai/cloud/token_secret.hand paste a GitHub Fine-grained PAT with read access to your private config repo.- Open
ai.slnand buildai | x64 | Release. - Run the produced
ai.exeas administrator (the manifest already requests elevation).
Python tooling
cd recorder && pip install -r requirements.txt
cd ../train && pip install -r requirements.txt
Python ≥ 3.10 recommended. For GPU training, install a CUDA-matching
torch build before running pip install -r train/requirements.txt.
Notes on secrets
ai/cloud/token_secret.his gitignored and must never be committed.- The PAT is XOR-scrambled into the exe to resist
stringsscraping — this is deterrence, not security. Rotate the PAT if the binary leaks.
License
No license granted. All rights reserved. Code is published for reference.