Hey guys!
I just started working with love today but I have been struggling with this little FPS issue for a few hours. I know there are a lot of threads about FPS problems on this forum, but I couldn't find a solution after trying many of them. When I run the game, it is smooth as butter for about 10 seconds. After that, it will start to lag. It will not lag outrageously but it is definitely noticeable.
I draw the FPS on the screen of the game and it stays at 60 throughout since I limit it in love.update(). I also checked the cpu usage in Task Manager; it uses 2% of my cpu and about 34 MB of ram. I also checked garbage collection. I put the line collectgarbage("stop") in love.load() and it did not fix the issue.
I will attach my .love file to this post. It is not too complicated. If any of you have any guidance or ideas, please don't hesitate to let me know!
controls
a -> counterclockwise rotation
d -> clockwise rotation
Thanks,
Aaron
FPS issue with simple box2D game
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: FPS issue with simple box2D game
Good job on using a fixed time step.
First of all, getFPS is the number of frames that are drawn per second.
The hard-coded "physics interval" has nothing to do with drawing on the screen so your FPS will max out at 60 due to vsync.
To check your physics frame rate, you can use: physicsFrameRate = 1/(interval*steps)
I ran a profiler on your code and it didn't show any glaring bottlenecks.
The game runs fine so the lag may be caused by some other software on your machine.
It probably doesn't matter in this case, since love2d seems to control the garbage collection internally.
Good luck.
First of all, getFPS is the number of frames that are drawn per second.
The hard-coded "physics interval" has nothing to do with drawing on the screen so your FPS will max out at 60 due to vsync.
To check your physics frame rate, you can use: physicsFrameRate = 1/(interval*steps)
I ran a profiler on your code and it didn't show any glaring bottlenecks.
The game runs fine so the lag may be caused by some other software on your machine.
Generally, I don't recommend turning off the GC in Lua.collectgarbage("stop") in love.load() and it did not fix the issue.
It probably doesn't matter in this case, since love2d seems to control the garbage collection internally.
Good luck.
Re: FPS issue with simple box2D game
LÖVE does manual memory management internally, but once it's out in the Lua it's up to GC to handle it.
Who is online
Users browsing this forum: Google [Bot] and 4 guests