Also with vsync disabled the FPS can't flow between 0 and 100.
This is all handled by the same function:
https://github.com/FAForever/fa/blob/develop/lua/ui/game/gamemain.lua#L253This is the function:
- Code: Select all
function AdjustFrameRate()
if options.vsync == 1 then return end
local video = options.video
local fps = 100
if type(options.primary_adapter) == 'string' then
local data = utils.StringSplit(options.primary_adapter, ',')
local hz = tonumber(data[3])
if hz then
fps = math.max(60, hz)
end
end
ConExecute("SC_FrameTimeClamp " .. (1000 / fps))
end
The fist line checks if we have vsync on or off.
If we have vsync on, then we return and don't execute this function.
So this function will only run with vsync off.
- Code: Select all
if options.vsync == 1 then return end
Then we set a defaul value for the FPS in case we don't find a value inside the gameoptions:
- Code: Select all
local fps = 100
This part gets the value for the FPS from the gameoption:
- Code: Select all
local data = utils.StringSplit(options.primary_adapter, ',')
local hz = tonumber(data[3])
Here we are calculating the minimum FPS for the game.
math.max(60, hz) is using the highest value from 60 or hz.
In this case we set the FPS to the value from the gameoption,
or if hz is lower then 60 we will get 60 as minimum FPS
- Code: Select all
fps = math.max(60, hz)
And the last step, we are setting the waittime between each frame.
If we have 60 FPS then we set as timeclamp 16.66.
That means the game waits 16.7 milliseconds before it will render the next frame.
- Code: Select all
ConExecute("SC_FrameTimeClamp " .. (1000 / fps))
The game only set the FPS between 60 and the value that was set in the video option menu.
That's how the gamecode is handling it.
You can interpret this like you want.
![Wink ;)](images/smilies/icon_e_wink.gif)