• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows [Solved] Game not running at 60 FPS when Real FPS would suggest otherwise

P

pieterator

Guest
The game is set to run at 60 fps, but for some reason it runs at a rock solid 45 fps on my laptop (Windows 10). This is also not the only laptop with Windows 10 that is giving this issue. On my Windows 7 PC it runs perfectly.

The laptop should be more than powerful enough to run it at 60 fps, and even the real fps shows that it should be running much faster than 45 fps. It's set to use the GPU by default.
Lenovo Ideapad Y700
i7
Geforce GTX 960M
16 GB Ram

This has only recently become an issue, and a few months ago it was running fine.

Has anyone run into this problem as well, or can someone suggest some common fixes for this problem.

 
Yeah I've come across this a lot on my laptop. Its just locked at 45 fps, yet can play Skyrim on max settings at 60 fps. Some tablets are just locked at 30 or 60. Weird thing is some days I can get 60 fps... but once it drops to 45 it never returns to 60. Makes me wonder how the players cope. They'll just assume the game is poorly optimized and get a refund.

I posted the same question a few months ago.

For me it wasn't the sleep margin. It was always set to 1.
 
Last edited:
P

pieterator

Guest
@JackTurbo The sleep margin was set to 1 instead of the default of 10. Setting it back to 10 fixed the issue and it's now running at 60 fps again.

Thanks @JackTurbo you're a super star! :D
 

DukeSoft

Member
Yeah I've come across this a lot on my laptop. Its just locked at 45 fps, yet can play Skyrim on max settings at 60 fps. Some tablets are just locked at 30 or 60. Weird thing is some days I can get 60 fps... but once it drops to 45 it never returns to 60. Makes me wonder how the players cope. They'll just assume the game is poorly optimized and get a refund.

I posted the same question a few months ago.

For me it wasn't the sleep margin. It was always set to 1.
Try to disable vsync :)
 
For me it wasn't the sleep margin. It was always set to 1.
Did you try setting it *higher,* though? It should be set at 10 or even 15 for a lot of devices, apparently. YoYo has explained why, but I forget exactly what it is. Something about your computer getting lazy if you stop harrassing it constantly. Higher sleep margin keeps your pc from taking a break, apparently. Iirc, default for older versions of GM was always 10 or 15.
 
T

The Sentient

Guest
Did you try setting it higher, though? It should be set at 10 or even 15 for a lot of devices, apparently. YoYo has explained why, but I forget exactly what it is. Something about your computer getting lazy if you stop harrassing it constantly. Higher sleep margin keeps your pc from taking a break, apparently. Iirc, default for older versions of GM was always 10 or 15.
Bloody sleep margin.

This seems to be the source of a good percentage of framerate woes on this site.
 
^Yep. I don't know why they changed the default from 10 to 1 when it apparently breaks your game on 70% of the machines out there. I'm all for leaving the option there for power users who know how it works and how to use it, but I don't know what they were thinking changing the default. It's causes headaches for a *lot* of people, haha.
 
I know this issue was "solved" but I'd just like to chime in for anyone who comes across this topic in the future. Firstly, the sleep margin should never be a "solution" to performance issues. You have to know that when you're messing with the sleep margin, you're making your game run *slightly* faster and, in exchange, your application will utilize significantly more of the CPU. It's a trade-off, and it's not just some magical number that you can simply increase to solve performance problems. I see this suggested way too often when people complain about performance in their games, and it really irritates me. I've never had a problem with my sleep margin being set to 1 and running my games at a consistent, stable 60 FPS.

As far as the actual problem in the first place, the reason that your "fps_real" value is higher than your actual FPS is because "fps_real" is based off the number of CPU cycles that your application is capable of running at. It has nothing to do with your actual "fps" value, which is the number of frames that the game is running at.
Can you explain what the sleep margin is for and how/when to use it for us?
 
