How to fix fps?
Re: How to fix fps?
I would prefer play 2h without jittering than 5h with missing frames etc. The sleep method is to much unpredictable in my opinion for differents platforms. Of course it's depend on target group. For simple, mobile games as You said a long battery life is important, but for more complex games more important is stability in my opinion
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: How to fix fps?
This is a hardware/wetware problem. And Sleep is just a workaround to this. An unpredictable workaround.hendu wrote:Not only do you shorten my play time from 5h to 2h (for example), you're also frying my balls unnecessarily
"Whoops..."
Re: How to fix fps?
Let's assume it was better for complex games to eat cpu without consideration. Then why is no big-name game like that? They all sleep to conserve cpu instead of wasting as much as they can.
When they don't, it's a bug: IIRC it was a blizzard game where there was no sleep in the main menu, even though there was one in-game. The main menu caused some graphics cards to burn out, Nvidias IIRC.
When they don't, it's a bug: IIRC it was a blizzard game where there was no sleep in the main menu, even though there was one in-game. The main menu caused some graphics cards to burn out, Nvidias IIRC.
Re: How to fix fps?
For that matter, VSync does the same, it synchronizes with the refresh of the screen, so, it removes the flicker also. And you don't really have to do anything to keep things going at 60 fps because the VSync will force it for you.
what i have found, not obstant, and it is an odd or at least, unexpected behavior, is that when the scene becomes too complex, the screen like stutters, Fraps or even the FPS counter method will report me that it runs for instance at 100 or 95 FPS, but the screen will look like it is going at 30 or 40 or the like, but when the VSync is on, and everything runs at 60 FPS fixed, all goes smooth. Any explanation?
I guess this can be related somehow to the original question of the thread because, although it is a diferent scenario, the solutions may apply. Any idea?
what i have found, not obstant, and it is an odd or at least, unexpected behavior, is that when the scene becomes too complex, the screen like stutters, Fraps or even the FPS counter method will report me that it runs for instance at 100 or 95 FPS, but the screen will look like it is going at 30 or 40 or the like, but when the VSync is on, and everything runs at 60 FPS fixed, all goes smooth. Any explanation?
I guess this can be related somehow to the original question of the thread because, although it is a diferent scenario, the solutions may apply. Any idea?
Last edited by Mel on Sun Jul 08, 2012 4:22 pm, edited 1 time in total.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: How to fix fps?
Vsync only works when fullscreen. But yes, when fullscreen it's essentially the same.
(I really don't get the sleep hate. Does Windows suck that bad, ie when you tell it to sleep 6ms and the system is otherwise idle it still sleeps 500ms, skipping frames?)
(I really don't get the sleep hate. Does Windows suck that bad, ie when you tell it to sleep 6ms and the system is otherwise idle it still sleeps 500ms, skipping frames?)
Re: How to fix fps?
Yep, for the menu this method is ok, because unstable (in some cases may be very unstable) frame time isn't too problematic here, but in-game situation is different.
I don't think so that AAA games use a sleep method in a game loop (exclude menu, inventory, pause, dialogs etc. so everywhere where a screen is mostly a static, because here this method will be acceptable). As I remember I didn't see a sleep method in a DOOM 3 source code when I looked to a game loop in this game.
As Mel said, the best solution for a save hardware power. is to use Vsync and this is the most popular method for it.
UPDATE:
Yes, many frames are skipped because of it (a screen is like a freezed for a short time) What about a Vsync which doesn't work without a fullscreen? I think that on current environments (like an Unity, KDE, Gnome 3 etc.) playing is uncomfortable without a fullscreen, so today, a game = fullscreen for me And I think that many gamers thinking similar.
@Mel
I think that these stutters is a normal behaviour when we don't use a VSync. I saw it in many AAA games (eg. Company of Heroes), mostly in RTS when we move a camera over a world. In a FPS games this isn't visible. I tried a fixed time step etc. for it, but it didn't help too much, mainly because of a GPU works asynchronously I think. But if someone have a solution for this (another than a VSync) issue I will be thankful for it too.
I don't think so that AAA games use a sleep method in a game loop (exclude menu, inventory, pause, dialogs etc. so everywhere where a screen is mostly a static, because here this method will be acceptable). As I remember I didn't see a sleep method in a DOOM 3 source code when I looked to a game loop in this game.
As Mel said, the best solution for a save hardware power. is to use Vsync and this is the most popular method for it.
UPDATE:
Yes, many frames are skipped because of it (a screen is like a freezed for a short time) What about a Vsync which doesn't work without a fullscreen? I think that on current environments (like an Unity, KDE, Gnome 3 etc.) playing is uncomfortable without a fullscreen, so today, a game = fullscreen for me And I think that many gamers thinking similar.
@Mel
I think that these stutters is a normal behaviour when we don't use a VSync. I saw it in many AAA games (eg. Company of Heroes), mostly in RTS when we move a camera over a world. In a FPS games this isn't visible. I tried a fixed time step etc. for it, but it didn't help too much, mainly because of a GPU works asynchronously I think. But if someone have a solution for this (another than a VSync) issue I will be thankful for it too.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Re: How to fix fps?
I limit the fps in my game to 60 at the moment when it's running in windowed mode but without using the sleep method. If another window is focused I use the sleep method to hold the CPU usage very low but still have around 60 fps. I don't know whether the solution is good but works for me.
Re: How to fix fps?
@Sir_Hans
How did you do that? Honestly, I thought the same way that other people said, "using sleep() with each framerate"... But I also think this method is not very efficient.
Anyway, thank you all for your answers! I will consider all of your advice
How did you do that? Honestly, I thought the same way that other people said, "using sleep() with each framerate"... But I also think this method is not very efficient.
Anyway, thank you all for your answers! I will consider all of your advice
From Seoul, South Korea
Re: How to fix fps?
interesting
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**
Re: How to fix fps?
Note about sleep and yield in Irrlicht. Basically sleep() on Window is really a bad idea for games as it always is around 15ms minimum. So one call and you limit your game to ~65 FPS which people with 144hz screens these days won't like. Yield in Irrlicht 1.8 was just as bad as it used sleep(1) so it had the same problem (reason for that was some Windows 98 behavior...). It got rewritten in Irrlicht svn trunk recently to use sleep(0) which on modern Windows just gives up the thread and doesn't sleep. That in combination with checking time in a loop could be used in theory to get a more exact sleep call which is still friendly to CPU.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: How to fix fps?
Thanks for the information Lord CutealienCuteAlien wrote: ↑Mon Mar 11, 2024 10:57 am Note about sleep and yield in Irrlicht. Basically sleep() on Window is really a bad idea for games as it always is around 15ms minimum. So one call and you limit your game to ~65 FPS which people with 144hz screens these days won't like. Yield in Irrlicht 1.8 was just as bad as it used sleep(1) so it had the same problem (reason for that was some Windows 98 behavior...). It got rewritten in Irrlicht svn trunk recently to use sleep(0) which on modern Windows just gives up the thread and doesn't sleep. That in combination with checking time in a loop could be used in theory to get a more exact sleep call which is still friendly to CPU.
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free. CC0 man.
**