Skip to content

Commit

Permalink
Make the autoplay touch reactions more "human"
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 committed Oct 5, 2020
1 parent 80b7f4a commit d63324f
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions osu.Game.Rulesets.Sentakki/Replays/SentakkiAutoGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ namespace osu.Game.Rulesets.Sentakki.Replays
{
public class SentakkiAutoGenerator : AutoGenerator
{
public const double RELEASE_DELAY = 20;
public const double KEY_RELEASE_DELAY = 20;
public const double TOUCH_RELEASE_DELAY = 50;
public const double TOUCH_REACT_DELAY = 200;

protected Replay Replay;
protected List<ReplayFrame> Frames => Replay.Frames;
Expand Down Expand Up @@ -88,9 +90,9 @@ private IEnumerable<IActionPoint> generateActionPoints()
var nextObjectInColumn = GetNextObject(i) as SentakkiLanedHitObject; // Get the next object that requires pressing the same button

bool canDelayKeyUp = nextObjectInColumn == null ||
nextObjectInColumn.StartTime > endTime + RELEASE_DELAY;
nextObjectInColumn.StartTime > endTime + KEY_RELEASE_DELAY;

double calculatedDelay = canDelayKeyUp ? RELEASE_DELAY : (nextObjectInColumn.StartTime - endTime) * 0.9;
double calculatedDelay = canDelayKeyUp ? KEY_RELEASE_DELAY : (nextObjectInColumn.StartTime - endTime) * 0.9;

yield return new KeyDown { Time = currentObject.StartTime, Lane = laned.Lane };
yield return new KeyUp { Time = endTime + calculatedDelay, Lane = laned.Lane };
Expand All @@ -107,8 +109,8 @@ private IEnumerable<IActionPoint> generateActionPoints()
TouchReplayEvent = new TouchReplayEvent(slideInfo.SlidePath.Path, slideInfo.Duration - delay, currentObject.StartTime + delay, s.Lane.GetRotationForLane() - 22.5f),
PointNumber = nextAvailableTouchPoint()
};
yield return new TouchUp { Time = currentObject.StartTime + slideInfo.Duration, PointNumber = nextAvailableTouchPoint() };
touchPointInUsedUntil[nextAvailableTouchPoint()] = currentObject.StartTime + slideInfo.Duration;
yield return new TouchUp { Time = currentObject.StartTime + slideInfo.Duration + TOUCH_RELEASE_DELAY, PointNumber = nextAvailableTouchPoint() };
touchPointInUsedUntil[nextAvailableTouchPoint()] = currentObject.StartTime + slideInfo.Duration + TOUCH_REACT_DELAY;
}
}
break;
Expand All @@ -118,21 +120,21 @@ private IEnumerable<IActionPoint> generateActionPoints()
{
Time = currentObject.StartTime,
PointNumber = nextAvailableTouchPoint(),
TouchReplayEvent = new TouchReplayEvent(t.Position, RELEASE_DELAY, currentObject.StartTime)
TouchReplayEvent = new TouchReplayEvent(t.Position, TOUCH_RELEASE_DELAY, currentObject.StartTime)
};
yield return new TouchUp { Time = endTime + RELEASE_DELAY, PointNumber = nextAvailableTouchPoint() };
touchPointInUsedUntil[nextAvailableTouchPoint()] = endTime + RELEASE_DELAY;
yield return new TouchUp { Time = endTime + TOUCH_RELEASE_DELAY, PointNumber = nextAvailableTouchPoint() };
touchPointInUsedUntil[nextAvailableTouchPoint()] = endTime + TOUCH_REACT_DELAY;
break;

case TouchHold _:
yield return new TouchDown
{
Time = currentObject.StartTime,
PointNumber = nextAvailableTouchPoint(),
TouchReplayEvent = new TouchReplayEvent(Vector2.Zero, RELEASE_DELAY, currentObject.StartTime)
TouchReplayEvent = new TouchReplayEvent(Vector2.Zero, TOUCH_RELEASE_DELAY, currentObject.StartTime)
};
yield return new TouchUp { Time = endTime + RELEASE_DELAY, PointNumber = nextAvailableTouchPoint() };
touchPointInUsedUntil[nextAvailableTouchPoint()] = endTime + RELEASE_DELAY;
yield return new TouchUp { Time = endTime + TOUCH_RELEASE_DELAY, PointNumber = nextAvailableTouchPoint() };
touchPointInUsedUntil[nextAvailableTouchPoint()] = endTime + TOUCH_REACT_DELAY;
break;
}
}
Expand Down

0 comments on commit d63324f

Please sign in to comment.