• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • 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.

Mac OSX High CPU load when running a project (YoYo Runner) on Mac

Q

Questalot

Guest
Hey everyone!

I'm using a MacBook Pro 16 inch with the latest GameMaker Studio 2 version. When I run a project (empty or otherwise), my CPU load goes over 90%--which increases my laptop's temperature, eats its battery, and creates overall an unpleasant experience. I searched online--found some similar posts from 2017, and apparently a similar issue has been fixed back then. I tried to set through code the room_speed to 60, and enabled vsync to cap the frames. Sometimes I get around 30-40%, most of the times I still get 96-97% CPU load.

I Debug mode I see 11-12.000 fps. To me, it looks like I'm running a seriously demanding game which obviously is not the case.

Is it something I can try? Is it a bug? Any help would be greatly appreciated. Thanks!
 

LunaticEdit

Member
Can you check activity monitor and see if you have a few runaway mono processes chewing up ~100% CPU? I see this regularly and at this point make a habit of killing them whenever I see my temps going up. Those processes will even keep running after GMS2 is closed!
 
Q

Questalot

Guest
Thanks for your reply @LunaticEdit, I appreciate it. I'm only seeing one mono-sgen64 eating up at 0.0% CPU. YoYo Runner is, however, eating up around 96-97% CPU.
 

TsukaYuriko

☄️
Forum Staff
Moderator
I Debug mode I see 11-12.000 fps. To me, it looks like I'm running a seriously demanding game which obviously is not the case.
Note that this is the theoretical FPS at which your game could run at provided that you're executing exactly as much as when you see that value, not the FPS at which the game actually runs.

Does this only happen when running the game from within the IDE or also when running an exported game? Not that it should make a difference, but just in case...

Either way, this doesn't sound like the expected result at all. An empty project should barely touch your hardware.
 
Q

Questalot

Guest
Thanks @TsukaYuriko . I thought that maybe if I can cap the FPS by turning on v-sync, that will improve things. It kinda worked, in the sense that sometimes the CPU load is around 30-40%. Here's what I have in an empty oGame object's create event:

GML:
display_reset(0, true);
game_set_speed(60, gamespeed_fps);
room_speed = 60;
draw_texture_flush();
I just tried to build an empty project (none of the above tweaks), and the CPU load sits around 90+%, same as running the project from the IDE.

It's frustrating because it cuts into my actual development time (by eating my battery quickly), not to mention my actual developing experience is rather unpleasant--who likes a hot laptop for no good reason?

Anything else I can try?
 

TsukaYuriko

☄️
Forum Staff
Moderator
Seems strange that turning on vsync would help with anything... you're already setting the target FPS quite clearly and there's no reason the game should be running at any more than that frame rate. Please verify that this has an effect on FPS (with vsync on and off) by outputting the value of fps - that's the actual FPS the game runs at, not the theoretical max FPS the debug mode shows you.

Another thing I'd try is playing around with the sleep margin in the game options (Options -> Windows -> General -> Sleep margin). Setting this too low may negatively affect CPU usage (with the benefit of keeping sleep timings between frames tighter, leading to a more stable frame rate), but I can hardly imagine this causing that much of a problem when the target device in this case arguably has one of the best CPUs available in its market as of writing.
 
H

Homunculus

Guest
If it can help, I just tried on my old 2013 macbook pro, and I can see the same as well, although a bit less extreme. New project, empty room. CPU load is consistently around 85%. With v-sync enabled, I get 25% - 30% on average. FPS are at 60 with or without v-sync enabled.

It's an old model, but I'd still expect a bit less CPU usage with an empty room.
 
write this code to the room draw_texture_flush (); like such a menu, the room you often go into and there are no heavy sprites and animations.
when you enter this room, it will free up sectors of the video memory and thereby you will increase the loading of the following textures.
 
H

Homunculus

Guest
write this code to the room draw_texture_flush (); like such a menu, the room you often go into and there are no heavy sprites and animations.
when you enter this room, it will free up sectors of the video memory and thereby you will increase the loading of the following textures.
We are seeing this when running an empty project, there's nothing to flush.
 
