docs cleanup

This commit is contained in:
MaxOhn
2021-01-29 02:01:08 +01:00
parent 8f6de43091
commit 1fd7777fad
6 changed files with 62 additions and 55 deletions
+6
View File
@@ -3,6 +3,12 @@ name = "rosu-pp"
version = "0.1.0"
authors = ["MaxOhn <ohn.m@hotmail.de>"]
edition = "2018"
license = "MIT"
readme = "README.md"
repository = "https://github.com/MaxOhn/rosu-pp"
documentation = "https://docs.rs/rosu-pp/"
description = "osu! difficulty and pp calculation for all modes"
keywords = ["osu", "pp", "stars"]
[features]
default = ["osu", "taiko", "fruits", "mania", "no_leniency"]
+20 -19
View File
@@ -4,7 +4,7 @@ A standalone crate to calculate star ratings and performance points for all [osu
Conversions are generally not supported.
#### Usage
### Usage
```rust
use std::fs::File;
@@ -56,15 +56,16 @@ let max_pp = map.max_pp(16).pp();
println!("Stars: {} | Max PP: {}", stars, max_pp);
```
#### osu!standard versions
### osu!standard versions
- `all_included`: Both stack leniency & slider paths are considered so that the difficulty and pp calculation immitates osu! as close as possible. Pro: Most precise; Con: Least performant.
- `no_leniency`: The positional offset of notes created by stack leniency is not considered. This means the jump distance inbetween notes might be slightly off, resulting in small inaccuracies. Since calculating these offsets is relatively expensive though, this version is considerably faster than `all_included`.
- `no_leniency`: The positional offset of notes created by stack leniency is not considered. This means the jump distance inbetween notes might be slightly off, resulting in small inaccuracies. Since calculating these offsets is relatively expensive though, this version is faster than `all_included`.
- `no_slider_no_leniency` (i.e. [oppai](https://github.com/Francesco149/oppai-ng)): In addition to not considering the positional offset caused by stack leniency, slider paths are also ignored. This means
the travel distance of notes is completely omitted which may cause further inaccuracies. Since the slider paths don't have to be computed though, it is generally faster than `no_leniency`.
**Note**: If the `fruits` feature is enabled, sliders will be parsed regardless, resulting in a reduced performance advantage of `no_sliders_no_leniency`.
#### Features
### Features
| Flag | Description |
|-----|-----|
@@ -75,9 +76,9 @@ the travel distance of notes is completely omitted which may cause further inacc
| `osu` | Enable osu!standard. Requires to also enable exactly one of the features `no_leniency`, `no_sliders_no_leniency`, or `all_included`. |
| `no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency but consider sliders. Solid middleground between performance and precision, hence the default version. |
| `no_sliders_no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency and sliders. Best performance but slightly less precision than `no_leniency`. |
| `all_included` | When calculating difficulty attributes in osu!standard, consider both stack leniency and sliders. Best precision but significantly worse performance than `no_leniency`. |
| `all_included` | When calculating difficulty attributes in osu!standard, consider both stack leniency and sliders. Best precision but worse performance than `no_leniency`. |
#### Benchmarks
### Benchmarks
Comparing the PP calculation speed between [osu-perf](https://gitlab.com/JackRedstonia/osu-perf/), an [oppai-ng](https://github.com/Francesco149/oppai-ng) rust binding, and rosu-pp's `no_sliders_no_leniency`:
@@ -95,20 +96,20 @@ Comparing the stars (in)accuracy between rosu-pp's `all_included`, `no_leniency`
<img src="./benchmark_results/stars_inaccuracy.svg">
#### Roadmap
### Roadmap
- osu sr versions
- [x] all included
- [x] no_leniency
- [x] no_sliders_no_leniency
- [x] taiko sr
- [x] ctb sr
- [x] mania sr
- \[x\] all included
- \[x\] no_leniency
- \[x\] no_sliders_no_leniency
- \[x\] taiko sr
- \[x\] ctb sr
- \[x\] mania sr
---
- [x] osu pp
- [x] taiko pp
- [x] ctb pp
- [x] mania pp
- \[x\] osu pp
- \[x\] taiko pp
- \[x\] ctb pp
- \[x\] mania pp
---
- [x] refactoring
- [x] benchmarking
- \[x\] refactoring
- \[x\] benchmarking
+28 -35
View File
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg), deny(broken_intra_doc_links))]
//! A standalone crate to calculate star ratings and performance points for all [osu!](https://osu.ppy.sh/home) gamemodes.
//!
//! Conversions are generally not supported.
@@ -59,6 +61,7 @@
//! - `all_included`: Both stack leniency & slider paths are considered so that the difficulty and pp calculation immitates osu! as close as possible. Pro: Most precise; Con: Least performant.
//! - `no_leniency`: The positional offset of notes created by stack leniency is not considered. This means the jump distance inbetween notes might be slightly off, resulting in small inaccuracies. Since calculating these offsets is relatively expensive though, this version is considerably faster than `all_included`.
//! - `no_slider_no_leniency` (i.e. [oppai](https://github.com/Francesco149/oppai-ng)): In addition to not considering the positional offset caused by stack leniency, slider paths are also ignored. This means the travel distance of notes is completely omitted which may cause further inaccuracies. Since the slider paths don't have to be computed though, it is generally faster than `no_leniency`.
//!
//! **Note**: If the `fruits` feature is enabled, sliders will be parsed regardless, resulting in a reduced performance advantage of `no_sliders_no_leniency`.
//!
//! ### Features
@@ -74,52 +77,42 @@
//! | `no_sliders_no_leniency` | When calculating difficulty attributes in osu!standard, ignore stack leniency and sliders. Best performance but slightly less precision than `no_leniency`. |
//! | `all_included` | When calculating difficulty attributes in osu!standard, consider both stack leniency and sliders. Best precision but significantly worse performance than `no_leniency`. |
//!
//! ### Benchmarks
//!
//! Comparing the PP calculation speed between [osu-perf](https://gitlab.com/JackRedstonia/osu-perf/), an [oppai-ng](https://github.com/Francesco149/oppai-ng) rust binding, and rosu-pp's `no_sliders_no_leniency`:
//!
//! ![crates PP calculation](./bechmark_results/crates_pp_calc.svg)
//! <img src="./bechmark_results/crates_pp_calc.svg">
//!
//! Comparing the PP calculation speed between rosu-pp's `all_included`, `no_leniency`, and `no_sliders_no_leniency` versions:
//!
//! ![rosu PP calculation](./bechmark_results/rosu_pp_calc.svg)
//! <img src="./bechmark_results/rosu_pp_calc.svg">
//!
//! Comparing the PP (in)accuracy between rosu-pp's `all_included`, `no_leniency`, and `no_sliders_no_leniency` versions:
//!
//! ![rosu PP inaccuracy](./bechmark_results/pp_inaccuracy.svg)
//! <img src="./bechmark_results/pp_inaccuracy.svg">
//!
//! Comparing the stars (in)accuracy between rosu-pp's `all_included`, `no_leniency`, and `no_sliders_no_leniency` versions:
//!
//! ![rosu stars inaccuracy](./bechmark_results/stars_inaccuracy.svg)
//! <img src="./bechmark_results/stars_inaccuracy.svg">
//!
//! ### Roadmap
//!
//! - osu sr versions
//! - [x] all included
//! - [x] no_leniency
//! - [x] no_sliders_no_leniency
//! - [x] taiko sr
//! - [x] ctb sr
//! - [x] mania sr
//! - \[x\] all included
//! - \[x\] no_leniency
//! - \[x\] no_sliders_no_leniency
//! - \[x\] taiko sr
//! - \[x\] ctb sr
//! - \[x\] mania sr
//! ---
//! - [x] osu pp
//! - [x] taiko pp
//! - [x] ctb pp
//! - [x] mania pp
//! - \[x\] osu pp
//! - \[x\] taiko pp
//! - \[x\] ctb pp
//! - \[x\] mania pp
//! ---
//! - [x] refactoring
//! - [x] benchmarking
//! - \[x\] refactoring
//! - \[x\] benchmarking
#[cfg(feature = "fruits")]
#[cfg_attr(docsrs, doc(cfg(feature = "fruits")))]
pub mod fruits;
#[cfg(feature = "mania")]
#[cfg_attr(docsrs, doc(cfg(feature = "mania")))]
pub mod mania;
#[cfg(feature = "osu")]
#[cfg_attr(docsrs, doc(cfg(feature = "osu")))]
pub mod osu;
pub mod parse;
#[cfg(feature = "taiko")]
#[cfg_attr(docsrs, doc(cfg(feature = "taiko")))]
pub mod taiko;
mod parse;
mod pp;
pub use pp::{AnyPP, AttributeProvider};
+3
View File
@@ -1,10 +1,13 @@
#[cfg(feature = "all_included")]
#[cfg_attr(docsrs, doc(cfg(feature = "all_included")))]
pub mod all_included;
#[cfg(feature = "no_leniency")]
#[cfg_attr(docsrs, doc(cfg(feature = "no_leniency")))]
pub mod no_leniency;
#[cfg(feature = "no_sliders_no_leniency")]
#[cfg_attr(docsrs, doc(cfg(feature = "no_sliders_no_leniency")))]
pub mod no_sliders_no_leniency;
const OSU_OD_MAX: f32 = 20.0;
+1 -1
View File
@@ -1,6 +1,6 @@
//! The positional offset of notes created by stack leniency is not considered.
//! This means the jump distance inbetween notes might be slightly off, resulting in small inaccuracies.
//! Since calculating these offsets is relatively expensive though, this version is considerably faster than `all_included`.
//! Since calculating these offsets is relatively expensive though, this version is faster than `all_included`.
#![cfg(feature = "no_leniency")]
+4
View File
@@ -69,6 +69,7 @@ macro_rules! section {
};
}
/// The mode of a beatmap.
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
pub enum GameMode {
STD = 0,
@@ -83,6 +84,8 @@ impl Default for GameMode {
}
}
/// The main beatmap struct containing all data relevant
/// for difficulty and pp calculation
#[derive(Clone, Default, Debug)]
pub struct Beatmap {
pub mode: GameMode,
@@ -558,6 +561,7 @@ fn split_colon(line: &str) -> Option<(&str, &str)> {
Some((split.next()?, split.next()?.trim()))
}
/// The type of curve of a slider.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum PathType {
Catmull = 0,