GabrielAgrela / OSROKBOT

Multi-feature bot for Rise of Kingdoms
33 stars 11 forks source link

Train and Collect RSS from City #12

Closed dualkeyboards closed 9 months ago

dualkeyboards commented 9 months ago

hi, have you been able to trains units and collect RSS from city? I have never really used python, but I have made some bots for other games using Jitbit Macro Recorder. the thing is that I dont know why, but the program seems having trouble recognizing UI (ex: T3 units training done icon, or RSS ready to collect icons) if the said icons/UI is in different coordinate. is it also occured in this bot? if yes how did you resolve it?

GabrielAgrela commented 9 months ago

If I understood right, the problem is that in Rise of Kingdoms, when you move the camera (not zoom, move), the objects deform slightly due to some perspective simulation trickery.

I use opencv's match template to find images in the screen, with some threshold. I've had trouble with this for some UI images, so I'm not sure if this is the best method for this.

For example, I was trying to make a functionality to find gem deposits on the map, but the perspective shift, depending on the Y position of the object relative to the camera, screws up the proportion of the image of the rss deposit relative to the template my code is trying to match.

I've had some success with trying slightly different scales, rotations, etc per iteration, but it's a bit heavy performance-wise.

dualkeyboards commented 9 months ago

dang that explains it, i have to add multiple images just to make it detect the UI flawlesly, but at that point it became bogged down by too much images to seacrh