Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new engine #180

Draft
wants to merge 24 commits into
base: beta
Choose a base branch
from
Draft

feat: new engine #180

wants to merge 24 commits into from

Conversation

Kamii0909
Copy link
Contributor

@Kamii0909 Kamii0909 commented Mar 4, 2024

Pull Request

Implementing the new damage engine that is more flexible and consistent, according to #173

Note

This PR is under src/lib/optimizer/new

Progress

  • Stat aggregation system:
    • damage calculation
    • healing
    • chance
  • Fluid optimization formula builder
  • Revisit permutation logic
    • SIMD-friendly calculation logic
  • Integration:
    • modification of characters/sets/lcs
    • preset steps for each characters

@Kamii0909
Copy link
Contributor Author

Currently still lacking driver code so I'm way too lazy to add any test (not that having any will motivate me enough xdd)

@Kamii0909 Kamii0909 marked this pull request as ready for review March 25, 2024 16:54
@Kamii0909 Kamii0909 marked this pull request as draft March 25, 2024 16:56
@Kamii0909
Copy link
Contributor Author

Also, I hope this will get squashed, I want to erase that embarassing commit message...

Kamii0909 and others added 13 commits March 27, 2024 19:17
* chore: move to new ESLint config format

ESLint is providing a new config format (typically called flat config).
The old config format will be deprecated in ESLint 9.0 (currently in
rc), and will be removed in ESLint 10. This commit migrate from the old
 config format at .eslintrc.js to the new flat config one at
 eslint.config.js.

In addition, 3 packages were added:

- @types/eslint: A dev dependency used to provide ESLint rules code
suggestion.
This dependency is used to provide linting through jsdoc for `styleRule`
 function. It has a very weak consumption (only 1 function relies on
 it), but it is a small types package. The old config file also relies
 on it (but does not install it as a npm package).

- globals: A dev dependency used to configure ESLint global linting
environment.
It is consumed by various other package, and already present on the
path. Although, some package depend on a very old version of globals
(babel), and with how terrible npm symlinking is, ESLint would import
version 11.x.x, with a tragic yet funny bug that will break ESLint.

- typescript-eslint: A dev dependency that provide first class
Typescript integration with ESLint.
It provides a convenient config function fully typed to create ESLint
flat config array. Additionally, provide the recommended
Typescript/ESLint settings that can be conveniently extended.

This commit also deleted 2 other dependencies:

- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser

Both these two packages are no longer needed to be explicitly declared
as typescript-eslint already import them. And it will make better
decision on which version of them it should depend on.

chore: ESM support

package.json is changed to declare module (ESM), practically mark the
project as an ESM first class. Additionally, using ESM module to
configure Playwright and ESLint.

* chore: change npm lint script

With the new config file format, ESLint no longer accepts --ext flag,
as the new configuration file is capable of that already.

* fix: __dirname on Node 18

---------

