maxohn / rosu-pp Goto Github PK
View Code? Open in Web Editor NEWPP and star calculation for all osu! gamemodes
License: MIT License
PP and star calculation for all osu! gamemodes
License: MIT License
i'm using the js-wrapper for rosu-pp and i'm trying to get the maxCombo value from the beatmap calculation.
is that somehow possible to recieve the maxCombo out of the .osu file with the calculate method?
because there is a documentation inside that showes maxCombo as value but when i look on the response i don't have that.
it would really help me a lot having that!
Docs
Response
thread 'main' panicked at 'attempt to subtract with overflow', /home/kiwec/.cargo/registry/src/github.com-1ecc6299db9ec823/rosu-pp-0.4.0/src/osu/mod.rs:287:28
The beatmap: https://osu.ppy.sh/beatmapsets/195741
Title might be wrong since the website says it has 2 sliders, but idk.
Alternative: https://osu.ppy.sh/beatmapsets/194899#osu/470113
https://github.com/MaxOhn/rosu-pp/blob/main/src/osu/mod.rs#L287
Would be cool to be able to change AR, OD etc. without editing the .osu file before parsing with rosu-pp.
Another good addition would be being able to also change the "speed rate" of the map. e.g. setting it to something like 1.2x instead of being limited to only DT/HT or 1.5x/0.75x respectively.
Trying to parse the map https://osu.ppy.sh/beatmapsets/306746#osu/695893 currently results in a panic.
I'm not sure about the numbers when specifying mods.
HD=8
HR=16
DT=64
I understand up to this point, but
but I don't understand the rest.
I looked around for about an hour and could not find it (maybe because I don't understand English very well).
I would be very grateful if you could help me.
I have been using rosu-pp to calculate scores in a project of mine, where I planned to calculate difficulty attributes once and reuse them constantly. This was working great up until v0.10.0.
pub fn get_pp(attr: DifficultyAttributes, score: CScore) -> f64 {
Beatmap::default()
.pp()
.attributes(attr)
.combo(score.combo)
.n300(score.n300)
.n100(score.n100)
.n50(score.n050)
.n_misses(score.misses)
.calculate()
.pp()
}
It always returns 0 now.
The only way to fix this is loading the beatmap file and calculating PP from there... It'd be great to have the option to calculate PP straight from the difficulty attributes again.
Difficulty was being calculated this way:
pub fn get_difficulty(bytes: &[u8], mods: u32, mode: GameMode) -> Result<DifficultyAttributes, String> {
let parse = Beatmap::from_bytes(bytes);
return match parse {
Ok(map) => Ok(map.stars().mods(mods).mode(mode).calculate()),
Err(why) => Err(why.to_string())
};
}
Changing it so that the pp calculation is done on the beatmap itself works just fine, only problem is that can't really cache the attributes and discard the map for future PP calculations.
pub extern "C" fn GetPPFromMap(bytes: &[u8], mods: u32, mode: GameMode, score: CScore) -> f64 {
let parse = Beatmap::from_bytes(bytes);
return match parse {
Ok(map) => {
map.pp()
.mode(mode)
.mods(mods)
.combo(score.combo)
.n300(score.n300)
.n100(score.n100)
.n50(score.n050)
.n_misses(score.misses)
.calculate()
.pp()
}
Err(_) => { 0.0 }
};
}
p.s: Example code has been slightly adapted from the real thing, as seen here https://github.com/Minoxs/crosu-pp
So my suggestion is to use the link to download .osu file like this https://osu.ppy.sh/osu/3640199, and read data from it on RAM instead of the Hard drive, that's gonna save us alot of pc resources, please do that.
HitObject::end_time
currently doesn't give the correct end time for sliders since it's not used in any calculation.
Since it's a public function, it should return the correct value though.
Attempting to calculate catch convert SR in Helix's Aleph-0 (Jack of all Trades diff) seems to lead to capacity overflow
while trying to reserve ticks vector.
thread 'main' panicked at 'capacity overflow', library\alloc\src\raw_vec.rs:517:5
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\std\src\panicking.rs:584
1: core::panicking::panic_fmt
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\core\src\panicking.rs:142
2: alloc::raw_vec::capacity_overflow
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3/library\alloc\src\raw_vec.rs:517
3: alloc::raw_vec::handle_reserve
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\raw_vec.rs:488
4: alloc::raw_vec::impl$1::reserve::do_reserve_and_handle<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\raw_vec.rs:285
5: alloc::raw_vec::RawVec<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>::reserve<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\raw_vec.rs:289
6: alloc::vec::Vec<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>::reserve<tuple$<rosu_pp::parse::pos2::Pos2,f64>,alloc::alloc::Global>
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\alloc\src\vec\mod.rs:815
7: enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice>::new
at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\fruit_or_juice.rs:98
8: rosu_pp::catch::calculate_movement::closure$0
at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\mod.rs:172
9: core::ops::function::impls::impl$3::call_mut<tuple$<ref$<rosu_pp::parse::hitobject::HitObject> >,rosu_pp::catch::calculate_movement::closure_env$0>
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\ops\function.rs:290
10: core::slice::iter::impl$173::find_map<rosu_pp::parse::hitobject::HitObject,enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice>,ref_mut$<rosu_pp::catch::calculate_movement::closure_env$0> >
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\slice\iter\macros.rs:276
11: core::iter::adapters::filter_map::impl$2::next<enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice>,core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0>
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\filter_map.rs:61
12: core::iter::adapters::fuse::impl$9::next<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0> >
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\fuse.rs:364
13: core::iter::adapters::fuse::impl$2::next<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0> >
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\fuse.rs:70
14: core::iter::adapters::flatten::impl$17::next<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0>,enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice> >
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\flatten.rs:299
15: core::iter::adapters::flatten::impl$12::next<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0>,enum$<rosu_pp::catch::fruit_or_juice::FruitOrJuice> >
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\flatten.rs:192
16: core::iter::adapters::take::impl$1::next<core::iter::adapters::flatten::Flatten<core::iter::adapters::filter_map::FilterMap<core::slice::iter::Iter<rosu_pp::parse::hitobject::HitObject>,rosu_pp::catch::calculate_movement::closure_env$0> > >
at /rustc/e092d0b6b43f2de967af0887873151bb1c0b18d3\library\core\src\iter\adapters\take.rs:37
17: rosu_pp::catch::calculate_movement
at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\mod.rs:207
18: rosu_pp::catch::CatchStars::calculate
at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\catch\mod.rs:100
19: enum$<rosu_pp::stars::AnyStars>::calculate
at C:\Users\Ren\.cargo\registry\src\github.com-1ecc6299db9ec823\rosu-pp-0.7.1\src\stars.rs:107
20: osu_ipc_rust::osu::calculate_sr
at .\src\osu.rs:19
rosu-pp/src/catch/fruit_or_juice.rs
Lines 84 to 98 in d81a8c9
Why is there no option to parse a beatmap from bytes instead of a file?? so much more useful in so many scenarios
id: 2857854
mods=24
acc=100
miss=0
combo=261
My result: https://i.imgur.com/5kQa6Ph.jpeg
on osu: https://i.imgur.com/KsLksKT.jpeg
id: 3178954
mods=8
acc=98.87
miss=8
combo=447
My result: https://i.imgur.com/T8F80Cy.jpeg
on osu: https://i.imgur.com/bR2ofK0.jpeg
This map https://osu.ppy.sh/beatmapsets/13023#osu/49374 (https://osu.ppy.sh/osu/49374) has byte 0xd1 as a storyboard command.
As the map is ranked, I think rosu-pp should support it somehow.
The error this causes is of course :
Error: failed parse
Caused by:
0: IO error
1: stream did not contain valid UTF-8
Not sure what would be a good solution other than not reading the file as a string, but as a byte vector.
Epic project btw, saved me from running C# on my server, thank you!
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.