A bot that plays TFT using OCR. Keeps track of bench, board, items, and plays the user defined team comp.

Overview

main

NOTES:

  • To ensure best results, make sure you are running this on a computer that has decent specs.
  • 1920x1080 fullscreen is required in League, game must also be on main monitor.
  • Make sure you dont have any overlays on.
  • If the program crashes, make sure you create an issue with the traceback.
  • Feel free to create a PR for whatever you want, I used this project to learn python and much of the code can be improved.
  • My initial goal with this project was to create a bot capable of hitting gold in TFT. Unfortunately I do not have anymore time to spend on this.

INSTALLATION:

  1. Install Python 3.9.6 from https://www.python.org/downloads/windows/
    • Note that Python 3.9.6 cannot be used on Windows 7 or earlier.
  2. Run pip install -r requirements.txt in Command Prompt
  3. Install tesseract using windows installer available at: https://github.com/UB-Mannheim/tesseract/wiki
    • Note the tesseract path from the installation.
    • Set the tesseract path in the ocr.py file (it may already be correct)
  4. Run the main.py file

FEATURES:

  • Read the board state (Round / Level / Gold / Shop / Items)
  • Keeps track of champions on the board and bench
  • Pick a random item/champ from the carousel
  • Pickup items from the board after PVE rounds
  • Place items onto champions
  • Plays the user defined team comp
  • Auto queue using the LCU api

TODO:

  • Change the functions that take multiple screenshots and change it to one screenshot and crop that image. This should increase performance.
  • Implement tome of traits logic
  • Add more logic to the gold spending function
  • Change all pyautogui screenshot functions to PIL ImageGrab
  • Revamp auto queue so it can never fail
  • Multiple defined team comps and pick the best one in game
  • General code imrpovements and optimization
  • [?] Intelligent carousel item/champion choice
Comments
  • Randomness and auto FF

    Randomness and auto FF

    Hello!

    I love using this bot and its a great job youve done! Im wondering if youre planning on adding some more nonbot looking movements when purchasing and picking orbs.

    Also, are you planning on adding a function to ff at a certain time like 16m? So if u choose 16 it will always ofset with a few seconds so its not exactly on 16 everytime since it makes it look more like a bot.

    Im looking forward to keep using this bot!

    enhancement 
    opened by DhaWae 15
  • auto_queue error

    auto_queue error

    When i try run Main.py this error show up D:\TFT-OCR-BOT-main\TFT-OCR-BOT-main>py "main.py" TFT OCR | Ver. 2.2.0 | https://github.com/jfd02/TFT-OCR-BOT If text is not visible on the top left of the screen, the program is not functioning correctly. Close this window to terminate the overlay window & program Process Process-1: Traceback (most recent call last): File "C:\Users\Allvo\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 315, in _bootstrap self.run() File "C:\Users\Allvo\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 108, in run self._target(self._args, **self._kwargs) File "D:\TFT-OCR-BOT-main\TFT-OCR-BOT-main\main.py", line 9, in game_loop auto_queue.queue(message_queue) File "D:\TFT-OCR-BOT-main\TFT-OCR-BOT-main\auto_queue.py", line 68, in queue app_port = re.search("--app-port=([0-9])", results)[1] TypeError: 'NoneType' object is not subscriptable

    opened by Allvoes 8
  • any support for garena players?

    any support for garena players?

    hello, the garena version of league is like this and it does not detect in the settings. I have no idea which folder nor if even the folder works at garena version the layout is like this image

    opened by MeviDiRaizel 7
  • PermissionError: [WinError 5] Access is denied

    PermissionError: [WinError 5] Access is denied

    [Auto Queue]
      Client found
      Creating lobby
      Changed arena skin to default
      Creating lobby
      Starting queue
      Starting queue
    
    [!] Searching for game window
      Did not find window, trying again...
      Did not find window, trying again...
      Did not find window, trying again...
      Did not find window, trying again...
      Window League of Legends (TM) Client found
        Location: (0, 0)
        Size:     (1920, 1080)
    Process Process-1:
    Traceback (most recent call last):
      File "C:\Users\Ramz\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 314, in _bootstrap
        self.run()
      File "C:\Users\Ramz\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 108, in run
        self._target(*self._args, **self._kwargs)
      File "C:\Users\Ramz\Downloads\TFT-OCR-BOT-main\TFT-OCR-BOT-main\main.py", line 16, in game_loop
        Game(ui_queue)
      File "C:\Users\Ramz\Downloads\TFT-OCR-BOT-main\TFT-OCR-BOT-main\game.py", line 34, in __init__
        self.loading_screen()
      File "C:\Users\Ramz\Downloads\TFT-OCR-BOT-main\TFT-OCR-BOT-main\game.py", line 61, in loading_screen
        while game_functions.get_round() != "1-1":
      File "C:\Users\Ramz\Downloads\TFT-OCR-BOT-main\TFT-OCR-BOT-main\game_functions.py", line 17, in get_round
        game_round: str = ocr.get_text_from_image(image=round_two, whitelist=ocr.ROUND_WHITELIST)
      File "C:\Users\Ramz\Downloads\TFT-OCR-BOT-main\TFT-OCR-BOT-main\ocr.py", line 59, in get_text_from_image
        return pytesseract.image_to_string(thresholding,
      File "C:\Users\Ramz\AppData\Local\Programs\Python\Python310\lib\site-packages\pytesseract\pytesseract.py", line 416, in image_to_string
        return {
      File "C:\Users\Ramz\AppData\Local\Programs\Python\Python310\lib\site-packages\pytesseract\pytesseract.py", line 419, in <lambda>
        Output.STRING: lambda: run_and_get_output(*args),
      File "C:\Users\Ramz\AppData\Local\Programs\Python\Python310\lib\site-packages\pytesseract\pytesseract.py", line 286, in run_and_get_output
        run_tesseract(**kwargs)
      File "C:\Users\Ramz\AppData\Local\Programs\Python\Python310\lib\site-packages\pytesseract\pytesseract.py", line 257, in run_tesseract
        raise e
      File "C:\Users\Ramz\AppData\Local\Programs\Python\Python310\lib\site-packages\pytesseract\pytesseract.py", line 254, in run_tesseract
        proc = subprocess.Popen(cmd_args, **subprocess_args())
      File "C:\Users\Ramz\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 969, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "C:\Users\Ramz\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    PermissionError: [WinError 5] Access is denied
    

    Program works flawlessly until the game opens and this error appears.

    opened by iamtherealramz 7
  • Add autobuy-only feature

    Add autobuy-only feature

    I've been looking for something to just have an autobuy feature for those speedy moments where youre just trying to skip past shops really fast and buy units to 3star.

    "Think fast" Augment would be stupid good with this.

    enhancement 
    opened by esbe1175 6
  • Stuck on

    Stuck on "Loading screen found! Waiting for round 1-1"

    Auto queue works, but when the game starts and i'm already in game. It gets stuck on "Loading screen found! Waiting for round 1-1" and nothing happens. What should I do? I'm using a resolution of 1366x768.

    opened by vittbol 6
  • Resolution

    Resolution

    Does the bot refuse to work with anything below or above the mentioned resolution? I can't seem to make it work no matter what I try unless I manually recode all the vectors to work with the resolution I am using. Also no I don't have any overlays on The only thing that works is making the lobby and queuing into a game after that it does nothing else

    opened by AbusedPet 5
  • erro help me please

    erro help me please

    Traceback (most recent call last): File "C:\Users\rthem\OneDrive\Imagens\TFT-OCR-BOT-main\main.py", line 6, in from ui import UI File "C:\Users\rthem\OneDrive\Imagens\TFT-OCR-BOT-main\ui.py", line 5, in from win32gui import SetWindowLong, GetWindowLong, SetLayeredWindowAttributes ModuleNotFoundError: No module named 'win32gui'

    opened by Capa6 5
  • Client not open! Trying again in 10 seconds.

    Client not open! Trying again in 10 seconds.

    Client not open! Trying again in 10 seconds.

    [Auto Queue] Client not open! Trying again in 10 seconds. Client not open! Trying again in 10 seconds. Client not open! Trying again in 10 seconds.

    opened by MVPlel 5
  • Dectects League client but does not do anything after the game starts

    Dectects League client but does not do anything after the game starts

    Title? Using a laptop as well, currently trying solutions on changing the resolution and connecting an second monitor. Am I missing something that I need to download?

    opened by Kurgg 5
  • No module named 'win32gui'

    No module named 'win32gui'

    Traceback (most recent call last): File "A:\TFT-OCR-BOT-main\main.py", line 6, in from ui import UI File "A:\TFT-OCR-BOT-main\ui.py", line 5, in from win32gui import SetWindowLong, GetWindowLong, SetLayeredWindowAttributes ModuleNotFoundError: No module named 'win32gui'

    opened by MartinLykke 4
  • Inspiration

    Inspiration

    Hey guys, I was inspired by this project a lot. But I had a different vision of how a TFT Bot works. I cloned your repo and used it as a framework for my bot. By now, I have implemented a GUI using PyQt to dynamically change the champions being bought. Also, I added a scan function, which scans every board at the beginning of every round. It then uses trained classifiers (made with Pytorch using Resnets) to classify every champion in the game. I then use this information to calculate the hit-rate of every champion.

    Tell me if you are interested! Thanks a lot for providing this :)

    opened by Burgiii 1
  • Help

    Help

    Hello sir. I would love to try it out, and contribute to this project. Sadly I don't know much about Python. Could you help me out with setting it up? Cheers.

    opened by Yeaqs 9
  • Prime selector

    Prime selector

    Tried using prime selector on draven in the comp section but just ultimately got an error and stopped, is prime selector priority implemented or is this for future updates?

    opened by disembodiment 1
Owner
francis
francis
Steve Tu 71 Dec 30, 2022
It is a image ocr tool using the Tesseract-OCR engine with the pytesseract package and has a GUI.

OCR-Tool It is a image ocr tool made in Python using the Tesseract-OCR engine with the pytesseract package and has a GUI. This is my second ever pytho

Khant Htet Aung 4 Jul 11, 2022
Indonesian ID Card OCR using tesseract OCR

KTP OCR Indonesian ID Card OCR using tesseract OCR KTP OCR is python-flask with tesseract web application to convert Indonesian ID Card to text / JSON

Revan Muhammad Dafa 5 Dec 6, 2021
Solution for Problem 1 by team codesquad for AIDL 2020. Uses ML Kit for OCR and OpenCV for image processing

CodeSquad PS1 Solution for Problem Statement 1 for AIDL 2020 conducted by @unifynd technologies. Problem Given images of bills/invoices, the task was

Burhanuddin Udaipurwala 111 Nov 27, 2022
Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)

