-
Notifications
You must be signed in to change notification settings - Fork 815
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
Improve frame synchronization #2610
Comments
That's curious. Since you appear to have figured this out already, we would not be opposed to a pull request to address this problem. Maybe we can also look into further improvements since the original Minecraft code seems rather naive. |
Alright. I found some places where I can improve it (and fixed the issue of getting the wrong FPS value after tabbing in), so I'll try to make a PR soon. |
If I understand correctly, this bug is quite useful for me. My laptop supports a screen refresh rate of up to 144 Hz, but in Minecraft I can only use a 150 FPS limit to make the game smooth. Due to this effect, I get ≈144 FPS on average. |
I think that just means some mod needs to allow the user to input any FPS value instead, lol. |
Yeah, so true. Just hope that one day modern screen formats support in Minecraft will be better. |
Request Description
The function RenderSystem.limitDisplayFPS() in vanilla Minecraft currently looks something like this:
However, this is a flawed implementation. For example, if you set 240FPS as your cap, it will result in an actual frame limit of around ~235FPS, due to the fact that glfwWaitEventsTimeout() and glfwGetTime() do not return instantly, resulting in the
now
timestamp differing from thetarget
timestamp by enough to cause significant desync.The solution is simply to replace the line
lastDrawTime = now;
withlastDrawTime = target;
, which results in a smoother experience when using capped FPS. However, this leads to an incorrect frame limit for the first few seconds after joining a server or tabbing into the game, so some more work may be needed.The text was updated successfully, but these errors were encountered: