Skip to content

[BUGFIX] Use song position of exact input frame when calculating note timings - #7790

Open
nykwono wants to merge 2 commits into
FunkinCrew:developfrom
nykwono:precise-song-position-inputs
Open

[BUGFIX] Use song position of exact input frame when calculating note timings#7790
nykwono wants to merge 2 commits into
FunkinCrew:developfrom
nykwono:precise-song-position-inputs

Conversation

@nykwono

@nykwono nykwono commented Jul 24, 2026

Copy link
Copy Markdown

Currently, the game calculates note timings by comparing the milliseconds of the conductor's current position with the note's millisecond time while also compensating for input latency.

However, due to there being latency between the exact frame the input was pressed and the frame at which the input is actually being processed, the song position the game uses to calculate the ms difference is not accurate.

This PR stores the milliseconds of the current song position for the precise input frame and uses that to calculate the note timing, which should help with bringing more accurate inputs.

@github-actions github-actions Bot added status: pending triage Awaiting review. pr: haxe PR modifies game code. size: medium A medium pull request with 100 or fewer changes. labels Jul 24, 2026
@NotHyper-474 NotHyper-474 added type: minor bug Involves a minor bug or issue. topic: scoring Involves the game's ranking and scoring systems. labels Jul 24, 2026
@iLauncherDev

Copy link
Copy Markdown

why not use timestamp?

@nykwono

nykwono commented Jul 24, 2026

Copy link
Copy Markdown
Author

timestamp is already used to help with input latency, however since timestamp and Conductor.instance.songPosition update differently (with one being nanoseconds and another being milliseconds) there is latency for the current song position as well that can't be accounted for with timestamp, which is why you need to account for that as well.

(Image showing that this latency does actually exist, I presume it's small for me because I run on a really good PC, but nonetheless it exists)
image

Edit: Tested it out since I was curious and yeah I was correct, the latency seems to be framerate dependent, on 60 FPS I was getting around seems around ~15-20ms while on 30 FPS it was above 30ms, so if you're on a low end device this does affect your inputs lol)
image
image

@Hundrec
Hundrec requested a review from Kade-github July 25, 2026 09:00
@Hundrec Hundrec changed the title Use the song position of the exact input frame when calculating note timings [BUGFIX] Use song position of exact input frame when calculating note timings Jul 25, 2026
@Kade-github

Copy link
Copy Markdown
Member

timestamp is already used to help with input latency, however since timestamp and Conductor.instance.songPosition update differently (with one being nanoseconds and another being milliseconds) there is latency for the current song position as well that can't be accounted for with timestamp, which is why you need to account for that as well.

(Image showing that this latency does actually exist, I presume it's small for me because I run on a really good PC, but nonetheless it exists) image

Edit: Tested it out since I was curious and yeah I was correct, the latency seems to be framerate dependent, on 60 FPS I was getting around seems around ~15-20ms while on 30 FPS it was above 30ms, so if you're on a low end device this does affect your inputs lol) image image

Yeah, that makes sense, since it would be the difference of how far the song goes after you press the note, and then when the note input actually gets processed.

@nykwono
nykwono force-pushed the precise-song-position-inputs branch from 710be99 to 08db84c Compare July 25, 2026 17:26
@Hundrec

Hundrec commented Jul 28, 2026

Copy link
Copy Markdown
Member

Can you rebase this branch to remove conflicts?

@Hundrec Hundrec added status: needs revision Cannot be approved because it is awaiting some work by the contributor. and removed status: pending triage Awaiting review. labels Jul 28, 2026
@nykwono

nykwono commented Jul 28, 2026

Copy link
Copy Markdown
Author

Got it

@nykwono
nykwono force-pushed the precise-song-position-inputs branch from 1194f5f to 0454bab Compare July 28, 2026 12:27
@NotHyper-474 NotHyper-474 added status: pending triage Awaiting review. and removed status: needs revision Cannot be approved because it is awaiting some work by the contributor. labels Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: haxe PR modifies game code. size: medium A medium pull request with 100 or fewer changes. status: pending triage Awaiting review. topic: scoring Involves the game's ranking and scoring systems. type: minor bug Involves a minor bug or issue.

Development

Successfully merging this pull request may close these issues.

5 participants