feat(client/graphics): add FPS limit convar - #4016
Conversation
|
Can you not use a uint8_t instead of an int so then you don't have to use the checks? Also iirc there's constraints you can put on convars so you don't have to do any clamping |
I agree with using unsigned and I'll check out the constraints 👍 However I think uint16_t might be better cause some people might actually want 255+ fps. |
|
Would be huge to get this in for racing servers! |
|
@AvarianKnight gameFpsLimit.GetHelper()->SetConstraints(0, 1000);But this would also mean values below 30 are possible, I don't think this is good as this could brick the game for some people so we can't really get around that clamp IMO. |
Why would you set it to |
|
So you can still reset it by using 0 |
Ahh, yea then there is no way getting around that. |
Goal of this PR
Adds a native client-side FPS limit convar for FiveM.
This allows users to cap their game FPS without relying on external driver/game overlay limiters.
Use case: Some racing servers tell users to cap their FPS so it can still be a competetive environment (Higher FPS usually means more vehicle speed).
Having a simple console command is easier than telling users to change NVIDIA settings for example.
How is this PR achieving the goal
Adds the archived
game_fpsLimitconvar, defaulting to0/ disabled.When set to a positive value, the DirectX present path uses the existing frame-time limiter to wait until the configured frame interval has elapsed before presenting the next frame.
Values are clamped to a sane range to avoid accidentally setting unusably low or excessively high limits.
This PR applies to the following area(s)
FiveM, Client, Graphics
Successfully tested on
Game builds: bXXXX
Platforms: Windows
Checklist
Fixes issues
PS: Thanks to Gogsi for the hint