-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make note rendering based on frames AND song position #3544
base: develop
Are you sure you want to change the base?
Make note rendering based on frames AND song position #3544
Conversation
This issue has been bugging me for a rly long time as a 120hz player, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Burgerballs approves of this!
I approve of this |
I can (kinda?) see the problem you're trying to solve, but this is definitely a janky solution for it. The proper fix is to just improve the code for retrieving the |
It is a janky solution, but I couldn't think of anything for fixing As far as I'm aware this doesn't have any issues with it besides the fact it doesn't solve the actual problem at hand, but I feel like if Stepmania does something similar as nebula said, then it can't be that terrible of a thing to do. There's a point in which a problem becomes too complicated to solve and it's just easier to do a band-aid fix, especially when the only thing it effects is the note rendering. |
I don't think we can do anything about getting a more accurate time for songPosition. We would need to look into openAL or lime.NativeAudioSource lime._internal.backend.native.NativeAudioSource.hx: else
{
// var offset = AL.getSourcei(handle, AL.BYTE_OFFSET);
// var ratio = (offset / dataLength);
// var totalSeconds = samples / parent.buffer.sampleRate;
// var sampleTime = AL.getSourcef(handle, AL.SAMPLE_OFFSET);
// var time = (sampleTime / parent.buffer.sampleRate * 1000) -
// var time = Std.int(totalSeconds * ratio * 1000) - parent.offset;
// var time = Std.int (AL.getSourcef (handle, AL.SEC_OFFSET) * 1000) - parent.offset;
var value = AL.getSourcedvSOFT(handle, AL.SEC_OFFSET_LATENCY_SOFT, 2);
var deviceOffset:Float = value[1];
var realOffset:Float = value[0];
var time:Float = ((realOffset - deviceOffset) * 1000) - parent.offset;
if (time < 0) return 0;
return Std.int(time);
} that is the function for retriving the songPosition. I dont know what getSourcedvSOFT does exactly, the only thing i know is that (atleast for me) the songPosition updates every 10ms, meaning 100fps i'll see if getSourcef is better, but i doubt it Im not sure if OpenAL supports setting the update interval, maybe someone knows that? |
yeah I feel like if it could update faster they would've done it already there could be a solution somewhere but it requires so much digging and learning how all that stuff works, it just doesn't seem worth it |
e0b1b01
to
410cfe9
Compare
I don't think it's janky, it seems pretty clean and simple implementation!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay
e1d6bd8
to
8e57ba1
Compare
just rebased / cleaned up the commit history here to match current |
guys github is so confusing why is there magically 38 commits again |
3330cd3
to
8e57ba1
Compare
you may have pushed your local "changes" which would have been the old commit history with all of the merge commits and whatnot. If you're using command line, you can type (as long as you dont have any local changes you ACTUALLY want to make)
and then your git history on your computer will match the one i very evilly force pushed |
thank you mr muffin |
Don't know how much better you CAN get though, given audio clock n all. Unless flixel adds something similar to Unity's dspTime this is probably the best we're gonna get. The method used here is used in Stepmania and all of it's forks (including highly competitive ones like Etterna) because it simply.. Works. |
tbh this "janky" solution is the only one i can think of, its actually really effective in how it works, and the "proper fix" you are eluding to here isnt really achievable unless if you change the audio system flixel or lime itself. for that i'd argue it isnt really that janky at all and the audio clock stuff we'd have to do otherwise would be infinitely jankier, and it would not fix the note rendering issue at all because the position updating would still be independent to the framerate, and doing any other method would just loop back to doing FlxG.elapsed * 1000 but even more complicated stepmania, openitg, notitg, etterna, project outfox and osu!lazer do it the same way so finding any other method to do so is a fool's errand |
I think an alternative off the top of my own head is to use the |
using I logged
|
@KutikiPlayz one question though, don't we need to apply this: Funkin/source/funkin/Conductor.hx Line 416 in f61789e
to frameSongPos , or am i wrong?
|
see I was thinking about that but the offsets are added directly to |
I’ll test it with |
lemz was right, there's no difference between using |
@ninjamuffin99 was there a reason this stuff was commented out? |
i believe it was an old implementation of sorts, i think when fnf explicitly gets the openfl channel position thing, we added stuff in lime so that what it requests is super accurate i thinky although maybe something brokey allng the way and we still dont actually use it properly lol. i had a PR in lime for it in anycase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything wrong with this. It's a very lightweight change.
Don't think. Just merge |
Don't abandon this |
8e57ba1
to
c4e302a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I managed to gh checkout
this PR into my cloned Funkin
repo on my machine to test the changes.
As a 144Hz player, on both PC and laptop, this is a really welcoming change! Good shit!
They still need to review this internally first, they can't just merge PRs left and right. |
If they were reviewing it internally they would have given it that tag. This one has "needs revision". |
Note positions are updated based on the songPosition, songPosition isn't updated every frame, and thus the notes seem to lag on higher framerates.
What this PR does, is adds a new variable to Conductor called frameSongPosition. It updates based on elapsed, but still syncs with songPosition every time it actually does update.
Essentially doing what this pr did, without the worry of desync.
Here's a vid of Blazin':
balls.mp4
And here's the same vid slowed down to x0.25 speed so people on 60hz monitors can actually see a difference:
balls.slow.mp4