maxohn / rosu-pp-js Goto Github PK
View Code? Open in Web Editor NEWosu! difficulty and pp calculation for all modes
License: MIT License
osu! difficulty and pp calculation for all modes
License: MIT License
import * as fs from 'fs';
import * as rosu from "rosu-pp-js";
const file_path = `/mnt/f/osu!/beatmaps/53.osu`;
const bytes = fs.readFileSync(file_path);
while (true) {
let beatmap = new rosu.Beatmap(bytes);
}
This MRE currently results in RAM usage steadily climbing up. This issue has most likely to do with rustwasm/wasm-bindgen#3917.
I believe the best "workaround" is to denote very clearly in the readme and documentation to call Beatmap.free
manually.
Since the switch to wasm the compability with ESM faded, since it's now considered a commonjs only module. There is a workaround but i'd really wish to see native ESM back. Took me by surprise that my beatmap mirror just suddenly broke after upgrading packages lol
I came here to say that the PP calculations for some of the mods were wrong.
const map = fs.readFileSync('test.osu', 'utf-8'); //https://osu.ppy.sh/beatmapsets/1856862#taiko/3825077
const beatmap = new rosu.Beatmap(map);
//HD: 8
//HR: 16
//EZ: 2
//DT: 64
//HT: 256
let difficultyArgs = {
mods: Tested with the above values.
};
let difficulty = new rosu
.Difficulty(difficultyArgs)
.calculate(beatmap);
const PP = new rosu
.Performance()
.calculate(difficulty);
console.log(PP.pp);
Result
Original PP => rosu-pp-js
HDSS: 759pp => 692.3902281341881(same as NM)
HRSS: 779pp => 751.8363331710395
EZSS: 620pp => 643.6490906614597
DTSS: 1275pp => 1275.1074471835482(Correct)
HTSS: 439pp => 439.4615725388199(Correct)
The calculation seems to be correct for mods that change speed.
As mentioned in #11, the classes Performance
, Difficulty
, and BeatmapAttributesBuilder
should have setter methods to adjust their fields.
This might lead users to initialize each field with setters instead of using the more efficient constructor but that's a worthy tradeoff considering that there's currently no way to re-use a builder with just a single field modified for example.
The JS binding currently has no method to pass previous difficulty attributes to calculations in order to not re-calculate them.
Maybe this should be added.
Error: Failed to parse beatmap: expected osu file format v
at file begin
https://osu.ppy.sh/osu/2133551
For some reason the built .d.ts
file sometimes doesn't match so the job fails and needs to be re-run until it passes.
Just wondering if it would be possible to add support for buffers instead of just file paths.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.