English | 简体中文 Introduction PaddleOCR aims to create multilingual, awesome, leading, and practical OCR tools that help users train better models and a

null 27.5k Jan 8, 2023
A Screen Translator/OCR Translator made by using Python and Tesseract, the user interface are made using Tkinter. All code written in python.

About An OCR translator tool. Made by me by utilizing Tesseract, compiled to .exe using pyinstaller. I made this program to learn more about python. I

Fauzan F A 41 Dec 30, 2022
Satoshi is a discord bot template in python using discord.py that allow you to track some live crypto prices with your own discord bot.

Satoshi ~ DiscordCryptoBot Satoshi is a simple python discord bot using discord.py that allow you to track your favorites cryptos prices with your own

Théo 2 Sep 15, 2022
A facial recognition program that plays a alarm (mp3 file) when a person i seen in the room. A basic theif using Python and OpenCV

Home-Security-Demo A facial recognition program that plays a alarm (mp3 file) when a person is seen in the room. A basic theif using Python and OpenCV

SysKey 4 Nov 2, 2021
A bot that extract text from images using the Tesseract OCR.

Text from image (OCR) @ocr_text_bot A simple bot to extract text from images. Usage What do I need? A AWS key configured locally, see here. NodeJS. I

Weverton Marques 4 Aug 6, 2021
CTPN + DenseNet + CTC based end-to-end Chinese OCR implemented using tensorflow and keras

简介 基于Tensorflow和Keras实现端到端的不定长中文字符检测和识别 文本检测:CTPN 文本识别:DenseNet + CTC 环境部署 sh setup.sh 注:CPU环境执行前需注释掉for gpu部分,并解开for cpu部分的注释 Demo 将测试图片放入test_images

Yang Chenguang 2.6k Dec 29, 2022
python ocr using tesseract/ with EAST opencv detector

pytextractor python ocr using tesseract/ with EAST opencv text detector Uses the EAST opencv detector defined here with pytesseract to extract text(de

Danny Crasto 38 Dec 5, 2022
🖺 OCR using tensorflow with attention

tensorflow-ocr ?? OCR using tensorflow with attention, batteries included Installation git clone --recursive http://github.com/pannous/tensorflow-ocr

null 646 Nov 11, 2022
CNN+LSTM+CTC based OCR implemented using tensorflow.

CNN_LSTM_CTC_Tensorflow CNN+LSTM+CTC based OCR(Optical Character Recognition) implemented using tensorflow. Note: there is No restriction on the numbe

Watson Yang 356 Dec 8, 2022
Go package for OCR (Optical Character Recognition), by using Tesseract C++ library

gosseract OCR Golang OCR package, by using Tesseract C++ library. OCR Server Do you just want OCR server, or see the working example of this package?

Hiromu OCHIAI 1.9k Dec 28, 2022
Convert PDF/Image to TXT using EasyOcr - the best OCR engine available!

PDFImage2TXT - DOWNLOAD INSTALLER HERE What can you do with it? Convert scanned PDFs to TXT. Convert scanned Documents to TXT. No coding required!! In

Hans Alemão 2 Feb 22, 2022
This pyhton script converts a pdf to Image then using tesseract as OCR engine converts Image to Text

Script_Convertir_PDF_IMG_TXT Este script de pyhton convierte un pdf en Imagen luego utilizando tesseract como motor OCR convierte la Imagen a Texto. p

alebogado 1 Jan 27, 2022
Using python libraries to track hands

Python-HandTracking Using python libraries to track hands on a camera Uses cv2 and mediapipe libraries custom hand tracking module PyCharm IDE Final E

Martin Matsudaira 1 Dec 17, 2021
Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.

EasyOCR Ready-to-use OCR with 80+ languages supported including Chinese, Japanese, Korean and Thai. What's new 1 February 2021 - Version 1.2.3 Add set

Jaided AI 16.7k Jan 3, 2023