Page 1 of 1

Weird issue with framerate

Posted: Sat Feb 10, 2018 10:39 pm
by guillotinesmirk
I've written a gravity simulator, and it's been capped at 30 fps. I disabled t.window.vsync, which didn't help me, and then I read a forum page here on love.run, which gave some sample code which used love.run to run at 60 fps. I tried adding that in, and it fixed my problem for a little while, but the frame rate capped again, and now the sample code also runs at 30 fps. I hadn't modified the code in any way when that happened. Does anyone know what's happening? I'm running it on an MSI, if that helps any.

Here's my code:
GRAVITY.love
(2.46 KiB) Downloaded 132 times

Re: Weird issue with framerate

Posted: Sat Feb 10, 2018 11:48 pm
by pgimeno
I'm getting ~1300 FPS. My guess is that your graphics card (or possibly the driver) doesn't honour the vsync bit, and that it's too slow to render every frame in 1/60s, hence it skips every other frame.

Re: Weird issue with framerate

Posted: Sun Feb 11, 2018 12:00 am
by raidho36
Yep. Writing games is easy. Writing games that run at high framerate on your target hardware is hard.

*cough*ps4tetris*cough*

Re: Weird issue with framerate

Posted: Sun Feb 11, 2018 12:02 am
by drunken_munki
0 bodies: 6700 fps
50 bodies: 1200 fps
100 bodies: 380 fps

Running as is.

Maybe check your driver settings, sometimes they can enforce an FPS cap or force vysnc or something.

Re: Weird issue with framerate

Posted: Sun Feb 11, 2018 12:34 am
by guillotinesmirk
Yeah, I looked up info about my computer, and it looks like it's something to do with power saver mode. I'm getting 900 fps when it's plugged in, and 30 fps when it's on battery. Thank you all for verifying it's not my code.