mrmin123 / kancolle-auto

Kantai Collection (Kancolle) bot/automation tool - DEPERECATED - see kcauto-kai:
https://github.com/mrmin123/kcauto-kai
54 stars 22 forks source link

Repair Dock Reservation #376

Closed R-Jimenez closed 7 years ago

R-Jimenez commented 7 years ago

One of the issues I've been running into now that my training fleets can go full throttle (due to submarine-specific bucket-starvation ;_; ) is that, well, all of my docks are always filled with bucket-starved subs. @waicool20 and I discussed a couple changes to the repair module that are best served by a refactor, but this specific case can be solved with a small change in logic:

If a ship is queued for repair, and there is only one dock open, then a bucket is used, no exceptions.

This ensures that the repair module is never bogged down by a full dock, and that sorties can be continued. The only scenario in which this behavior will be disabled is if the bucket timer is set to 9900, which is the setting on the wiki for 'no buckets'.

I'll be make a PR this evening and use this issue for discussion or any input from you lovelies. Cheers!

R-Jimenez commented 7 years ago

On second thought, am just going to make another variable in the configuration, as this can lead to some pretty significant bucket use in a few cases, and the user may not want to choose between having it on and keeping bucket use, or disabling bucket use altogether.

mrmin123 commented 7 years ago

I did foresee this being a side effect but didn't bother pursuing a work-around at the time due to time constraints.

Your proposed approach works but could quickly enter the territory of using buckets in a steady stream, despite the purpose of this feature to preserve buckets. An alternative work-around would be to update the Submarine Switch module so that it swaps ships under the repair threshold, whether they're being repaired or not. This will actually save you more buckets in the long run, while your proposed fix will save buckets only until the docks are full (which could happen incredibly quickly depending on your number of repair slots and count of ships getting damaged in a single run). The side effect to THIS approach would be that it is entirely possible to deplete your fleet of sortie-able subs. A more complex approach to this would be to start bucketing after you've depleted sortie-able subs, but this might be approaching larger refactor territory.

R-Jimenez commented 7 years ago

This issue isn't actually about the subs, more of a consequence of us having support for switching and repairing them in a more relaxed manner. The real issue here is that when your docks are full of subs, and one of your main ships (that you're leveling, and therefore don't want to switch out) is damaged, the sortie will have to wait until a dock is free and they can be entered. This is a waste of time if the system was going to just bucket the ship anyways, so for me this tradeoff is well worth it, especially as the use of buckets is already expected when committing leveling fleets.

It actually turned out to be remarkably simple since it's an overriding logic check based on a settings flag and an established variable, so there's no harm minus a single new configuration that can by default be disabled. Will pull up a PR for you to review in a second and you can see if I missed anything obvious again.

mrmin123 commented 7 years ago

OK, I think I understand what you mean. I guess this is more relevant for leveling and not so much for Orel, since for Orel you probably wouldn't turn off BucketUse for subs in the first place, and even if you did, you wouldn't turn on ReserveDock in the first place due to potential bucket use. The side-effect I warned about earlier is more dependent on improving the SubmarineSwitch module's behavior and is independent of the new options.

I'm not sure if I'm happy with where in the config this lives, yet at the same time I don't really see a better place for it.

As a side note: these 'simple overrides' are what added up to the sprawling spaghetti code that is kancolle-auto right now, just to give you an idea of how this messy codebase came to be :P