Isaac Clarke
Isaac Clarke

Reputation: 101

How to locate glow/sparkle particle on screen with python

Im trying to write a gamebot to detect loot particles in a game. The issue is that those particles appear to be hard for the pyautogui pack to distinguish.

The code snippet is pretty simple

for i in range(3):
    print(pyautogui.locateCenterOnScreen("ss/loot-sparkle.png", region=(320,45,1440,900), confidence=0.3, grayscale=False))
    print(pyautogui.locateCenterOnScreen("ss/loot-sparkle-2.png", region=(320,45,1440,900), confidence=0.3, grayscale=False))
    time.sleep(1)

I want to ask if there is a trick to setting up pyautogui, or any other easy to use image recognition package for python, for detecting small particles.

Attaching a sample image of what the loot glowing particles look like in-game and what im using as a needle. Loot particle-2 is just a tilted version of the other one.

gameplay screenshot with loot particles needle image for the particles

PS: This is a pastime/hobby project, I'm not planning on distributing the gamebot or abusing it to climb the ranks/hoard wealth.

I've tried playing around with the size of the needle image, grayscale, tilting, confidence levels etc. It either doesnt detect them, or starts reporting false positives all over the place.

Upvotes: 0

Views: 91

Answers (0)

Related Questions