Adds a new screen helper method to get the approximate position of units on the board.
This is the first step in adding item logic. I haven't done more yet since I think it's better to PR this step-by-step.
I've done my best to show what the steps in OpenCV are doing:
In text-form:
Take a screenshot and convert the colors to an HSV range we can work with
Remove everything except certain green colors in the image (as a mask, that's why black&white)
Remove noise (small / random pixels)
Expand the left-over pixels
Blur the pixels so they get merged together
Group them as a rectangle
Based on those groups, the actual Y position on the board is calculated.
This is what the debug line should look like:
Visualized, the blue box is a 50x50 rectangle around each coordinate
I have the math ready to center the box on the x-axis of the actual "square" of the board as well, but it's good enough like that I think, so we can skip calculating it.
Notes
We shouldn't need to consider offsets here, since it's raw pixel coordinates in the screenshot. However, we do need to consider window offsets once we want to move the mouse to the coordinates.
Additional commits:
Gives the client more time to load after games
Removes the UAC flag from the installer. The .exe being ran as administrator is the only difference to running from source (besides the data folder), so I'm hoping that's one of the things we can stop doing to increase security as well.
Description
Adds a new screen helper method to get the approximate position of units on the board. This is the first step in adding item logic. I haven't done more yet since I think it's better to PR this step-by-step.
I've done my best to show what the steps in OpenCV are doing:
In text-form:
Based on those groups, the actual Y position on the board is calculated. This is what the debug line should look like:
Visualized, the blue box is a 50x50 rectangle around each coordinate![coordinates](https://github.com/Kyrluckechuck/TFT-Bot/assets/60011425/74571e4c-d034-4d8f-8c3a-bf7dba9b653a)
I have the math ready to center the box on the x-axis of the actual "square" of the board as well, but it's good enough like that I think, so we can skip calculating it.
Notes
We shouldn't need to consider offsets here, since it's raw pixel coordinates in the screenshot. However, we do need to consider window offsets once we want to move the mouse to the coordinates.
Additional commits:
.exe
being ran as administrator is the only difference to running from source (besides the data folder), so I'm hoping that's one of the things we can stop doing to increase security as well.