Option to lock framerate?
Moderator: GZDoom Developers
Option to lock framerate?
(G)ZDoom runs at a ridiculous speed (~100-300fps) on most machines today, but because users cognitively perceive changes in framerate way more than actual measured framerate, there's still a fairly noticeable perception of lag as you go in and out of large areas and fights. It would be nice to have an option to lock the framerate, at either fixed values (30fps, 60fps) or at an arbitrarily chosen value. Lots of modern game engines do this, and it really helps the game feel more solid. Doom's action is so fast I can only assume it would benefit way more from this than the latest Call of Duty.
Re: Option to lock framerate?
Open the console, type vid_vsync 1
Re: Option to lock framerate?
I tried that console command, and it doesn't appear to do anything - the framerate reported with vid_fps set to 1 goes up and down exactly as it does when vid_vsync is 0.
I poked around in the source code, src/v_video.cpp specifically, and while I'm not very familiar with the codebase, it looks like the vid_vsync and vid_refreshrate cvars don't actually end up changing anything in the DFrameBuffer class.
Besides this, vertical sync (vsync) and framerate lock aren't always the same thing - some engines just happen to tie them together in implementation. Vertical sync means that the game waits until a frame has been completely drawn to screen before starting to draw the next frame. Framerate lock means that the game waits with precise timing as needed to draw frames at a consistent rate over time. In some engines, vsync means that the framerate is locked to the refresh rate of the monitor. ZDoom doesn't appear to do any of those.
I could be wrong about all this, like I said I'm not familiar with ZDoom's internals. But as far as I can observe with the FPS reporting, what I requested above doesn't currently exist.
I poked around in the source code, src/v_video.cpp specifically, and while I'm not very familiar with the codebase, it looks like the vid_vsync and vid_refreshrate cvars don't actually end up changing anything in the DFrameBuffer class.
Besides this, vertical sync (vsync) and framerate lock aren't always the same thing - some engines just happen to tie them together in implementation. Vertical sync means that the game waits until a frame has been completely drawn to screen before starting to draw the next frame. Framerate lock means that the game waits with precise timing as needed to draw frames at a consistent rate over time. In some engines, vsync means that the framerate is locked to the refresh rate of the monitor. ZDoom doesn't appear to do any of those.
I could be wrong about all this, like I said I'm not familiar with ZDoom's internals. But as far as I can observe with the FPS reporting, what I requested above doesn't currently exist.
- Xtyfe
- Posts: 1490
- Joined: Fri Dec 14, 2007 6:29 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
Re: Option to lock framerate?
Disregarding what you said about how zdoom handles this, are you forcing vsync off in your video drivers? This would pretty much make any such setting by a program not do anything either.
-
-
- Posts: 3203
- Joined: Wed Nov 24, 2004 12:59 pm
- Graphics Processor: ATI/AMD with Vulkan/Metal Support
- Contact:
Re: Option to lock framerate?
vid_vsync should lock it to the refresh rate (after all that's what vsync is). If you're running Mac or Linux it's not implemented on Linux for the software renderer. There is cl_capfps though which will lock the framerate to the game simulation rate (35fps).
Re: Option to lock framerate?
Ahh, sure enough "Sync to VBlank" was turned off (which I think is the default) in my nvidia-settings control panel. Turning it on I see that the framerate in ZDoom is now locked at 60fps. Thanks folks.