Cap frames at 60?

i try to make a speedy game template, out of my iso-jumping example, but when i run around the platforms, the runspeed+run animation considerably slows down.
i have min & max frames at 60

i ran a performance profile while running around the laggy platforms, and the result suggest, i should easily be able to run at 60 fps, no sweat

i did an fps meter test, and my result shows 61


what can be the reason for the slowdown?
is it my lag of a graphic card? old monitor? Something with Gdevelop?

I think browsers cap the fps at the monitors refresh rate, though I am not 100% sure

I’ll try an export to desktop, which won’t run in a Brower(?)
See if the lag stays

Games are in JavaScript, it always run in a browser. Locally, it bundles chrome with the game files.

So no point in exporting then?

the monitor has 60fps refresh rate.

From what I’ve seen, unfortunately you’ll run into weird issues if you have minimum and maximum framerates set to the same number.

I tend to set my minimum FPS to what I want it to be (60 fps) and leave maximum unlocked.

i tried that, but this doesn’t solve the issue of inconsistent speed/frames

it runs pretty evenly, when i set both min and max frames at 30.

sadly, i use the super smooth animations i made with blender, and there wasted on 30fps :frowning:

http://wiki.compilgames.net/doku.php/gdevelop5/events#timedelta
Did you tryed at timedelta expression in your action move position?

i use instant forces to move.

but the animations slow down too, so its not just the matter of the running speed.

Even if the fps meter should be write like : round(1/TimeDelta())
There is a strange number of frame added with your fps meter.
Idk how works the lifecycle of eventsheets, is the first frame of the game is a special frame?

It should be interesting to record the screen at 60fps and look which frame is too much, is it the first frame or the latest.
Maybe I’m totally wrong, I’m just asking why your meter is on 61.

Can you use the 1/TimeDelta() ? TimeDelta is a proper way based on the computed time of events. It more precise.

1/TimeDelta() shows 60

i assume my variante gets the 1 extra frame from the condition “is greater” then 1 second, not equal to 1 second, so it just triggers 1 more time.

E:
sometimes, the number flickers a little above 60
that is, when the speed and animation speed speeds up considerably.

i tried to find out by how much the frames fluctuate, if i set min and max to 60 fps.


the max result is 62.5.
if i dont cap frames at 60 and leave it 0, i got framerates of over 66.
that could explain the speedup.
but why is the animationspeed so much higher, with only about a 4% increase in frames?

For clarification:
It looks like the animation speed is almost doubled/halved

Halved would make sense. Browsers/Electron enforce vsync. If you’re below the screen refresh rate, it halves the framerate until it’s back up to vsync.

Doubling doesn’t make sense to me.

From 30 back to 60 is doubled.
So I have to assume that the Brower jumps down to 30 when the game has to render the platforms.
Seems I can’t do anything about that then?

As far as I know there’s no way to force electron or browsers to disable vsync.

What I don’t get is how it’s long enough to be noticeable. Dropping down to half framerate for 1 frame out of 60 (0.016 seconds), should be barely perceivable.

The switch between fast/slow animations takes several seconds.

Yeah, that doesn’t seem like it’d be related to vsync. I have no idea what that’d be from.

Disable the acceleration hardware in your browser. It wil disable the GPU and webgl renderer, disabled it force to use the CPU and canvas renderer.

Idk how to do in electron but it should be works by exporting you game online or test with preview over wifi.
Atleast for your research tests.

i set the animation speed to 30 frames, set max & min framerate to 30 and reduced running speed to 300px/sec and now it runs consistently.

still sad, i cannot get to work for 60 :frowning: