-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Replace frame limiter #2618
base: dev
Are you sure you want to change the base?
Replace frame limiter #2618
Conversation
src/main/java/net/caffeinemc/mods/sodium/mixin/features/render/sync/RenderSystemMixin.java
Outdated
Show resolved
Hide resolved
I've done some tests to observe the behavior of this patch: reference commit before this patch with targets of 80 and 150. It can reach 80, but not 150: this patch with targets 80 an 150: With the patch, it much more accurately holds a frame rate that it can actually produce. However, if it can't produce the frames fast enough, with the patch it will have regularly spaced spikes. I don't know if these spikes are noticeable or impact the experience, but I wanted to point this out. |
One of the things this patch does is that it fully drops a frame if it can't come on time, to ensure that frames always stay perfectly in sync. This should be fine if your FPS limit is a multiple of your monitor's refresh rate, but it might make the game less smooth if you're running a strange FPS limit (for this reason, a patch that would allow the user to set their FPS limit to any value might help). But yeah, it might be worth trying other approaches to synchronization. I also experimented with a version that essentially shifts to unlimited FPS whenever you lag to reduce dropped frames, but it just felt bad to play on IMO, probably because most of those extra frames weren't actually doing anything. |
Fixes #2610 by removing the possibility for long-term desync between the player's FPS cap and their actual framerate.
I'm not 100% sure about the things I mentioned in the comments about GLFW.glfwWaitEventsTimeout and Thread.sleep. I would appreciate some input from anyone who might know more on those subjects.