1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 19:17:25 +08:00
Commit Graph

70 Commits

Author SHA1 Message Date
ekrctb
a548269c34 Fix scrolling hit object displayed in wrong position for one frame 2020-12-07 17:26:12 +09:00
smoogipoo
7ac2fba127 More reordering of public vs private methods 2020-11-30 17:44:58 +09:00
Dean Herbert
2745659986 Reword and xmldoc some comments 2020-11-30 15:54:20 +09:00
ekrctb
6e40de58e9 Use new OnAdd and OnRemove to invalidate DHO 2020-11-27 13:36:40 +09:00
ekrctb
eae33fe74a Fix format 2020-11-26 14:16:33 +09:00
ekrctb
e43f928588 Use DHO.HitObjectApplied to invalidate computation 2020-11-26 14:07:40 +09:00
ekrctb
f6faf95e33 Revert changes to HitObjectUsageBegan, not use it. 2020-11-26 14:01:46 +09:00
ekrctb
e34a205104 Rewrite hit object management, take three 2020-11-24 18:56:05 +09:00
ekrctb
7f6e4d5b21 Delay lifetime computation until loaded 2020-11-24 18:56:05 +09:00
ekrctb
d5f082e5fb Comment about lifetime assumption 2020-11-24 18:56:05 +09:00
ekrctb
ce57e8ddfb Separate Lifetime computation and layout update 2020-11-24 18:56:05 +09:00
ekrctb
cabc8aa63b Revert "Simplify ScrollingHitObjectContainer logic"
This reverts commit b4cc39149c117e6a0e95ee917a67cec8ba723d06.
2020-11-24 18:56:05 +09:00
ekrctb
8f39b54e58 Simplify ScrollingHitObjectContainer logic 2020-11-24 18:56:05 +09:00
ekrctb
5c743adbae Support hit object pooling scrolling playfield 2020-11-24 18:56:05 +09:00
smoogipoo
8f841b47e6 Cancel previous initial state computations 2020-07-24 19:31:08 +09:00
Dean Herbert
cbd563e80b Rename to IHasDuration 2020-05-27 12:38:39 +09:00
Dean Herbert
417e31d77f Rename function for consistency 2020-05-26 10:17:56 +09:00
Dean Herbert
d69111c665 Fix spelling of breadth 2020-05-26 10:17:34 +09:00
Dean Herbert
8fc60d12c9 Add back comments 2020-05-25 22:09:09 +09:00
Dean Herbert
2c16619ecd Move time to position conversion to ScrollingHitObjectContainer 2020-05-25 19:32:39 +09:00
Dan Balasescu
2f12c4126a
Apply suggestions from code review
Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
2020-05-10 13:49:08 +09:00
smoogipoo
be3b77cf25 Fix potentially skipping hitobject updates 2020-05-08 20:09:59 +09:00
smoogipoo
22dda3fe02 Make ScrollingHitObjectContainer respond to defaults applied events 2020-05-08 18:49:58 +09:00
smoogipoo
86ef73aa27 Implement HitObjectContainer.Clear() 2020-04-23 11:16:59 +09:00
smoogipoo
6c28fd21c7 osu-side changes 2020-02-24 20:52:15 +09:00
Bartłomiej Dach
5fde4f2c0c Fix lifetime calculation in overlapping algorithm
Changes to lifetime calculation in scrolling rulesets introduced in
#7367, which aimed to account for the distance between hit objects'
origin and its edge entering the scrolling area, fixed some issues with
hitobjects appearing abruptly, but also regressed some other scenarios.

Upon investigation, the regression was localised to the overlapping
scroll algorithm. The reason for this was two-fold:

* The previous code used TimeAt() to calculate the time of travel from
  the hit object's edge to its origin. For other algorithms, that time
  can be accurately reconstructed, because they don't have periods of
  time where there are multiple hit objects scrolling at different
  velocities.

  That invariant does not hold for the overlapping algorithm, therefore
  it is possible for different values to be technically correct for
  TimeAt(). However, the only value that matters for the adjustment
  is the one that's indicated by the control point that applies to the
  hit object origin, which can be uniquely identified.

* Additionally, the offset returned (even if correct) was applied
  externally to the hit object's start time and passed to
  GetDisplayStartTime(). In the overlapping algorithm, the choice of
  control point used in GetDisplayStartTime() is important, since
  the value of the speed multiplier is read within.

  Externally rewinding the hit object's start time meant that in some
  cases the speed multiplier of the *previous* control point is applied,
  which led to hit objects appearing too late if the scrolling rate
  decreased.

Because of the above, modify GetDisplayStartTime() to take the offset
into account in all algorithms, and apply the adjustment correctly
inside of them. The constant and sequential algorithms needed no
adjustment from the previous logic, since:

* the constant algorithm disregarded control points, and
* the sequential algorithm would effectively rewind to time = 0,
  calculate the absolute distance from time = 0 to the hit object start,
  apply the origin offset *to the absolute distance*, and then convert
  back to time, applying all control points in sequence. Due to this
  it was impossible for control points to get mixed up while
  calculating.

As for the overlapping algorithm, the high-level logic is as follows:

* The distance that the origin has to travel is the length of the scroll
  plus the distance from the origin to the object edge.
* The above distance divided by the scroll length gives the relative
  scroll lengths that the object has to travel.
* As one relative scroll length takes one time range, the relative
  travel length multiplied by the time range gives the absolute travel
  time of the object origin.
* Finally, the control point multiplier applicable at origin time is
  applied to the whole travel time.

Correctness of the above is demonstrated by visual tests added before
and headless unit tests of the algorithms themselves. The sequential
scroll algorithm was not covered by unit tests, and remains uncovered
due to floating-point inaccuracies that should be addressed separately.
2020-02-06 23:13:28 +01:00
Bartłomiej Dach
193e41f878 Add origin adjustment for hitobject lifetime
Visual inspection of taiko gameplay has shown that hitobjects appeared
on screen only when the origin of the hitobject came into the bounds
of the screen, instead of appearing when any visible part of the
hitobject came into the screen bounds.

This behaviour was due to lifetime calculation being based on the origin
of the hitobject and not taking into account the actual object
dimensions. Adjust the lifetime start of the hitobject by subtracting
the time needed to show the part of the hitobject that should already
be visible on screen when the origin comes into frame.
2019-12-26 20:37:29 +01:00
smoogipoo
0171b2ae7c Fix scrolling hitobjects expiring too soon 2019-11-01 12:10:03 +09:00
smoogipoo
af0c15a93c Fix initial hitobject states not being recomputed correctly 2019-09-24 16:48:39 +09:00
smoogipoo
d74e1b9b64 Remove from dictionary on Remove() 2019-09-02 15:06:43 +09:00
smoogipoo
8f8d35bd15 Delay initial hitobject state computation 2019-09-02 15:06:34 +09:00
Dean Herbert
0422c19c2f Group lifetime setters together 2019-08-26 19:06:23 +09:00
smoogipoo
fb1cd9e5e7 Add a sane default lifetime end for scrolling hitobjects 2019-08-26 16:47:23 +09:00
Dean Herbert
90b1fe81f3 Update cached usage in line with framework changes 2019-08-09 19:12:29 +09:00
Dean Herbert
c39c37a18d Apply more missed cases 2019-04-01 12:44:46 +09:00
smoogipoo
d8c55bc729 Adjust namespaces 2019-02-21 19:05:52 +09:00
Dean Herbert
8617aaa2a7 Update licence header (and remove year) 2019-01-24 17:43:03 +09:00
smoogipoo
10543cf1b6 Move rest of ScrollingPlayfield into ScrollingRulesetContainer 2018-11-12 17:34:35 +09:00
smoogipoo
e7969ecec7 Move ScrollAlgorithm inside IScrollingInfo 2018-11-12 17:34:35 +09:00
smoogipoo
ad45bc7666 Move scroll direction to scrollinginfo 2018-11-12 17:34:35 +09:00
smoogipoo
48486895ba Remove unused code 2018-11-12 17:34:35 +09:00
smoogipoo
7f0f143a1b Move IScrollAlgorithm to ScrollingRulesetContainer + use DI 2018-11-12 17:34:35 +09:00
smoogipoo
aee7a80e71 ScrollAlgorithm -> ScrollVisualisationMethod 2018-11-12 17:26:37 +09:00
smoogipoo
33056b8098 Adjust namespaces 2018-11-08 14:04:21 +09:00
smoogipoo
f66a9f4f1e Rename IScrollChangeVisualiser -> IScrollAlgorithm 2018-11-08 14:04:21 +09:00
smoogipoo
2f87f267a3 Fix height being set instead of width 2018-11-08 14:04:20 +09:00
smoogipoo
195f82fa96 Give visualiser methods range+length params again 2018-11-08 14:04:20 +09:00
smoogipoo
76ea314c27 Reorder params 2018-11-08 14:04:20 +09:00
smoogipoo
589c3a47e2 Remove state computation + updates from ISpeedChangeVisualiser 2018-11-08 14:04:20 +09:00
smoogipoo
0bdeebbce2 Expose basic values from ISpeedChangeVisualiser 2018-11-08 14:04:20 +09:00