PokemonGoBot icon indicating copy to clipboard operation
PokemonGoBot copied to clipboard

Some thoughts on evolving and transferring

Open galexej opened this issue 10 years ago • 5 comments

In regard of the (hopefully) upcoming evolve-feature, I'd like to suggest an overhaul of the current transferring-rules, too. So let me start with that first, then proceed with the influence of evolving on transferring.

Transferring

Assume a new pokemon has been caught (or hatched). The bot should instantly decide whether to keep it or not, asking the following questions (variables from the config have a $-prefix and are written in bold):

  • Should I transfer any pokemon at all? ($autotransfer)
  • Do I have more than $keep_pokemon_amount "pieces" of this pokemon?
  • Is this pokemon's CP below $transfer_static_CP_threshold?
  • Is this pokemon's CP below $transfer_percental_CP_threshold of its current max possible CP? (Like, Magikarps never reach high, but a 200 CP fish is already doing well after evolving. This option would be new.)
  • Is this pokemon's IV below $transfer_iv_threshold?
  • Is this pokemon not part of the list $always_keep? (Renamed from $ignored_pokemon as that name was misleading.)

If any single question yields false, keep it. If everything answers with true, transfer the weakest pokemon of the same type. I left out $max_pokemon_amount intentionally as its logic means contradicting with the above in some way, making things more complicated and requiring more explanation in the config. (Is anyone actually using that anyway?) I also think that $obligatory_transfer loses most of its use once we're able to evolve efficiently. Maybe we can keep that option, but only transfer up to 5 of the weakest pokemon mentioned there, provided our pokemon-inventory is full. Apart from that, these functions might break more than they help.

Transferring with evolving in mind

Evolving easily gives a huge boost to the leveling process, so it's a good idea to design things carefully here. A few additional questions for transferring make sense to me:

  • Is this pokemon a valid candidate for evolution (as configured separately)?
  • Is there enough candy to evolve this pokemon?
    • If yes, keep it.
    • Example: We have 10 Pidgeys and 120 Pidgey candy (0 Pidgeotto, 0 Pidgeot). If we catch another Pidgey, we have 11 Pidgeys, but we can only evolve 10 of them with 123 candy. -> Transfer the weakest pidgey.
  • Is there a higher evolution that I may transfer instead?
    • Example: We have 1 Pidgey, 1 Pidgeotto and 62 Pidgey candy. If we catch another Pidgey, we have 65 candy, not enough for all 3. If the evolution-algorithm prefers to evolve Pidgey over Pidgeotto -> keep Pidgey & check whether Pidgeotto may be transferred (using the same algorithm recursively).

That sounds like the most intuitive way to add evolution-awareness to me. It requires knowing the evolutions of every pokemon, as well as keeping track of every type of candy.

Evolving

Now on the actual evolving-algorithm. First of all, if someone wishes to $evolve_automatically, there is another main question for the config: evolve pokemon ASAP after being caught, or keep them a little for bulk evolutions?

  • $evolve_bulk (boolean)
    • If true: how many evolvable pokemon should be collected before starting to evolve? -> $evolve_bulk_threshold
    • If true: should a lucky egg be used on start? (if available & if not already running) -> $evolve_bulk_lucky_egg

Apart from that, one might want to filter which pokemon should be evolved.

  • $evolve_priority: May be one of the following:
    • base_only: Only evolve the first evolution of each pokemon (e.g. only Pidgey, not Pidgeotto). -> highest leveling efficiency
    • base_first: Prefer cheaper evolutions if there are multiple possibilities. -> still very good leveling efficiency, good compromise.
    • strong_first: Sort by highest percentage of max available CP. -> if you want to build a strong team.
      • Possible: Only consider pokemon with IV above $strong_pokemon_IV_threshold for the sorting, fall back to base_first if candy left over.
  • $never_evolve: List of pokemon types that you'd like to investiage yourself (potentially strong evolutions, you might wanna check CP and IV manually).
  • $always_evolve_new: If set to true and you're still missing the next evolution in your pokedex, evolve this pokemon first with highest priority.

Implementation

Many of the above rules and priorities must be recalculated on every encounter. On a first thought, a TreeSet sorted by a Comparator that implements the configured rules makes some sense, as adding and removing stuff keeps everything up to date. However, the priorities of a higher evolved Pokemon may change after catching their predecessor, thus a static Comparator isn't really possible. One could either use one dedicated set for each type of candy available, or use some sort of PriorityQueue with remove->add simulating changing priorities. I don't know, haven't put much thought into this yet.

Well, thats about it. Feel free to be inspired or ignore everything I said. Discussion is highly appreciated though. :)

galexej avatar Aug 08 '16 19:08 galexej

This seems like a lot of work, but overall this is good ! It's getting late here, i will come back tomorrow

ghost avatar Aug 08 '16 20:08 ghost

I agree with most of what you put down here, it is a lot of work implementing all of it though :). Locally I added a EvolvePokemon task and it will run every 2 minutes (profileLoop) to check the evolve stack count. If the count is higher than a set configurable value (or your pokebag is nearly full) it will pop a lucky egg and evolve all pokemon in evolve_before_transfer configurable list. These are the variables i created: --list of pokemon you always want to evolve before transfer to maximize XP evolve_before_transfer=PIDGEY,RATTATA,DODUO,WEEDLE

--The stack of evolves needed to pop lucky egg and evolve all --Setting to -1 will disable evolve stacking -- Do not set lower than 20 or you will waste the egg evolve_stack_limit=100

svombergen avatar Aug 09 '16 07:08 svombergen

Although i really feel the release pokemon logic should first be rewritten mostly towards what you said, it is in several places now and quite tangled.

svombergen avatar Aug 09 '16 07:08 svombergen

I agree, the implementation of priorities and stuff for evolutions could take a while. Anyway, if there is enough time, one could let the users defined combined rules for CP and IV. Something like... Transfer if:

  • cp < 80% of its current max
  • OR cp < 1000 AND iv < 90%
  • OR cp < 1800

If we had a possibility to interefere into the process manually (release and evolve some pokemon via GUI) from time to time, we wouldn't need complex design. Currently, the only way to get a strong team is logging into the account via APP every now and then, and for ppl like me with bad smartphones, the pokemon list is a pain. :P

galexej avatar Aug 10 '16 23:08 galexej

Evolving+transfer has been implemented with #939 and finetuned with several PR's after.

Mixing CP/IV criteria will be handled later (since people will also use other criteria like movesets and stuff).

Sieberkev avatar Aug 24 '16 20:08 Sieberkev