Jerky LimitFPS? (and possible fix)

Previous topic - Next topic

spacefractal

In the Options I set it to 60hz (which the graphics is locked too).

But if I set it to LimitFPS 60 in the code too, then the scroll is being skip a lots of frames, where its should been fluid (which look akward).

But in the other side, if I set it to LimitFPS -1, then its still set to 60fps limit (as I set that in the options), then its does it 100% fluid without framedrops or does that very very rare (all ok).

Also course that take a lots of cpu too (which is not a problem in a game my guess). Its might impact in a mobile phone thought, if I use LimitFPS -1 too?

Even If I set it to LimitFPS 30, its does jerky at time, but its not very noticable at all and complete playable.

So I dedicated to do 65 fps "update()" code (using system timer) and then do a separate "paint()". Something like this:

Code (glbasic) Select

FUNCTION Run:
Delay=update_Delay(65)
run:
IF Delay>0
Controls() // controls only need to been updated once per frame.
FOR i=1 TO Delay
Update()
NEXT
ENDIF

Paint()
CLEARSCREEN -1
SHOWSCREEN
Delay=update_Delay()
IF KEY(1)=1 THEN END
GOTO run
ENDFUNCTION

FUNCTION  update_Delay: displayUpdateFreq=0
STATIC Fps
STATIC Timer#=GETTIMERALL()

IF displayUpdateFreq=0 THEN displayUpdateFreq=Fps
Fps#=displayUpdateFreq
LOCAL frames#, currentTimer#
    LOCAL maxDelay# = 1000 / displayUpdateFreq
    currentTimer#=GETTIMERALL()
    frames=(currentTimer#-Timer#)/maxDelay#
    IF frames<1 THEN RETURN 0
Timer=currentTimer
    RETURN INTEGER(frames)
ENDFUNCTION  // UPDATE_DELAY


So with above code, the  gameplay run 65fps, regaardless what LimitFPS is set to (65fps is set to avoid eventuelly jerky too).

So in that way I did go workaround the LimitFPS issues, but I do not sure what it happens if Vsync is forced disabled (and using LimitFPS -1)? I still want double buffer, even it might draw insanly fast...
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Kitty Hello

Huh!? The settings from the project options do nothing but call LIMITFPS 60.

You can try 61 or 65 if you're out of sync, but that's very strange. What platform are you talking about?

spacefractal

#2
OS: Windows 7, Nvidia graphicscard (VSync locked to 60hz).

I still not sure what it happens, so I still experiment what it does.

I do set the LIMITFPS after the SETSCREEN (but still leave 60hz limit in options, now 120hz), and LimitFPS -1 is still somewhere better than LimitFPS 60 (not sure why???).

PS. LimitFPS 30 does still few framedrops, but nothing impact gameplay at all!
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/