Capped frame limit for no reason *sigh*

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
pacman
Citizen
Posts: 81
Joined: Thu Mar 14, 2013 4:10 pm

Re: Capped frame limit for no reason *sigh*

Post by pacman »

What did you do?
Are you Jesus?
At first my pc had problem with getting 372FPS. Really unstable and messy.
But it went great after all.
"Let's try run mah game" - works at nice 75FPS
Go back to 125 cap.
BAM it works :|

PRAISE THE SUN!

I will save this .love and run it everytime something goes wrong.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Capped frame limit for no reason *sigh*

Post by zorg »

Evine wrote:Check if this program works on your computer. It uses a "while" loop to delay the frame rate.
Yep, it kills one of my CPU cores :3
Evine wrote:The "love.timer.sleep" function is cursed I tell ya.
It's just imprecise.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Evine
Citizen
Posts: 72
Joined: Wed May 28, 2014 11:46 pm

Re: Capped frame limit for no reason *sigh*

Post by Evine »

pacman wrote:What did you do?
Are you Jesus?
At first my pc had problem with getting 372FPS. Really unstable and messy.
But it went great after all.
"Let's try run mah game" - works at nice 75FPS
Go back to 125 cap.
BAM it works :|

PRAISE THE SUN!

I will save this .love and run it everytime something goes wrong.
The program doesn't actually do anything with your pc. Your love.timer.sleep() function just decided to be accurate again, for some bizarrely strange reason.

Now i made a more precise timer function you can implement into your game. And it doesn't kill a CPU core either. (unless you put the tolerance_constantFPS to 0)

Code: Select all

--Add this line to the start of love.update(dt)
constantFPS(125,0.5) -- FPS , Sleep % from 0(Diabled, max CPU usage) to 1(CPU Sleep 100% of a frame)

--Copy this function to wherever.
function constantFPS(fps_constantFPS,tolerance_constantFPS)
    do
        local fps , tolerance , loopTime , loopDelay = fps_constantFPS , tolerance_constantFPS , loopTime_constantFPS , loopDelay
        if loopTime == nil then loopTime = 0 end
        love.timer.sleep((1/fps)*tolerance)
        local loopTime = loopTime - love.timer.getTime()
        local loopDelay = love.timer.getTime() + loopTime
        while love.timer.getTime() - loopDelay < (1/fps) do end
    end
    loopTime_constantFPS = love.timer.getTime()
end
zorg wrote:
Evine wrote:The "love.timer.sleep" function is cursed I tell ya.
It's just imprecise.
No it's inconsistently imprecise. In layman terms: Cursed
Artal, A .PSD loader: https://github.com/EvineDev/Artal
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Capped frame limit for no reason *sigh*

Post by bartbes »

Evine wrote: No it's inconsistently imprecise. In layman terms: Cursed
If it were "consistently imprecise" it wouldn't be imprecise.
User avatar
pacman
Citizen
Posts: 81
Joined: Thu Mar 14, 2013 4:10 pm

Re: Capped frame limit for no reason *sigh*

Post by pacman »

There's definitely something going on with this one.
Yesterday I had 100FPS problem once again but today it seems fine ; )
I will try your "antidote" to this curse, Evine. Thank you very much :3
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 45 guests