The sleep margin is default at 10 (at least in some versions), and most of the time you should leave it at that. The sleep margin will not significantly impact performance unless it's less than ~5, and even then the performance difference is negligible. Anything past 10 is severe overkill and your application will end up using a ton of the CPU. An empty room with no objects and a sleep margin of 30 will use about 30% of my CPU. Now, imagine if I was actually doing something? The CPU usage would be insane. What I was saying is, I keep seeing people suggest increasing the sleep margin (even when it's at 10) whenever people run into performance issues, when really they should be profiling their game to find out what the problem is. I swear we're gonna be seeing a load of ****ty games on GameJolt that constantly use 60% of the CPU because the developers don't understand the side-effects of increasing the sleep margin.

Edit: Also just noticed OP's specs, which just proves my point even more. I have that same laptop, and a game like that should NOT be getting 44 FPS. This is 100% an issue in the game slowing it down.
Nobody here suggested setting it to 30, though. I've never seen such a high number recommended on these forums even once. People suggested ten, which is *not* always the default, as far as I know, even though it probably should be, from everything I've heard.

Your original spiel feels like it came out of left field, is all. You admit now that the default for most versions is 10, and that anything less than 5 can cause performance issues, but you didn't say anything like that in your original post railing against changing the sleep margin to fix performance. Which comes off as weird to me, because the OP's problem was solved by setting it to the reasonable default of 10.

Anyway! Glad to hear your opinion on it.

And if I'm releasing a game, I'd rather have it use a bit more CPU and run smoothly... no normal user is going to notice or complain that your game is using their cpu. They *will* complain when your game gets choppy in random areas.
 

Smiechu

Member
The sleep margin is default at 10 (at least in some versions), and most of the time you should leave it at that. The sleep margin will not significantly impact performance unless it's less than ~5, and even then the performance difference is negligible. Anything past 10 is severe overkill and your application will end up using a ton of the CPU. An empty room with no objects and a sleep margin of 30 will use about 30% of my CPU. Now, imagine if I was actually doing something? The CPU usage would be insane. What I was saying is, I keep seeing people suggest increasing the sleep margin (even when it's at 10) whenever people run into performance issues, when really they should be profiling their game to find out what the problem is. I swear we're gonna be seeing a load of ****ty games on GameJolt that constantly use 60% of the CPU because the developers don't understand the side-effects of increasing the sleep margin.

Edit: Also just noticed OP's specs, which just proves my point even more. I have that same laptop, and a game like that should NOT be getting 44 FPS. This is 100% an issue in the game slowing it down.
I have slip margin 30 by 60FPS (so there is no "slleep" between frames) ... and my CPU usage is around 2%... so what you say is a big bull$%^t...
Read the topic where one of the YYG crew explained how works and what for the sleep margin is...
Essentially... setting a big margin simply keeps the CPU on a more "aware" state, but it doesn't mean that between the frames the CPU is doing any extreme hard calculations... What he is supposed to do anyway?? Dig bit coins in this time or what??
Yes the energy efficiency is lower, but not in so extreme way as you say...
The problem of GMS performance is in most cases the graphic pipeline, nothing more...
Second thing GMS2 is not a multi-threading engine, so in worst case it can only use full power of one of the CPU threads... noways even handy's have 8 thread CPU's so maximum what GMS is capable to use 1/8 of CPU's max power...

Edit:
Sorry actually the load is 0,2% and the CPU is in down-clocked energy efficient state...

One important question... does you computer have a dedicated graphic card, or have you only integrated Intel Graphics?? In this case, the load comes from the graphic pipeline, and according to what YYG crew said, the graphic pipeline is not effected by sleep margin...
 
Last edited:

Smiechu

Member
I thought sleep margin is in ms so anything over 16 won't do a great deal for a 60fps game?
Yes, you're right, I have now the sleep margin set to 15 by 60fps... 30 is max value for 30fps... either way, the point is that high sleep margin isn't any way something destructive especially for desktop/laptop games. I would only be careful by mobile games...
 
T

The Sentient

Guest
Sleep margin is the weirdest thing I have come across in GM. You don't see it in any other engine.

To me, the whole thing seems like a hack in an effort to conserve battery life.

If your fps_real is well above room speed, there is absolutely no excuse for FPS to ever drop below room_speed.

