mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 07:43:00 +08:00
Rewrite time range computation logic to be completely based on stable code
This commit is contained in:
parent
16c06169ed
commit
959cc7c7d9
@ -16,7 +16,6 @@ using osu.Game.Replays;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Taiko.Beatmaps;
|
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
using osu.Game.Rulesets.Taiko.Replays;
|
using osu.Game.Rulesets.Taiko.Replays;
|
||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
@ -36,6 +35,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
public new TaikoInputManager KeyBindingInputManager => (TaikoInputManager)base.KeyBindingInputManager;
|
public new TaikoInputManager KeyBindingInputManager => (TaikoInputManager)base.KeyBindingInputManager;
|
||||||
|
|
||||||
|
protected new TaikoPlayfieldAdjustmentContainer PlayfieldAdjustmentContainer => (TaikoPlayfieldAdjustmentContainer)base.PlayfieldAdjustmentContainer;
|
||||||
|
|
||||||
protected override bool UserScrollSpeedAdjustment => false;
|
protected override bool UserScrollSpeedAdjustment => false;
|
||||||
|
|
||||||
private SkinnableDrawable scroller;
|
private SkinnableDrawable scroller;
|
||||||
@ -68,22 +69,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
TimeRange.Value = ComputeTimeRange();
|
TimeRange.Value = ComputeTimeRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual double ComputeTimeRange()
|
protected virtual double ComputeTimeRange() => PlayfieldAdjustmentContainer.ComputeTimeRange();
|
||||||
{
|
|
||||||
// Taiko scrolls at a constant 100px per 1000ms. More notes become visible as the playfield is lengthened.
|
|
||||||
const float scroll_rate = 10;
|
|
||||||
|
|
||||||
// Since the time range will depend on a positional value, it is referenced to the x480 pixel space.
|
|
||||||
// Width is used because it defines how many notes fit on the playfield.
|
|
||||||
// We clamp the ratio to the maximum aspect ratio to keep scroll speed consistent on widths lower than the default.
|
|
||||||
float ratio = Math.Max(DrawSize.X / 768f, TaikoPlayfieldAdjustmentContainer.MAXIMUM_ASPECT);
|
|
||||||
|
|
||||||
// Stable internally increased the slider velocity of objects by a factor of `VELOCITY_MULTIPLIER`.
|
|
||||||
// To simulate this, we shrink the time range by that factor here.
|
|
||||||
// This, when combined with the rest of the scrolling ruleset machinery (see `MultiplierControlPoint` et al.),
|
|
||||||
// has the effect of increasing each multiplier control point's multiplier by `VELOCITY_MULTIPLIER`, ensuring parity with stable.
|
|
||||||
return (Playfield.HitObjectContainer.DrawWidth / ratio) * scroll_rate / TaikoBeatmapConverter.VELOCITY_MULTIPLIER;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -14,6 +15,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
public const float MAXIMUM_ASPECT = 16f / 9f;
|
public const float MAXIMUM_ASPECT = 16f / 9f;
|
||||||
public const float MINIMUM_ASPECT = 5f / 4f;
|
public const float MINIMUM_ASPECT = 5f / 4f;
|
||||||
|
|
||||||
|
private const float stable_gamefield_height = 480f;
|
||||||
|
|
||||||
public readonly IBindable<bool> LockPlayfieldAspectRange = new BindableBool(true);
|
public readonly IBindable<bool> LockPlayfieldAspectRange = new BindableBool(true);
|
||||||
|
|
||||||
public TaikoPlayfieldAdjustmentContainer()
|
public TaikoPlayfieldAdjustmentContainer()
|
||||||
@ -21,6 +24,9 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
RelativePositionAxes = Axes.Y;
|
RelativePositionAxes = Axes.Y;
|
||||||
Height = TaikoPlayfield.BASE_HEIGHT;
|
Height = TaikoPlayfield.BASE_HEIGHT;
|
||||||
|
|
||||||
|
// Matches stable, see https://github.com/peppy/osu-stable-reference/blob/7519cafd1823f1879c0d9c991ba0e5c7fd3bfa02/osu!/GameModes/Play/Rulesets/Taiko/RulesetTaiko.cs#L514
|
||||||
|
Y = 135f / stable_gamefield_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
@ -28,8 +34,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
const float base_relative_height = TaikoPlayfield.BASE_HEIGHT / 768;
|
const float base_relative_height = TaikoPlayfield.BASE_HEIGHT / 768;
|
||||||
// Matches stable, see https://github.com/peppy/osu-stable-reference/blob/7519cafd1823f1879c0d9c991ba0e5c7fd3bfa02/osu!/GameModes/Play/Rulesets/Taiko/RulesetTaiko.cs#L514
|
|
||||||
const float base_position = 135f / 480f;
|
|
||||||
|
|
||||||
float relativeHeight = base_relative_height;
|
float relativeHeight = base_relative_height;
|
||||||
|
|
||||||
@ -51,10 +55,38 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
// Limit the maximum relative height of the playfield to one-third of available area to avoid it masking out on extreme resolutions.
|
// Limit the maximum relative height of the playfield to one-third of available area to avoid it masking out on extreme resolutions.
|
||||||
relativeHeight = Math.Min(relativeHeight, 1f / 3f);
|
relativeHeight = Math.Min(relativeHeight, 1f / 3f);
|
||||||
|
|
||||||
Y = base_position;
|
|
||||||
|
|
||||||
Scale = new Vector2(Math.Max((Parent!.ChildSize.Y / 768f) * (relativeHeight / base_relative_height), 1f));
|
Scale = new Vector2(Math.Max((Parent!.ChildSize.Y / 768f) * (relativeHeight / base_relative_height), 1f));
|
||||||
Width = 1 / Scale.X;
|
Width = 1 / Scale.X;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double ComputeTimeRange()
|
||||||
|
{
|
||||||
|
float currentAspect = Parent!.ChildSize.X / Parent!.ChildSize.Y;
|
||||||
|
|
||||||
|
if (LockPlayfieldAspectRange.Value)
|
||||||
|
currentAspect = Math.Clamp(currentAspect, MINIMUM_ASPECT, MAXIMUM_ASPECT);
|
||||||
|
|
||||||
|
// in a game resolution of 1024x768, stable's scrolling system consists of objects being placed 600px (widthScaled - 40) away from their hit location.
|
||||||
|
// however, the point at which the object renders at the end of the screen is exactly x=640, but stable makes the object start moving from beyond the screen instead of the boundary point.
|
||||||
|
// therefore, in lazer we have to adjust the "in length" so that it's in a 640px->160px fashion before passing it down as a "time range".
|
||||||
|
// see stable's "in length": https://github.com/peppy/osu-stable-reference/blob/013c3010a9d495e3471a9c59518de17006f9ad89/osu!/GameplayElements/HitObjectManagerTaiko.cs#L168
|
||||||
|
const float stable_hit_location = 160f;
|
||||||
|
float widthScaled = currentAspect * stable_gamefield_height;
|
||||||
|
float inLength = widthScaled - stable_hit_location;
|
||||||
|
|
||||||
|
// also in a game resolution of 1024x768, stable makes hit objects scroll from 760px->160px at a duration of 6000ms, divided by slider velocity (i.e. at a rate of 0.1px/ms)
|
||||||
|
// compare: https://github.com/peppy/osu-stable-reference/blob/013c3010a9d495e3471a9c59518de17006f9ad89/osu!/GameplayElements/HitObjectManagerTaiko.cs#L218
|
||||||
|
// note: the variable "sv", in the linked reference, is equivalent to MultiplierControlPoint.Multiplier * 100, but since time range is agnostic of velocity, we replace "sv" with 100 below.
|
||||||
|
float inMsLength = inLength / 100 * 1000;
|
||||||
|
|
||||||
|
// stable multiplies the slider velocity by 1.4x for certain reasons, divide the time range by that factor to achieve similar result.
|
||||||
|
// for references on how the factor is applied to the time range, see:
|
||||||
|
// 1. https://github.com/peppy/osu-stable-reference/blob/013c3010a9d495e3471a9c59518de17006f9ad89/osu!/GameplayElements/HitObjectManagerTaiko.cs#L79 (DifficultySliderMultiplier multiplied by 1.4x)
|
||||||
|
// 2. https://github.com/peppy/osu-stable-reference/blob/013c3010a9d495e3471a9c59518de17006f9ad89/osu!/GameplayElements/HitObjectManager.cs#L468-L470 (DifficultySliderMultiplier used to calculate SliderScoringPointDistance)
|
||||||
|
// 3. https://github.com/peppy/osu-stable-reference/blob/013c3010a9d495e3471a9c59518de17006f9ad89/osu!/GameplayElements/HitObjectManager.cs#L248-L250 (SliderScoringPointDistance used to calculate slider velocity, i.e. the "sv" variable from above)
|
||||||
|
inMsLength /= TaikoBeatmapConverter.VELOCITY_MULTIPLIER;
|
||||||
|
|
||||||
|
return inMsLength;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user