ZombieSquirrel
Member
Hi everyone,
for a long time I have been fighting lag in my game.
The lag did do something good however; I learned to optimize so many things,
that the lag was reduced by a ton.
I can basically have like 2000 instances running a small (but clever) amount of code and the lag
doesn't really happen.
But one thing always endured:
If I minimize the game, with CRT+ESC shortcut,
en then come back by clicking the game icon in the taskbar,
lag starts to happen. Sometimes to an unplayable degree.
My camera automatically sets the screen to fullscreen,
and there is some surface manipulations going on to get some cool effects, like setting up a lighting surface.
I payed very close attention to how that's done in tutorials, and I don't expect it to be the cause of the lag... I hope.
In the camera, after all the shader magic happened in the code (post-draw event),
I do also do this at the end of my shader code:
The crazy thing is I accidentily homed in on a "solution".
Once back in the game,
if I press the keyboard shortcut ALT + ENTER.
The srceen flashes briefly,
and goes from seemingly maximized to again, seemingly maximized.
This time the lag is FULLY gone. None. Even when I try to push my game to
the limits of what I want to do, no lag. None.
It seems the program "loses track" of something,
and only after the ALT-ENTER press does it "grab back onto it".
So here's my questions:
What does Alt-Enter really do?
How does this affect surfaces?
What happens to surfaces if you CTRL+ESC out of the game?
Is it okay to put window_set_fullscreen(true); in a step event?
EDIT: Extra information
my room speed is set to 60, every room is persistent and clears the display buffer, game starts fullscreen, first room of game is not of a screen display size but a camera handles a proper view,
I allow full screen switching, borderless window is turned on, and I'm "keeping aspect ratio" turned on as well.
for a long time I have been fighting lag in my game.
The lag did do something good however; I learned to optimize so many things,
that the lag was reduced by a ton.
I can basically have like 2000 instances running a small (but clever) amount of code and the lag
doesn't really happen.
But one thing always endured:
If I minimize the game, with CRT+ESC shortcut,
en then come back by clicking the game icon in the taskbar,
lag starts to happen. Sometimes to an unplayable degree.
My camera automatically sets the screen to fullscreen,
and there is some surface manipulations going on to get some cool effects, like setting up a lighting surface.
I payed very close attention to how that's done in tutorials, and I don't expect it to be the cause of the lag... I hope.
In the camera, after all the shader magic happened in the code (post-draw event),
I do also do this at the end of my shader code:
GML:
application_surface_draw_enable(false);
if (surface_exists(application_surface))
{
draw_surface(application_surface, 0, 0);
}
The crazy thing is I accidentily homed in on a "solution".
Once back in the game,
if I press the keyboard shortcut ALT + ENTER.
The srceen flashes briefly,
and goes from seemingly maximized to again, seemingly maximized.
This time the lag is FULLY gone. None. Even when I try to push my game to
the limits of what I want to do, no lag. None.
It seems the program "loses track" of something,
and only after the ALT-ENTER press does it "grab back onto it".
So here's my questions:
What does Alt-Enter really do?
How does this affect surfaces?
What happens to surfaces if you CTRL+ESC out of the game?
Is it okay to put window_set_fullscreen(true); in a step event?
EDIT: Extra information
my room speed is set to 60, every room is persistent and clears the display buffer, game starts fullscreen, first room of game is not of a screen display size but a camera handles a proper view,
I allow full screen switching, borderless window is turned on, and I'm "keeping aspect ratio" turned on as well.
Last edited: