Framerate Inconsistencies
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Framerate Inconsistencies
When I run my game (still in development) I get massive framerate inconsistencies. One hour it will reach 800fps, then the other hour it will be between 80 and 100. Sometimes up to around 300. This obviously slows down the game big time when it's at a lower frame rate. My questions are why is this happening and is there anyway I have it stay at a given frame rate?
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Framerate Inconsistencies
Does the same happen with all the games, or just with yours? If it happens with all the games, it might be a problem in your computer. If it happens just with your game, then there might be a problem in your code. The easiest way for us to know what happens would be for you to upload a .love file so we could give it a look.
When I write def I mean function.
Re: Framerate Inconsistencies
Really anything above 60 fps should be more than enough. You shouldn't see any game slowdown. Are you sure you're using dt when updating your game? Regarding your problem I would assume it's due to other processes running in parallel at the same time.
Re: Framerate Inconsistencies
I'm not sure what .love file you would need to check out the project. I put it on github, though
https://github.com/crizilla/love2dshooter
This is the only game I have worked on or run with love. I can check if another game somebody else made has the same issues later when I get home. Games I download from Steam seem to run fine. Yes, I am passing dt through the update function.
https://github.com/crizilla/love2dshooter
This is the only game I have worked on or run with love. I can check if another game somebody else made has the same issues later when I get home. Games I download from Steam seem to run fine. Yes, I am passing dt through the update function.
Re: Framerate Inconsistencies
It might be the "love.timer.sleep" function that is messing with you.
Try adding.
Try adding.
Code: Select all
function love.timer.sleep() end -- This will undo any calls to it and max out one of your cpu cores.
Artal, A .PSD loader: https://github.com/EvineDev/Artal
Re: Framerate Inconsistencies
So far so good. ThanksEvine wrote:It might be the "love.timer.sleep" function that is messing with you.
Try adding.Code: Select all
function love.timer.sleep() end -- This will undo any calls to it and max out one of your cpu cores.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Framerate Inconsistencies
I misunderstood your question. I assumed you were already seeing a big drop in performance in slow parts of your code.
If you aren't, then you should not preemptibly do any "fixes". The "performance drops" you see when do almost nothing in your game won't scale once you actually do stuff in it.
Don't worry about performance so early in the game: Make it work, make it pretty, and then make it fast.
If you aren't, then you should not preemptibly do any "fixes". The "performance drops" you see when do almost nothing in your game won't scale once you actually do stuff in it.
Do not do that. LÖVE makes a call to love.timer.sleep on every frame so that the processor can be used by others - including the operating system. Removing it will "lock" it to your game. This has several bad consequences. Here are some I know:It might be the "love.timer.sleep" function that is messing with you.
- It is considered "bad behavior". Some operative systems might decide that your game has frozen and must be terminated
- It will generate more heat than necessary - the CPU fans will start going up like crazy
- If you ever export your game to a mobile, it will eat up the battery very rapidly
Don't worry about performance so early in the game: Make it work, make it pretty, and then make it fast.
When I write def I mean function.
Re: Framerate Inconsistencies
Have you checked if it's the garbage collector?
Try turning off the garbage collector and see if the frame rates stabilize. How? Put in your love.init. Of course you can't "ship" the game like this but it may help to diagnose the problem.
Try turning off the garbage collector and see if the frame rates stabilize. How? Put
Code: Select all
collectgarbage("stop")
Who is online
Users browsing this forum: Bing [Bot] and 1 guest