• 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!

Pause menu causes major game lag, how to fix this?

P

PowerSeal

Guest
Hello everyone,

I am currently in the process of making my first game and I have managed to make my pause menu. I have done so by virtue of adding an invisible object (o_Pause) into every room which is programmed that upon pressing the backspace button that it deactivates all instances and activates the instances that are relevant only to the menu. I have different screens for the menu such as one for saving and quitting, one for items, one for quest stats, etc. and when in a specific screen even for just ten seconds it starts to cause some lag. I have all of these screens separated by different states (such as scr_states_ItemScreen for the items, etc.) and they are listed in the step event.

I understand that the step event is what is causing the game to perform a specific function at every frame rate of the game. My frame rate is at 60. Should I have all of this moved to a different event instead of the step event? I feel like what is causing all of this lag is the fact that it is all in the step event.
 
Post your menu creation code and if it's in the step event maybe you are creating the menu objects over and over again.
 

Xer0botXer0

Senpai
Personally I don't deactivate all instances, I take it you've either got a huge loop going on there or it's the deactivating x instances that causes it to lag.
In game at the moment when it's paused a bool_pause prevents any actions from occuring (enemy movement, building, etc). So the instances can stay active, just actionless.
Try encasing your action code in a pause boolean, see if that works better.
 

TheouAegis

Member
Make your pause object persistent, that way you don't have one in every single room. Also, if you already did make it persistent, then you are making it so you have 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 in every room.

What code are you using for the deactivation of unnecessary elements and activation of menu elements?
 
Top