Skip to content

Commit

Permalink
Merge pull request #78 from LumpBloom7/FavorPaths
Browse files Browse the repository at this point in the history
Consistently use lane number instead of a angles within hitobjects
  • Loading branch information
LumpBloom7 authored Jul 8, 2020
2 parents 821be42 + cd3443c commit b39c054
Show file tree
Hide file tree
Showing 19 changed files with 104 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ private void testSingle(bool auto = false)
{
IsBreak = true,
StartTime = Time.Current + 1000,
Position = new Vector2(0, -66f),
Angle = 0,
EndPosition = new Vector2(0, -296.5f),
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });
Expand Down
3 changes: 0 additions & 3 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneHoldNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ private void testSingle(double duration, bool auto = false)
{
StartTime = Time.Current + 1000,
EndTime = Time.Current + 1000 + duration,
Position = new Vector2(0, -66),
EndPosition = new Vector2(0, -296.5f),
Angle = 0f,
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });
Expand Down
3 changes: 0 additions & 3 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneTapNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ private void testSingle(bool auto = false)
var circle = new Tap
{
StartTime = Time.Current + 1000,
Position = new Vector2(0, -66f),
Angle = 0,
EndPosition = new Vector2(0, -296.5f),
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ private void testSingle(bool auto = false)
{
StartTime = Time.Current + 1000,
Duration = 5000,
Position = new Vector2(0, 0)
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected override IEnumerable<SentakkiHitObject> ConvertHitObject(HitObject ori
Vector2 newPos = (original as IHasPosition)?.Position ?? Vector2.Zero;
newPos.Y = 384 - newPos.Y;

int path = newPos.GetDegreesFromPosition(CENTRE_POINT).GetNotePathFromDegrees();
int lane = newPos.GetDegreesFromPosition(CENTRE_POINT).GetNoteLaneFromDegrees();
List<SentakkiHitObject> objects = new List<SentakkiHitObject>();

if (EnabledExperiments.Value.HasFlag(ConversionExperiments.patternv2))
Expand All @@ -65,7 +65,7 @@ protected override IEnumerable<SentakkiHitObject> ConvertHitObject(HitObject ori
switch (original)
{
case IHasPathWithRepeats _:
objects.AddRange(Conversions.CreateHoldNote(original, path, beatmap, random, EnabledExperiments.Value));
objects.AddRange(Conversions.CreateHoldNote(original, lane, beatmap, random, EnabledExperiments.Value));
break;

case IHasDuration _:
Expand All @@ -74,9 +74,9 @@ protected override IEnumerable<SentakkiHitObject> ConvertHitObject(HitObject ori

default:
if (EnabledExperiments.Value.HasFlag(ConversionExperiments.touch) && (random2.Next() % 10 == 0))
objects.AddRange(Conversions.CreateTouchNote(original, path, random, EnabledExperiments.Value));
objects.AddRange(Conversions.CreateTouchNote(original, lane, random, EnabledExperiments.Value));
else
objects.AddRange(Conversions.CreateTapNote(original, path, random, EnabledExperiments.Value));
objects.AddRange(Conversions.CreateTapNote(original, lane, random, EnabledExperiments.Value));
break;
}

Expand Down
51 changes: 20 additions & 31 deletions osu.Game.Rulesets.Sentakki/Beatmaps/SentakkiNoteConversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Sentakki.Beatmaps
{
public static class Conversions
{
public static List<SentakkiHitObject> CreateTapNote(HitObject original, int path, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
public static List<SentakkiHitObject> CreateTapNote(HitObject original, int lane, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
{
List<SentakkiHitObject> notes = new List<SentakkiHitObject>();
bool strong = original.Samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH);
Expand All @@ -26,24 +26,20 @@ public static List<SentakkiHitObject> CreateTapNote(HitObject original, int path
notes.Add(new Tap
{
IsBreak = strong,
Angle = path.GetAngleFromPath(),
Lane = lane,
Samples = original.Samples,
StartTime = original.StartTime,
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, path),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, path),
StartTime = original.StartTime
});
if (twin && experimental.HasFlag(ConversionExperiments.twins))
{
int newPath = path;
while (path == newPath) newPath = rng.Next(0, 8);
int newPath = lane;
while (lane == newPath) newPath = rng.Next(0, 8);
notes.Add(new Tap
{
IsBreak = strong,
Angle = newPath.GetAngleFromPath(),
Lane = newPath,
Samples = original.Samples,
StartTime = original.StartTime,
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, newPath),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, newPath),
StartTime = original.StartTime
});
foreach (var note in notes)
note.HasTwin = true;
Expand All @@ -52,7 +48,7 @@ public static List<SentakkiHitObject> CreateTapNote(HitObject original, int path
return notes;
}

public static List<SentakkiHitObject> CreateTouchNote(HitObject original, int path, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
public static List<SentakkiHitObject> CreateTouchNote(HitObject original, int lane, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
{
Vector2 newPos = (original as IHasPosition)?.Position ?? Vector2.Zero;
newPos.Y = 384 - newPos.Y - 192;
Expand All @@ -62,7 +58,7 @@ public static List<SentakkiHitObject> CreateTouchNote(HitObject original, int pa
{
Samples = original.Samples,
StartTime = original.StartTime,
Position = newPos,
Position = newPos
}};

return notes;
Expand All @@ -71,13 +67,12 @@ public static List<SentakkiHitObject> CreateTouchNote(HitObject original, int pa
public static SentakkiHitObject CreateTouchHold(HitObject original)
=> new TouchHold
{
Position = Vector2.Zero,
StartTime = original.StartTime,
EndTime = (original as IHasDuration).EndTime,
Samples = original.Samples,
};

public static List<SentakkiHitObject> CreateHoldNote(HitObject original, int path, IBeatmap beatmap, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
public static List<SentakkiHitObject> CreateHoldNote(HitObject original, int lane, IBeatmap beatmap, Random rng, ConversionExperiments experimental = ConversionExperiments.none)
{
var curveData = original as IHasPathWithRepeats;

Expand All @@ -88,36 +83,32 @@ public static List<SentakkiHitObject> CreateHoldNote(HitObject original, int pat
notes.Add(new Hold
{
IsBreak = strong,
Angle = path.GetAngleFromPath(),
Lane = lane,
NodeSamples = curveData.NodeSamples,
StartTime = original.StartTime,
EndTime = original.GetEndTime(),
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, path),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, path),
EndTime = original.GetEndTime()
});

if (experimental.HasFlag(ConversionExperiments.twins))
{
if (twin)
{
int newPath = path;
while (path == newPath) newPath = rng.Next(0, 8);
int newLane = lane;
while (lane == newLane) newLane = rng.Next(0, 8);
notes.Add(new Hold
{
IsBreak = strong,
Angle = newPath.GetAngleFromPath(),
Lane = newLane,
NodeSamples = curveData.NodeSamples,
StartTime = original.StartTime,
EndTime = original.GetEndTime(),
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, newPath),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, newPath),
});
foreach (var note in notes)
note.HasTwin = true;
}
else
{
var taps = CreateTapFromTicks(original, path, beatmap, rng);
var taps = CreateTapFromTicks(original, lane, beatmap, rng);
if (taps.Any())
notes.AddRange(taps);
}
Expand All @@ -126,7 +117,7 @@ public static List<SentakkiHitObject> CreateHoldNote(HitObject original, int pat
return notes;
}

public static List<SentakkiHitObject> CreateTapFromTicks(HitObject original, int path, IBeatmap beatmap, Random rng)
public static List<SentakkiHitObject> CreateTapFromTicks(HitObject original, int lane, IBeatmap beatmap, Random rng)
{
var curve = original as IHasPathWithRepeats;
double spanDuration = curve.Duration / (curve.RepeatCount + 1);
Expand All @@ -151,20 +142,18 @@ public static List<SentakkiHitObject> CreateTapFromTicks(HitObject original, int

foreach (var e in SliderEventGenerator.Generate(original.StartTime, spanDuration, velocity, tickDistance, curve.Path.Distance, curve.RepeatCount + 1, legacyLastTickOffset, CancellationToken.None))
{
int newPath = path;
while (newPath == path) newPath = rng.Next(0, 8);
int newLane = lane;
while (newLane == lane) newLane = rng.Next(0, 8);

switch (e.Type)
{
case SliderEventType.Tick:
case SliderEventType.Repeat:
hitObjects.Add(new Tap
{
Angle = newPath.GetAngleFromPath(),
Lane = newLane,
Samples = getTickSamples(original.Samples),
StartTime = e.Time,
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, newPath),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, newPath),
});
break;
}
Expand Down
30 changes: 12 additions & 18 deletions osu.Game.Rulesets.Sentakki/Beatmaps/SentakkiPatternGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ public SentakkiPatternGenerator(IBeatmap beatmap)
rng = new Random(seed);
}

//The patterns will generate the note path to be used based on the current offset
//The patterns will generate the note lane to be used based on the current offset
// argument list is (offset, diff)
private List<Func<bool, int>> patternlist => new List<Func<bool, int>>{
//Stream pattern, path difference determined by offset2
//Stream pattern, lane difference determined by offset2
(twin)=> {
if(twin) return offset + 4;
else offset+=offset2;
return offset;
},
// Back and forth, works better with longer combos
// Path difference determined by offset2, but will make sure offset2 is never 0.
// Lane difference determined by offset2, but will make sure offset2 is never 0.
(twin)=>{
offset2 = offset2 == 0 ? 1 : offset2;
offset+=offset2;
Expand All @@ -53,7 +53,7 @@ public SentakkiPatternGenerator(IBeatmap beatmap)
private int offset = 0;
private int offset2 = 0;

private int getNewPath(bool twin = false) => patternlist[currentPattern].Invoke(twin);
private int getNewLane(bool twin = false) => patternlist[currentPattern].Invoke(twin);

public void CreateNewPattern()
{
Expand Down Expand Up @@ -120,21 +120,19 @@ public IEnumerable<SentakkiHitObject> GenerateNewNote(HitObject original)
// Individual note generation code, because it's cleaner
private SentakkiHitObject createHoldNote(HitObject original, bool twin = false, bool isBreak = false)
{
int notePath = getNewPath(twin);
int noteLane = getNewLane(twin);
return new Hold
{
IsBreak = isBreak,
Angle = notePath.GetAngleFromPath(),
Lane = noteLane,
NodeSamples = (original as IHasPathWithRepeats).NodeSamples,
StartTime = original.StartTime,
EndTime = original.GetEndTime(),
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, notePath),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, notePath),
EndTime = original.GetEndTime()
};
}
private IEnumerable<SentakkiHitObject> createTapsFromTicks(HitObject original)
{
int notePath = getNewPath(true);
int noteLane = getNewLane(true);

var curve = original as IHasPathWithRepeats;
double spanDuration = curve.Duration / (curve.RepeatCount + 1);
Expand Down Expand Up @@ -164,16 +162,14 @@ private IEnumerable<SentakkiHitObject> createTapsFromTicks(HitObject original)
case SliderEventType.Repeat:
yield return new Tap
{
Angle = notePath.GetAngleFromPath(),
Lane = noteLane,
Samples = original.Samples.Select(s => new HitSampleInfo
{
Bank = s.Bank,
Name = @"slidertick",
Volume = s.Volume
}).ToList(),
StartTime = e.Time,
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, notePath),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, notePath),
StartTime = e.Time
};
break;
}
Expand All @@ -182,15 +178,13 @@ private IEnumerable<SentakkiHitObject> createTapsFromTicks(HitObject original)

private SentakkiHitObject createTapNote(HitObject original, bool twin = false, bool isBreak = false)
{
int notePath = getNewPath(twin);
int noteLane = getNewLane(twin);
return new Tap
{
IsBreak = isBreak,
Angle = notePath.GetAngleFromPath(),
Lane = noteLane,
Samples = original.Samples,
StartTime = original.StartTime,
EndPosition = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.INTERSECTDISTANCE, notePath),
Position = SentakkiExtensions.GetPathPosition(SentakkiPlayfield.NOTESTARTDISTANCE, notePath),
};
}

Expand Down
8 changes: 6 additions & 2 deletions osu.Game.Rulesets.Sentakki/Objects/Drawables/DrawableHold.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public DrawableHold(Hold hitObject)
Position = Vector2.Zero;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Rotation = HitObject.Angle;
AlwaysPresent = true;
AddRangeInternal(new Drawable[]{
HitObjectLine = new HitObjectLine(),
Expand Down Expand Up @@ -82,9 +81,14 @@ public DrawableHold(Hold hitObject)
isHitting.Value = false;
NoteBody.Glow.FadeOut(100);
},
NoteAngle = HitObject.Angle
}
});

hitObject.LaneBindable.BindValueChanged(r =>
{
Rotation = r.NewValue.GetRotationForLane();
HitArea.NotePath = r.NewValue;
}, true);
}

protected override void AddNestedHitObject(DrawableHitObject hitObject)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class DrawableSentakkiHitObject : DrawableHitObject<SentakkiHitObject>
// Used for the animation update
protected readonly Bindable<double> AnimationDuration = new Bindable<double>(1000);

protected override float SamplePlaybackPosition => (HitObject.EndPosition.X + SentakkiPlayfield.INTERSECTDISTANCE) / (SentakkiPlayfield.INTERSECTDISTANCE * 2);
protected override float SamplePlaybackPosition => (SentakkiExtensions.GetPositionAlongLane(SentakkiPlayfield.INTERSECTDISTANCE, HitObject.Lane).X / (SentakkiPlayfield.INTERSECTDISTANCE * 2)) + .5f;
public SentakkiAction[] HitActions { get; set; } = new[]
{
SentakkiAction.Button1,
Expand Down
Loading

0 comments on commit b39c054

Please sign in to comment.