It is purely a hack to force the CPU to sleep, keeping power usage down.

How many people run Windows based games while not being connected to a power source? Personally, I couldn't care less if a game was drawing 400 Watts from the wall.

Anyone who plays Crysis on their laptop, on battery, knows full well their laptop isn't going to last long.
 
Sleep margin is the weirdest thing I have come across in GM. You don't see it in any other engine.

To me, the whole thing seems like a hack in an effort to conserve battery life.

If your fps_real is well above room speed, there is absolutely no excuse for FPS to ever drop below room_speed.

It is purely a hack to force the CPU to sleep, keeping power usage down.

How many people run Windows based games while not being connected to a power source? Personally, I couldn't care less if a game was drawing 400 Watts from the wall.

Anyone who plays Crysis on their laptop, on battery, knows full well their laptop isn't going to last long.
I think they exposed the setting for mobile games. Mike himself said he sets it to 10 or 15 for Windows games, CPU usage be damned. Because like you said, who's actually going to give a 💩💩💩💩 that the game they're playing is using their cpu?
 
T

The Sentient

Guest
I think they exposed the setting for mobile games. Mike himself said he sets it to 10 or 15 for Windows games, CPU usage be damned. Because like you said, who's actually going to give a **** that the game they're playing is using their cpu?
Exactly.

Didn't realize it was made available for mobile games. Which is fair enough. I agree with the ability to adjust power consumption on mobile.

But for desktop, console, etc.. It causes more troubles than it is worth. (Just have to look at every second thread to see that)
 

Smiechu

Member
Dogarooski said:
I set the sleep margin to 30 and it used about 30% of my CPU on an empty room with zero objects. I performed this test 5 seconds before the post.
I've asked you, if you have a dedicated graphic card or you use an integrated one?

Please everyone remember that the graphic engine uses the GPU... but fps real only shows the load of CPU... that's why this inconsistencies occure...

If someone has only integrated graphics than the CPU is loaded by graphic operations...

**********************************

MOD EDIT: Some of the discussion after this point was broken into a new topic to prevent derailment of this one.
 
T

The Sentient

Guest
If someone has only integrated graphics than the CPU is loaded by graphic operations...
Even main boards that have onboard graphics, have a dedicated graphics chip. Generally much slower than a dedicated graphics card, but the CPU does not handle the graphics operations.
 

Smiechu

Member
Even main boards that have onboard graphics, have a dedicated graphics chip. Generally much slower than a dedicated graphics card, but the CPU does not handle the graphics operations.
No... at least with Intel HD graphics (today it's the most common case)... on the mainborad there is only an "interface", graphic operations are done by CPU and use system memory...
Read a little bit about problems of users with Intel HD graphics laptops... especially with lower end processors...
 
P

pieterator

Guest
@Dogarooski You're absolutely right, my game isn't optimized at this point, and I know the main culprit is the shattered glass effect I use to transition between stages. It accounts for about 80 of the CPU load as it does hundreds of thousands of calculations per frame to calculate vertex positions. This is all stuff I want to move to the shader and have it do the number crunching, but because we're so close to launching our demo (and it has to be now because our incubation period has finished) I was looking for the quickest fix to get it running smoothly so we can start getting player feedback about the game. It's also so we can show it to potential publishers in order to secure funding for completing the game.

In the next couple of months, optimizing is going to be my number one priority, because my graphics pipeline is an absolute mess. But it's the best I could do, with the time I had, and done is better than perfect :D
 

Mike

nobody important
GMC Elder
Sleep margin has now been 10 as default (desktop) for NEW projects for a while on GMS2. (means your CPU might be a little high when playing a game.... but hell.. you're playing a game!)

It was brought in to extend battery life on mobile devices. On a phone, if you run full tilt, the device can get quite hot and drain the battery pretty quickly, even for a game that's pretty light. This allows users adjust these settings. No idea why it was ever dropped to 1 on desktop though. It was put back up a while back. Android default value is now 4....

Should be noted of course, on windows you could also be playing on a Laptop, and this still has come value there......
 
Top