I need to be able to set what fps my programm will try to stay on, how would i do that?
Cheers
How can i set FPS?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- NoreoAlles
- Party member
- Posts: 107
- Joined: Mon Jan 03, 2022 5:42 pm
How can i set FPS?
"Why do they call it oven when you of in the cold food of out hot eat the food?" - Jon Arbuckle
- BrotSagtMist
- Party member
- Posts: 613
- Joined: Fri Aug 06, 2021 10:30 pm
Re: How can i set FPS?
In a short answer: just put a sleep in every frame. This already exists in the love.run main loop. You should read about that in the wiki, its vital for such task.
In the long answer: Usually you have vsync enabled which syncs your love frame calls with your monitors refresh rate.
You can increase the vsync number in in conf.lua to get a framskip, vsync 2 at a 100hz monitor will result in 50fps for example.
But if you want this to be set freely and accurate you need to turn vsync of, calculate the delta time your program took, and then fill this number up with a sleep.
In the long answer: Usually you have vsync enabled which syncs your love frame calls with your monitors refresh rate.
You can increase the vsync number in in conf.lua to get a framskip, vsync 2 at a 100hz monitor will result in 50fps for example.
But if you want this to be set freely and accurate you need to turn vsync of, calculate the delta time your program took, and then fill this number up with a sleep.
obey
- zorg
- Party member
- Posts: 3444
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: How can i set FPS?
alternatively, and this might be the more sane thing to do:
separate rendering (frame) rate from logic (tick) rate, keep framerate synced to vsync, and simply just edit a value that you restrict the logic to.
Here's a link to where you can read more on this: https://gafferongames.com/post/fix_your_timestep/
separate rendering (frame) rate from logic (tick) rate, keep framerate synced to vsync, and simply just edit a value that you restrict the logic to.
Here's a link to where you can read more on this: https://gafferongames.com/post/fix_your_timestep/
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Who is online
Users browsing this forum: No registered users and 211 guests