tylercamp / palcalc

MIT License
21 stars 4 forks source link

IV Functionality for Pal Calc #22

Open MinorKeyMystery opened 1 month ago

MinorKeyMystery commented 1 month ago

Based on the following chain of Reddit comments:

TheIdget This is a really cool app. I imagine it'd take a lot of work, but it'd be cool to one day see this also factor in IVs.

tylercamp I’d like to add that but I’m not sure how it should factor in to the overall calculation.

Maybe it should just show the max possible IVs for the final child along with each breeding result in the results list on the right, and allow you to sort by that? Doesn’t directly solve the problem but would definitely help

TheIdget I've thought about this for a bit now and think I have a couple ideas, since I don't think there's a singular great solution to this:

(1) Regardless of anything else, I do think that IVs should act as a tiebreaker when there are multiple otherwise equally-valid shortest chains. (2) Add a parameter to set minimum parent IVs for reaching your desired Pal, along with a warning that high values may lead to overly long chains or have no possible solutions. (3) Add the option to breed for IVs instead of passive skills. You could still include preferred skills (to work as a tiebreaker), but the focus is getting highest IVs. (4) While the other 3 could work in tandem, this is a separate idea entirely that's a bit more abstract: Add a checkbox called "Prioritize IVs" that also unlocks some sliders (or just a singular one) that determines how much weight is put on the IV preference (vs passive skills etc.). This seems like the most challenging sort of path to take but could have some elegant results if done right.

tylercamp (1) is currently already applied when it comes to picking between multiple options for a specific owned pal, but I don’t think it’s done as a tie-breaker for equivalent paths, that would be worth adding

(2) would be pretty straightforward to add

(3) could be done indirectly as a combination of (1), (2), leaving required passives empty, the ability to sort by max IV at the end of breeding, and a minimum required value for the max possible IV on a child at the end of breeding

(4) is tough to do “right” since it’s arbitrary weighting, but the code is already set up to reduce the list of results based on different parameters like num wild pals, breeding time, etc., so another filter could be added to that for IVs.

The relevance for (4) is that I was considering exposing this as a reorderable list so you could influence that pruning process. It would be a bit more complex to work with than simple sliders, but would be more straightforward to understand than some abstract and arbitrary sliders

I suggest opening a new issue on GitHub and copy/pasting or linking the convo here https://github.com/tylercamp/palcalc/issues

The pruning steps I’d be exposing in UI can be seen here near the end of the file: https://github.com/tylercamp/palcalc/blob/main/PalCalc.Solver/ResultPruning/PruningRulesBuilder.cs

Each step takes the list and either reorders it or reduces it to a smaller list, and the steps are ran in order. If we put an “IV pruning” step at the top of the list that would force the system to prioritize IVs over the other methods

tylercamp commented 1 month ago

When I wrote this I was under the impression that each IV is inherited with some random modifier on the parents IVs, e.g. child HP = (P1.HP * 0.3 + P2.HP * 0.3 + Rand(), but this suggests that each IV is either inherited directly from either parent or is set to a completely random value: https://game8.co/games/Palworld/archives/444315

Based on our testing, it appears at least one IV will always be inherited from one of the parents. The guaranteed stat is random, and there doesn't seem to be a way to influence which parent the IV will pass down from.

and

We found that the child Pals can inherit the other stats in addition to the guaranteed stat. There's around a 30% chance of inheriting an IV from a specific parent and around a 40% chance for the IV to be random. This means child Pals can get all their IVs solely from the parents.

So it seems that for each parent there is a 30% chance for the child to inherit any IV from that parent. I wish they published their stats on exactly how many IVs were directly inherited from the parents on each attempt, rather than combining all the counts together, so we could get stats on how frequently up to N IVs are inherited directly from the parents. Similarly, since the 30% inheritance chance is affected by the "guaranteed 1 inherited IV" behavior, I'm not sure what the final probabilities should be for inheritance.

tylercamp commented 1 month ago

Marking this as "On Hold" until we can get more detailed info on IV inheritance stats.