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

Legacy GM [SOLVED] Randomly frozen game

F

Franyer

Guest
Hi everyone, I'm Franyer First excuse my English, I speak Spanish

I've been programming for almost a year at GML, I'm doing a kind of Mario Maker

From a few days ago my game began to freeze randomly, it should be noted that I am making major changes to the level editor. These freezes are random but I have noticed that it happens almost every time I click on an object, on one occasion I click and it works perfectly and on another it freezes the game freezes but it still works in the background, the music and the actions I do with the mouse are heard. If anyone could help me I would greatly appreciate them
 
G

GmlProgrammer

Guest
We need some code in order to help, what did you change? From the looks of it, must be an infinite loop
 
R

robproctor83

Guest
I'm not sure I understand, are you saying you resolved the issue?

If not, you should do some debugging. Open debugger and see what is going on. If you can't surmise from that what the problem is then turn on the profiler and see if that doesn't give you some insight. If that still doesn't help you need to do some custom debugging. You need to go into wherever it is you think things are hanging up and start adding show_debug_messages() everywhere so you can trace through the process, or start commenting out things until you find the code that is cuasing it, or both.

And, on another note, if the game is hanging up with no error or crash and there your not getting a huge memory spike or something then it's usually an infinite loop. While loops are usually the culprit here. It might behoove you to just disable your whiles for a moment and see if that fixes it.
 

Azenris

Member
if its an infinite loop, run in debug mode and when it hangs, tab to the debugger and pause it. you might find it trapped there.
 
F

Franyer

Guest
Yes, I have already commented parts of code of several objects where I thought the problem was but nothing remains the same. I really do not understand why it happens, I have not put any blucle. This appeared overnight and I do not remember placing. Could you explain step by step how to use the debugger? I've never used it
 
F

Franyer

Guest
Do you know if draw_sprite_tiled_ext in the draw event can cause an infinite loop?
 
R

robproctor83

Guest
Infinite loops are most likely caused by a while loop, but you can get them in other ways too like recursive functions and other jacked up loops. If you want to know more about debugger search Google for gamemaker debugger and take the link to the docs. If your on gm2 then try and make sure your on the 2.0 docs, though either one should get you where you want to be.

My advice, do a global search for the word while and try and disable them if you can. If not put a show_debug_message in there and see if it prints out infinitely and if so that loop is the culprit,bor at least one of the problems.
 

TheouAegis

Member
Make sure you run your game in windowed mode. when it freezes up, click on the x in the top right corner to close it. If the ex doesn't respond, then you are stuck inside of a loop. The only loop which will not hang is repeat, all of their loop types will potentially hang if your code is not correct. You can even potentially end up in a recursive script loop where the level of recursion from having a script or chain of scripts call itself is shallow enough not to trip game maker's recursion detector. So...

while can freeze
for can freeze
do until can freeze
script recursion can freeze
repeat won't freeze

If the game freezes, manually click on the debugger and then click the pause button. It should show you what loop it hung up on. I think.
 
F

Franyer

Guest
Thank you very much for your help, I could solve it I was using draw_sprite_tiled_ext() to draw the game grid

I changed it to draw_sprite_ext() and the problem was solved
 
Top