Open Kamii0909 opened 9 months ago
Hi @Kamii0909 I appreciate the feedback! I agree the optimization system needs an overhaul - the project is still young and we could use a hand in designing the api. Its late here but please drop by the discord server's #dev channel for more discussion tmrw/next week, I will be able to respond better on discord than in a ticket.
There's a lot of backlog tasks related to this one that we could use help with:
https://github.com/fribbels/hsr-optimizer/issues/153
https://github.com/fribbels/hsr-optimizer/issues/115
Motivation
Currently, the optimizer use an rudimentary method to sort builds, which is more or less: get all builds permutations -> sort them This is limiting for various reasons:
The result of such process is no better than manual eyeball.
Furthermore, the damage system is inherently flawed and ad-hoc, which currently is (and will continue to) be problematic to work with:
Personally, code for the current optimizer lacks proper documentation and is rather confusing. Without significant time investment, I can't even verify things like "does BS EHR -> DMG% work?".
I raised this issue to discuss about the aforementioned concerns. Before I produce a full-fledged pull requests, I want to use this issue to first gather some feedback, before I did something that is not on the vision of the site.
Proposal
Stat API
As part of the current damage calculation stack, the stat collection system need a redesign. A stat modification (buff, debuff, whatever) may come from many source, with their own conditional on top of that. We need a mechanism to effectively model them with an intuitive game-like API, this will greatly simplify game version update. I reckon the upperbound of the scope should be "everything can be changed after you pick an action and enemy". So things like "IL gains 24% CD when attacking enemies with Imaginary Weakness" should be out of scope.
For example, Ting Yun provides an unconditional 50% DMG Boost with her Ultimate. Topaz Skill with 50% FuA DMG Boost.
This should also close #153 since FinalStats can trace all its element, traits, and stats dependencies. I'm honestly debating whether Element ConditionalStat is even relevant at all, because then the stat system should also track which element the attack is, which is an extremely useless feature, because such a thing cannot be changed after "the player chose an action". But then, it will simplify a fair bit for downstream, so well?
Optimization request
The aforementioned stat system also provide the base for complex/custom result-orientated optimization. For example, we can provide the formula for the optimization of IL 3SP and then Ult:
There are still multiple problems with this approach, for example, parallelization, performance, flexibility, but you get the idea. This is just an API draft anyway. We probably want some composition for
OptimizationTarget
, but that should take a fair bit of work.Personal note
Personally, I'm not familliar with React technology, so it's unlikely that I can contribute to UI, so this is as much sugar that I can personally provide. I'm from a strongly typed language background, so I'm comfortable (in fact, I can't work with vanilla JS at all lol) working everything with Typescript.