8000 Improve positioning of Touch notes in converted maps by LumpBloom7 · Pull Request #225 · LumpBloom7/sentakki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve positioning of Touch notes in converted maps #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service 8000 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions osu.Game.Rulesets.Sentakki.Tests/Objects/TestSceneTouchNote.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Sentakki.Beatmaps;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.Objects.Drawables;
using osu.Game.Rulesets.Sentakki.UI.Components;
using osu.Game.Tests.Visual;
using osuTK;

Expand All @@ -22,30 +24,35 @@ public class TestSceneTouchNote : OsuTestScene
public TestSceneTouchNote()
{
base.Content.Add(content = new SentakkiInputManager(new SentakkiRuleset().RulesetInfo));
base.Content.Add(new SentakkiRing());

AddStep("Miss Single", () => testSingle());
AddStep("Hit Single", () => testSingle(true));
AddStep("Miss Single", () => testAllPositions());
AddStep("Hit Single", () => testAllPositions(true));
AddUntilStep("Wait for object despawn", () => !Children.Any(h => (h is DrawableSentakkiHitObject) && (h as DrawableSentakkiHitObject).AllJudged == false));
}

private void testSingle(bool auto = false)
private void testAllPositions(bool auto = false)
{
var circle = new Touch
foreach (var position in SentakkiPatternGenerator.VALID_TOUCH_POSITIONS)
{
StartTime = Time.Current + 1000,
Position = new Vector2(0, -1),
};
var circle = new Touch
{
StartTime = Time.Current + 1000,
Position = position,
};

circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });
circle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { });

Add(new DrawableTouch(circle)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Depth = depthIndex++,
Auto = auto
});
Add(new DrawableTouch(circle)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Depth = depthIndex++,
Auto = auto
});
}
}

protected override Ruleset CreateRuleset() => new SentakkiRuleset();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public enum ConversionExperiments
none = 0,
twinNotes = 1,
twinSlides = 2,
touch = 4,
}

public class SentakkiBeatmapConverter : BeatmapConverter<SentakkiHitObject>
Expand Down
38 changes: 36 additions & 2 deletions osu.Game.Rulesets.Sentakki/Beatmaps/SentakkiPatternGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Sentakki.Objects;
using osu.Game.Rulesets.Sentakki.UI;
using osuTK;

namespace osu.Game.Rulesets.Sentakki.Beatmaps
{
Expand Down Expand Up @@ -121,7 +123,7 @@ public IEnumerable<SentakkiHitObject> GenerateNewNote(HitObject original)

default:
breakNote = original.Samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH);
if (!breakNote && Experiments.Value.HasFlagFast(ConversionExperiments.touch) && original.Samples.Any(s => s.Name == HitSampleInfo.HIT_WHISTLE))
if (!breakNote && original.Samples.Any(s => s.Name == HitSampleInfo.HIT_WHISTLE))
{
yield return createTouchNote(original);
}
Expand Down Expand Up @@ -235,13 +237,45 @@ private SentakkiHitObject createTapNote(HitObject original, bool twin = false, b
};
}

public static readonly List<Vector2> VALID_TOUCH_POSITIONS;
static SentakkiPatternGenerator()
{
var tmp = new List<Vector2>(){
Vector2.Zero
};
foreach (var angle in SentakkiPlayfield.LANEANGLES)
{
tmp.Add(SentakkiExtensions.GetCircularPosition(190, angle - 22.5f));
tmp.Add(SentakkiExtensions.GetCircularPosition(130, angle));
}
VALID_TOUCH_POSITIONS = tmp;
}

private readonly Dictionary<Vector2, double> endTimes = new Dictionary<Vector2, double>();

private SentakkiHitObject createTouchNote(HitObject original)
{
var availableTouchPositions = VALID_TOUCH_POSITIONS.Where(v =>
{
if (endTimes.TryGetValue(v, out double endTime))
return original.StartTime >= endTime;
return true;
});

// Choosing a position
Vector2 position;
if (availableTouchPositions.Any())
position = availableTouchPositions.ElementAt(rng.Next(0, availableTouchPositions.Count()));
else
position = endTimes.OrderBy(x => x.Value).First().Key;

endTimes[position] = original.StartTime + 500;

return new Touch
{
Samples = original.Samples,
StartTime = original.StartTime,
Position = SentakkiExtensions.GetCircularPosition(rng.Next(200), rng.Next(360))
Position = position
};
}
}
Expand Down
10 changes: 0 additions & 10 deletions osu.Game.Rulesets.Sentakki/Mods/SentakkiModExperimental.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,13 @@ public class SentakkiModExperimental : Mod, IApplicableToBeatmapConverter
Value = false
};

[SettingSource("Touch notes", "Allow TOUCHs to appear")]
public BindableBool EnableTouch { get; } = new BindableBool
{
Default = false,
Value = false
};

public void ApplyToBeatmapConverter(IBeatmapConverter beatmapConverter)
{
if (EnableTwinNotes.Value)
(beatmapConverter as SentakkiBeatmapConverter).EnabledExperiments.Value |= ConversionExperiments.twinNotes;

if (EnableTwinSlides.Value)
(beatmapConverter as SentakkiBeatmapConverter).EnabledExperiments.Value |= ConversionExperiments.twinSlides;

if (EnableTouch.Value)
(beatmapConverter as SentakkiBeatmapConverter).EnabledExperiments.Value |= ConversionExperiments.touch;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private void load(SentakkiRulesetConfigManager sentakkiConfigs)
{
sentakkiConfigs?.BindWith(SentakkiRulesetSettings.TouchAnimationDuration, AnimationDuration);

Size = new Vector2(130);
Size = new Vector2(105);
Origin = Anchor.Centre;
Anchor = Anchor.Centre;
Alpha = 0;
Expand Down
0