GameMaker High FPS but Random lag

T2008

Member
My real fps is really high but sometimes my game will randomly lag (ie the player can't walk fast and seems in slow motion/like it's walking on friction). Vsync is off because when on, it makes my game run oddly (ie player will go super fast, etc). My computer is brand new and high quality. Sleep margin is 10; room speed is 60.
I ran in debug mode and, although one object I think caused a steep drop), when I've run in virtually empty rooms, this same lag has happened.
Changing room speed higher doesn't help.
Any ideas as to what is going on?

Edit: Forgot to mention, sometimes the identical room will run fine with no lag at all (when I haven't changed anything).
 

flyinian

Member
My real fps is really high but sometimes my game will randomly lag (ie the player can't walk fast and seems in slow motion/like it's walking on friction). Vsync is off because when on, it makes my game run oddly (ie player will go super fast, etc). My computer is brand new and high quality. Sleep margin is 10; room speed is 60.
I ran in debug mode and, although one object I think caused a steep drop), when I've run in virtually empty rooms, this same lag has happened.
Changing room speed higher doesn't help.
Any ideas as to what is going on?

Edit: Forgot to mention, sometimes the identical room will run fine with no lag at all (when I haven't changed anything).
One Idea:
It may be a memory leak. Use the debugger and activate the profiler and check to see if anything is significantly more active than other things.
 

TsukaYuriko

☄️
Forum Staff
Moderator
A memory leak does not cause performance issues. That may be a side effect of the actual cause, but is not the cause itself.

Use the profiler to figure out what's draining performance during these lag spikes, if anything at all. Make sure to perform these tests on an as clean device as possible with as few running background tasks as possible.
 

Yal

🐧 *penguin noises*
GMC Elder
The general reason you'd have lag spikes is because something occasionally does a LOT of processing, then goes back to not doing a lot of stuff. Have you recently (i.e., right before you started experiencing the lag spikes) started adding any code that does big loops over a lot of data or room space? (Tons of objects having a perfectly synchronized alarm could also explain this, but since you mentioned this happening even in empty rooms it's probably not a cause).

(Also keep in mind that your OS / antivirus might also cause the lag spikes)

FPS won't catch the lag spikes directly, since it's only updated once per second - a spike must last at least that long for it to impact the averaging of the game speed.
 

T2008

Member
Thanks for the responses. I know my previous antivirus software caused my game to take forever to compile so I changed that. It's a strange problem because it appears to be totally random. Sometimes the exact same room with everything will run fine and other times it will have the lag issue when nothing has changed. Doesn't seem like there is something to spike/cause lag if the room as almost nothing in it.

My computer is brand new Macbook Pro running Windows Bootcamp. This is really strange.
 
Top