Co-authored-by: Hà Trung Kiên <htk0901htk@gmail.com>
…lent break dmg (fribbels#248)

* feat: initial break dmg calc

* feat: allow upload gif

* feat: adding gallagher's besotted teammate debuff

* feat: replace enemy hp option with max toughness selector

* feat: add break elemental type scaling

* feat: replace enemyHp logic with individual toggles

* feat: implement boothill talent, ruan mei break efficiency buff

* fix: tests

* feat: update beta timestamps, update beta 2 content

* fix: change boothill sort to basic atk
* feat: undo 2.2 incorrect changes

* fix: caelus imaginary weights wrong

* feat: allow 0x debuffs for pioneer set, update conditional menu

* feat: 2.1 light cone descriptions, fix acheron lc debuff name

* feat: add warning for char/lc path mismatch, clarified teammate penacony set

* fix: ui tweaks
…min stat filter precision (fribbels#254)

* feat: replace conditionalstats addition with condensed substats

* feat: increase block size to 150,000, switch clone method to spread operator

* feat: add 0.000001 to basic stats to fix float filters

* feat: save filters to 1000ths precision, add precisionRound to char preview stat hovers

* fix: max main stat filter not applied to condensed stats, sort relic set display

* fix: delete useless relic fields for optimizer, tweak artist label opacity
- @stylistic/indent:
This rule is recommended to be disabled by ESLint
author because it aren't very aware about lesser than traditional
Typescript elements. In fact, it pops up in the most random places,
some places hand-formatted, some conflict with formatter(s).

Trivia: it conflicts with both prettier and dprint on indentation.
Considering even dprint doesn't have the neccesary configuration to
amend it, actually pretty(er) amazing.

Alternative: disable the rule inline where it is less than amusing for
the rule to kick in. Disabling a styling rule confuses the reader about
unneccesary diretives, so it isn't a strong option.

- @typescript-eslint/no-unused-vars:
Configure the rule to ignore the _XXX pattern for unused arguments and
variables. This is the TypeScript "noUnusedLocals" configuration
behavior. In fact, _ is considered unnamed/throwaway in a majority of
programming languages.
The front API for the new serialization (for structuredClone) is in
src/lib/optimizer/new/format.

It relies on user supplied serialization and deserialization method to
safely serialize/deserialize instances to JSON. By default, if a class
is not configured to implement Serializable<SerializedFormat, Class>,
Object.create(clazz.prototype) will be used for deserialization.

Revisited classes that will be serialized to integrate the new API.

test/refactor: Jingliu optimization test suite

- Added 2 new optimizer tests for Jingliu, one with 133 SPD limit.
- Added unit tests for the new serialization API.
- Grouped the test into proper test suites.
@Kamii0909
Copy link
Contributor Author

Personal note for the first commit in the 2 (the eslint one). Since this is just a style change, it could be removed if you don't like it.

I didn't expect @stylistic/indent to be that dumb. It pops up at every single nested type conditional (type ternaries). I tried my best to satisfy this rule, but it is way to inconsistent to work with any type of formatter, except if I'm resorting to formatting by hand, or including formatting directives (// prettier-ignore next-line or // dprint-ignore). Formatting directives for indentation feels like a code smell to me. Same to styling directives for ESLint.

@Kamii0909
Copy link
Contributor Author

Also PR check failed because I checked in package-lock.json on a x86 Windows, which won't contain rollup Linux specific optional package. This is indeed a npm bug.

Rollup depends on "some" Rust, which requires a platform-specific build. One work around is to explicitly declare @rollup/rollup-linux-x64-gnu as an optional dependency, or add rm package-lock.json in the CI process.

Hà Trung Kiên added 8 commits April 4, 2024 00:37
- @stylistic/indent:
This rule is recommended to be disabled by ESLint
author because it aren't very aware about lesser than traditional
Typescript elements. In fact, it pops up in the most random places,
some places hand-formatted, some conflict with formatter(s).

Trivia: it conflicts with both prettier and dprint on indentation.
Considering even dprint doesn't have the neccesary configuration to
amend it, actually pretty(er) amazing.

Alternative: disable the rule inline where it is less than amusing for
the rule to kick in. Disabling a styling rule confuses the reader about
unneccesary diretives, so it isn't a strong option.

- @typescript-eslint/no-unused-vars:
Configure the rule to ignore the _XXX pattern for unused arguments and
variables. This is the TypeScript "noUnusedLocals" configuration
behavior. In fact, _ is considered unnamed/throwaway in a majority of
programming languages.
The front API for the new serialization (for structuredClone) is in
src/lib/optimizer/new/format.

It relies on user supplied serialization and deserialization method to
safely serialize/deserialize instances to JSON. By default, if a class
is not configured to implement Serializable<SerializedFormat, Class>,
Object.create(clazz.prototype) will be used for deserialization.

Revisited classes that will be serialized to integrate the new API.

test/refactor: Jingliu optimization test suite

- Added 2 new optimizer tests for Jingliu, one with 133 SPD limit.
- Added unit tests for the new serialization API.
- Grouped the test into proper test suites.
test: move unit test into its own folder (unit-tests).

feat: add the progress update feature, allowing main thread to listen
for partial optimization completion event.

test: added a test that for progress update.
Previously, the calculation logic (which set effects are active,...etc)
is in iteration/index.ts, which make it hard to calculate a single shot
damage with a specified formula and build.

feat: proof of concept implementation of tingyun, dhil and jingliu

3 characters were re implemented with the new optimization system to
probe for feedback.
Hà Trung Kiên and others added 2 commits April 21, 2024 20:20
Reference implementation for Boothill, Black Swan and Topaz.

fix: stacking step for dhil
Should we rewrite it in Rust?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants