Skip to content

Commit

Permalink
push taiko rework, remove combo scaling (both vn and rx)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeenyuhs committed Jul 22, 2024
1 parent e3a90eb commit 6cbeb39
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/model/beatmap/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl BeatmapAttributesBuilder {

let clock_rate = self.clock_rate.unwrap_or(mods.clock_rate());
let ar_clock_rate = if self.ar.with_mods { 1.0 } else { clock_rate };
let od_clock_rate = if self.ar.with_mods { 1.0 } else { clock_rate };
let od_clock_rate = if self.od.with_mods { 1.0 } else { clock_rate };

let mod_mult = |val: f32| {
if mods.hr() {
Expand Down
2 changes: 1 addition & 1 deletion src/model/beatmap/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ impl BeatmapState {
I: Iterator<Item = &'a str>,
F: FnOnce(&mut Self, &[&'a str]) -> O,
{
self.point_split.extend(point_split.map(|s| s as *const _));
self.point_split.extend(point_split.map(std::ptr::from_ref));
let ptr = self.point_split.as_ptr();
let len = self.point_split.len();

Expand Down
2 changes: 1 addition & 1 deletion src/osu/difficulty/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl<'a> OsuDifficultyObject<'a> {
return;
}

let scaling_factor = scaling_factor.factor_with_small_circle_bonus;
let scaling_factor = scaling_factor.factor;

let last_cursor_pos = Self::get_end_cursor_pos(last_object);

Expand Down
5 changes: 1 addition & 4 deletions src/osu/difficulty/scaling_factor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ use super::object::OsuDifficultyObject;
pub struct ScalingFactor {
/// `NORMALIZED_RADIUS / Radius`
pub factor: f32,
/// `NORMALIZED_RADIUS / Radius` and then adjusted if `Radius < 30`
pub factor_with_small_circle_bonus: f32,
pub radius: f64,
pub scale: f32,
}
Expand All @@ -31,8 +29,7 @@ impl ScalingFactor {
};

Self {
factor,
factor_with_small_circle_bonus,
factor: factor_with_small_circle_bonus,
radius,
scale,
}
Expand Down
39 changes: 19 additions & 20 deletions src/osu/performance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,19 +606,13 @@ impl OsuPerformanceInner {
// * Penalize misses by assessing # of misses relative to the total # of objects.
// * Default a 3% reduction for any # of misses.
if self.effective_miss_count > 0.0 {
if self.mods.rx() {
aim_value *= 0.97
* (0.95 - (self.effective_miss_count / total_hits).powf(1.1))
.powf(self.effective_miss_count);
} else {
aim_value *= 0.97
* (1.0 - (self.effective_miss_count / total_hits).powf(0.775))
.powf(self.effective_miss_count);
}
// In the "remove combo scaling" rework, they assume
// the scores misses, are done at the hardest parts of the map.
// https://github.com/ppy/osu/blob/c25e1bdeb586db8a2def47232632be61b4d4242e/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs#L261-L264
aim_value *= 0.96 / ((self.effective_miss_count / (4.0 * self.attrs.aim.log10().powf(0.94))) + 1.0);

}

aim_value *= self.get_combo_scaling_factor();

let ar_factor = if self.attrs.ar > 10.33 {
if self.mods.rx() {
1.2_f64.powf(self.attrs.ar - 10.33) - 1.0
Expand Down Expand Up @@ -681,13 +675,12 @@ impl OsuPerformanceInner {
// * Penalize misses by assessing # of misses relative to the total # of objects.
// * Default a 3% reduction for any # of misses.
if self.effective_miss_count > 0.0 {
speed_value *= 0.97
* (1.0 - (self.effective_miss_count / total_hits).powf(0.775))
.powf(self.effective_miss_count.powf(0.875));
// In the "remove combo scaling" rework, they assume
// the scores misses, are done at the hardest parts of the map.
// https://github.com/ppy/osu/blob/c25e1bdeb586db8a2def47232632be61b4d4242e/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs#L261-L264
speed_value *= 0.96 / ((self.effective_miss_count / (4.0 * self.attrs.speed.log10().powf(0.94))) + 1.0);
}

speed_value *= self.get_combo_scaling_factor();

let ar_factor = if self.attrs.ar > 10.33 {
0.3 * (self.attrs.ar - 10.33)
} else {
Expand Down Expand Up @@ -721,8 +714,16 @@ impl OsuPerformanceInner {
};

// * Scale the speed value with accuracy and OD.
speed_value *= (0.95 + self.attrs.od * self.attrs.od / 750.0)
* ((self.acc + relevant_acc) / 2.0).powf((14.5 - (self.attrs.od).max(8.0)) / 2.0);
if self.mods.rx() {
// As OD doesn't matter when you play relax,
// we should remove it from the equation and
// increase accuracy's importance to compensate.
// try out some stuff with this untill it's fitting...
speed_value *= 0.6 + 0.13 * ((self.acc.powi(2) + relevant_acc.powi(2))).powf(2.2);
} else {
speed_value *= (0.95 + self.attrs.od * self.attrs.od / 750.0)
* ((self.acc + relevant_acc) / 2.0).powf((14.5 - (self.attrs.od).max(8.0)) / 2.0);
}

// * Scale the speed value with # of 50s to punish doubletapping.
speed_value *= 0.99_f64.powf(
Expand Down Expand Up @@ -810,8 +811,6 @@ impl OsuPerformanceInner {
fn get_combo_scaling_factor(&self) -> f64 {
if self.attrs.max_combo == 0 {
1.0
} else if self.mods.rx() {
(f64::from(self.state.max_combo).sqrt() / f64::from(self.attrs.max_combo).sqrt()).powf(0.84).min(1.0)
} else {
(f64::from(self.state.max_combo).powf(0.8) / f64::from(self.attrs.max_combo).powf(0.8))
.min(1.0)
Expand Down
20 changes: 16 additions & 4 deletions src/taiko/difficulty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use crate::{
skills::peaks::PeaksSkill,
},
object::TaikoObject,
},
Difficulty,
}, util::mods::Mods, Difficulty
};

use self::skills::peaks::Peaks;
Expand Down Expand Up @@ -41,8 +40,21 @@ pub fn difficulty(
..Default::default()
};

let color_rating = peaks.color_difficulty_value();
let rhythm_rating = peaks.rhythm_difficulty_value();
let mods = difficulty.get_mods();

let color_rating = if mods.rx() {
0.0
} else {
peaks.color_difficulty_value()
};

let rhythm_rating = if mods.rx() {
peaks.rhythm_difficulty_value() * 0.875
} else {
peaks.rhythm_difficulty_value()
};

println!("{}", color_rating);
let stamina_rating = peaks.stamina_difficulty_value();
let combined_rating = peaks.difficulty_value();

Expand Down
35 changes: 27 additions & 8 deletions src/taiko/performance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,20 @@ impl TaikoPerformanceInner {
multiplier *= 1.075;
}

if self.mods.ez() {
if self.mods.ez() && self.mods.rx() {
multiplier *= 0.9;
} else if self.mods.ez() {
multiplier *= 0.975;
}

let diff_value = self.compute_difficulty_value(effective_miss_count);
let acc_value = self.compute_accuracy_value();

let pp = (diff_value.powf(1.1) + acc_value.powf(1.1)).powf(1.0 / 1.1) * multiplier;
let pp = if !self.mods.rx() {
(diff_value.powf(1.1) + acc_value.powf(1.1)).powf(1.0 / 1.1) * multiplier
} else {
(diff_value.powf(1.1) + acc_value.powf(1.2)).powf(1.0 / 1.1) * multiplier
};

TaikoPerformanceAttributes {
difficulty: self.attrs,
Expand All @@ -429,22 +435,29 @@ impl TaikoPerformanceInner {

diff_value *= 0.986_f64.powf(effective_miss_count);

if self.mods.ez() {
if self.mods.ez() && self.mods.rx() {
diff_value *= 0.9;
} else if self.mods.ez() {
diff_value *= 0.985;
}

if self.mods.hd() {
diff_value *= 1.025;
}

if self.mods.hr() {
if self.mods.hr() && self.mods.rx() {
diff_value *= 1.12;
} else if self.mods.hr() {
diff_value *= 1.05;
}

if self.mods.fl() {
diff_value *= 1.05 * len_bonus;
} else if self.mods.fl() && self.mods.rx() {
diff_value *= 1.12 * len_bonus;
}


let acc = self.custom_accuracy();

diff_value * acc.powf(2.0)
Expand All @@ -455,17 +468,23 @@ impl TaikoPerformanceInner {
return 0.0;
}

let mut acc_value = (60.0 / self.attrs.hit_window).powf(1.1)
* self.custom_accuracy().powf(8.0)
* self.attrs.stars.powf(0.4)
* 27.0;
let mut acc_value = if !self.mods.rx() {
(60.0 / self.attrs.hit_window).powf(1.1)
* self.custom_accuracy().powf(8.0)
* self.attrs.stars.powf(0.4)
* 27.0
} else {
self.custom_accuracy().powi(11) / (self.attrs.hit_window * 0.6) * 1800.0
};

let len_bonus = (self.total_hits() / 1500.0).powf(0.3).min(1.15);
acc_value *= len_bonus;

// * Slight HDFL Bonus for accuracy. A clamp is used to prevent against negative values
if self.mods.hd() && self.mods.fl() {
acc_value *= (1.075 * len_bonus).max(1.05);
} else if self.mods.hd() && self.mods.fl() && self.mods.rx() {
acc_value *= 1.15 * (len_bonus + 0.2);
}

acc_value
Expand Down
1 change: 1 addition & 0 deletions tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ macro_rules! impl_float {
impl_float!(f32 f64);

/// Trait to compare two instances and panic if they are not equal.
#[allow(unused)]
pub trait AssertEq {
fn assert_eq(&self, expected: &Self);
}

0 comments on commit 6cbeb39

Please sign in to comment.