Closed R-Jimenez closed 7 years ago
When adding or modifying features to kancolle-auto just think of it like a huge, complex BDD-test. Distilled down, you need to figure out how a player who doesn't understand Japanese (because Sikuli/tesseract OCR doesn't understand Japanese) might do the thing you're trying to do.
For selecting whether or not the ship you're trying to repair should be bucketed or not depending on class, you would:
Step 4 is actually the only one not implemented, while step 6's logic will have to be modified to support this.
Thanks for the explanation! I knew of the process at a higher level, but it helps to have it spelled out. I should have a look at the code sometime and refresh myself on some python.
Hopefully you can code it in a way so it doesn't slow down the script too much. Scanning for multiple images takes up quite a lot of time.
I don't need to determine every class, just whether it is a sub or not (because subs are the only class with the ability to switch out, and therefore can be replaced in leveling fleets), so it would just be a pause between steps 3 and 5 to search for the sub class image.
My original idea was to simply specify the ship slot you have your sub, and only skip bucket repair on that slot, but that would require some caching of ship name through to the repair module.
@R-Jimenez Oh perfect, actually I'm working on this: https://github.com/waicool20/kancolle-auto/tree/fastSubSwitch
It's a faster implementation of the current sub switching module by caching which slots have subs and multithreaded image searching. Sadly it's not implemented in python :/ but it does have the caching that you need!
@mrmin123 Tesseract does have japanese if you install the tessdata for it...but I guess its accuracy is still something to desire.
@waicool20 Interesting. I took a look at your fork and all I see is Python though. :o What is it implemented in then?
Just take a look at the commits so you can see the changes next time.
I've returned and have some more time to properly spend going over the system. Is the subswitcher still something I should take a look at @waicool20?
Yes certainly, if it will help you achieve what you are trying to do.
Turns out it was a pretty simple solution. No external resources required, though your module definitely looks pretty. c:
I simply modified the bucket conditional code to include the search of the ship_class_ss and ship_class_ssv icons if a new configuration setting 'submarine_switch_use_buckets' was enabled. If the timer is below the normal use of a bucket or the setting isn't enabled, then there are no extra searches. Using min's workflow above, I only ended up needing to edit step 6 with an additional configuration check and image search.
I've tested the new cases (ship_class_ssv was trouble and had to be dropped to .65 similarity), so let me know how you want me to push the enhancement in.
Cool, glad it worked out for you. Might want to create a pull request then :p
I made sure to make my code look as good looking as it is efficient, cut down the sub switching time by half lol
@R-Jimenez I reviewed your PR and requested some changes.
As for the caching of the sub page position, it's trivial to implement in the existing code without an additional Java module, but I didn't because ship drops might change the cached page location. If it's that big of a pain point I could make it so that it caches and checks at that page minus 1?
PR is merged!
This is a thought that just popped into my mind while doing some event-prep training. What kind of workflow would be required to place conditions on the bucket-use-timer?
As a use case, say I want to set my script to use buckets on any of my main ships if repairs exceed an hour, but for my sub tank I never want to use my bucket (set to 99 hours, etc.)