How do I reduce render latency

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Der_tolle_Dude

I am currently making a small FPS game. Today while I was playing Star Wars Battlefront II I noticed that it feels way more responsive than my own shooter. The Nvidia performance overlay showed me a render latency of around 27ms in Battlefront and around 50ms in my own game. So my question is how to reduce the render latency to make my game feel more responsive?

Kudos to you for not using the blanket word “lag” to describe your rendering problem :wink:

Have you looked at the articles on optimization in the documentation?

Ertain | 2022-07-17 23:53

:bust_in_silhouette: Reply From: Calinou

In your project:

  • Disable V-Sync in the Project Settings (search for vsync).
  • Ensure FPS is not capped in any way by Godot or an external program. By default, framerate is uncapped in Godot, but V-Sync will cap the framerate to your monitor’s refresh rate.
  • Run with fullscreen enabled (not a borderless window, not windowed mode). Windows will bypass compositing when running a game in exclusive fullscreen, leading to decreased input lag.

On the system:

  • Set Low Latency Mode to Ultra in the NVIDIA Control Panel, or enable Radeon Anti-Lag on AMD (both are only available on Windows).
    • This reduces overall latency by ensuring the GPU is never fully utilized (therefore avoiding bottlenecks). Note that this can decrease framerate slightly. Microstuttering may also become more noticeable.
    • On any GPU and OS, a similar effect can be obtained by capping framerate to a slightly lower value than what your GPU can sustain in all scenes in your game. You’ll want to expose a way to set Engine.target_fps to the player for this purpose.
  • Force the maximum GPU performance profile (at the cost of increased power consumption). On Linux, gamemode can be set up to do this.

Is there no other way than disabling V-Sync? I play other games with V-Sync enabled too because of the screen tearing and they all run at a lower latency than my game.

Der_tolle_Dude | 2022-07-22 16:44

If you want low latency and no tearing, you have to enable V-Sync, use a variable refresh rate monitor (G-Sync/FreeSync) and cap the maximum FPS to a value slightly lower than the monitor’s maximum refresh rate. See this page for more information. No V-Sync and no VRR will always give you the lowest latency, but optimized VRR can get you fairly close on some monitors.

I have a pull request adding documentation about reducing input lag: Improve Fixing jitter and stutter documentation by Calinou · Pull Request #6186 · godotengine/godot-docs · GitHub

Calinou | 2022-10-14 00:23