Game freezes randomly
Posted: Sat May 28, 2022 12:45 pm
Hi,
I've been working on a platformer for the past month. ( if you want to try it, you can move with the arrow keys, jump with the "z" key, and groundpound with "x" )
However, sometimes, the game simply freezes. The game window doesn't refresh, and I can't "CTRL-C" in the terminal to kill the game, I'm forced to use "killall -9 love" in order to terminate it ( I'm on Linux ). It seems to happen randomly, in no specific place.
Here's a list of things I already tried to pinpoint the problem :
- I tried my game on another computer / another operating system, and the freeze still occurs, so it's not just my computer
- I noticed that such freezes can occur if an infinite while loop is present, however I just have 4 while loops in my codebase, and none of them are infinite.
- I tried disabling my shaders, and the freeze still occurs
- With the help of print statements, I noticed that the freeze has only occured inside the love.update function, and only during the "step" function of the following objects : the player, the cars ( moving platforms that are inside the first level ), the transitions ( the screen fading between two levels ), and the falling platforms ( that are present in the third level ).
Does anybody have an idea why this kind of freeze is happening ? Or is there a better way for debugging my game than putting a bunch of print statements ? I'm kinda lost here
Thanks in advance,
Cheers
I've been working on a platformer for the past month. ( if you want to try it, you can move with the arrow keys, jump with the "z" key, and groundpound with "x" )
However, sometimes, the game simply freezes. The game window doesn't refresh, and I can't "CTRL-C" in the terminal to kill the game, I'm forced to use "killall -9 love" in order to terminate it ( I'm on Linux ). It seems to happen randomly, in no specific place.
Here's a list of things I already tried to pinpoint the problem :
- I tried my game on another computer / another operating system, and the freeze still occurs, so it's not just my computer
- I noticed that such freezes can occur if an infinite while loop is present, however I just have 4 while loops in my codebase, and none of them are infinite.
- I tried disabling my shaders, and the freeze still occurs
- With the help of print statements, I noticed that the freeze has only occured inside the love.update function, and only during the "step" function of the following objects : the player, the cars ( moving platforms that are inside the first level ), the transitions ( the screen fading between two levels ), and the falling platforms ( that are present in the third level ).
Does anybody have an idea why this kind of freeze is happening ? Or is there a better way for debugging my game than putting a bunch of print statements ? I'm kinda lost here
Thanks in advance,
Cheers