Q

Questalot

Guest
Thanks for the replies here guys!

@TsukaYuriko With display_reset(0, false) the CPU load goes up to ~95%. With display_reset(0, true), the load goes down to 20-30%. The FPS starts at 30 in both cases, and immediately goes up to 60--and it stays there. It looks like it does make a difference, although I can't understand why. I couldn't find the sleep margin setting on my Mac.

@Homunculus Appreciate your input--seeing others experiencing the same behaviour on a Mac makes me think this may be a GameMaker bug, more than anything else. Hopefully, someone from the dev team will notice this thread.
 
H

Homunculus

Guest
I suggest filing a bug report instead of waiting for the dev team to stumble upon this topic. Seems definitely something that has a reason to be reported.
 

LunaticEdit

Member
OK I've also added display_reset(0, false); ever though I already had vsync set to true in the options. This does reduce my cpu usage as well on OS X! I've also noticed that even if the game is stopped, if I mash the stop button one more time the mono-sgen64 processes go away.
 
Q

Questalot

Guest
OK I've also added display_reset(0, false); ever though I already had vsync set to true in the options. This does reduce my cpu usage as well on OS X! I've also noticed that even if the game is stopped, if I mash the stop button one more time the mono-sgen64 processes go away.
Thanks for pitching in. Sounds like a bug alright. I'll let you guys know if I'll hear back on my bug report.
 
C

Colin B

Guest
Hate to bring up a semi-old thread, but has anyone found a fix or heard back from a bug report? After updating to 2.3 on my Mac, even a completely empty project shows up as using 99% of the CPU on Activity Monitor when running. I cannot for the life of me figure out a solution. Additionally, it appears that the IDE itself is using much more of the CPU than it did before the update, like 30-40% of the CPU even with a completely empty project opened up. Basically I can't even do anything in the new update without my computer burning up.
 
Q

Questalot

Guest
Hey @Colin B,

I filed a bug report with YoYo back in April. They requested some details and data, and then never heard back. 2.3 (stable, not beta) apparently improved this for me. An empty project sits around 20-30% CPU load, roughly the same as the IDE.

I think I exhausted all related threads I could find on Google. Back in 2.2 I turned v-sync on, and run projects in debug mode -- these two things combined used to bring the CPU down to 30-40% but it wasn't always consistent.

My Mac is burning up too, and I would love for a solution. I know that switching engines is not one, but I played around with Godot, and I used to get < 10% CPU usage pretty much across the board -- which makes things that more frustrating when trying to learn GameMaker.
 
C

Colin B

Guest
I did some more tests:

GameMaker IDE uses over 40% CPU when my computer is not plugged in
When I plug my computer in, GameMaker IDE's CPU usage skyrockets to over 100% CPU consistently
When I run any project, whether it is completely empty or not, the YoYo Runner's CPU usage is 99% consistently

What in the world is going on?

The temporary solution is to going into GameMaker's power saving preferences and changing the framerates to extremely low numbers, like 20FPS. This lowers CPU usage to around ~23% for both unplugged and plugged.

When I ran my project after doing these things, YoYo Runner started off at around 30% CPU, and then it suddenly skyrocketed to 90% CPU after about 20 seconds of not pressing anything at all. The project in question is literally a square that is moved around with the arrow keys-- no reason why the CPU should be so inconsistent.

I also have noticed extremely inconsistent framerates in the debugger. A project may sit at 8000FPS for a while, and then out of nowhere it will drop down to 3000FPS, and then slowly rise up, and go back down. Definitely never seen this behavior before 2.3. I am extremely confused
 
Q

Questalot

Guest
It looks a lot like my experience with both 2.2 and 2.3. Sometimes, I can get lower CPU usage, in the 30-40s. But I cannot replicate.
 
Q

Questalot

Guest
Funny enough, I was just watching this tutorial, and around 2:35 the guy mentions this exact same problem:
 
Q

Questalot

Guest
@Coded Games I think iMacs are a little different in this regard. They most definitely don't heat as much as MacBooks. Can you try to see what's your CPU usage?
 
Top