Page 1 of 1

[SOLVED] Game freezes fatally after only 20 seconds of gameplay

Posted: Thu May 09, 2024 4:06 pm
by Stepanchicko
I'm a newb who's working on a big project, and having thought about how big it actually is and how unexperienced I am, I decided to make a small game to get used to the love2d working sphere.
I tried making a simple game (a simple 2d remake of the classic Get Crushed By A Speeding Wall), and everything was working fine until I decided to playtest it for a bit longer. Then I realised that after literally 20 seconds of playing the FPS gradually decreases, and a second after the game freezes. The music is still playing, but nothing is moving, the background video is torn between two frames, and if you try to click on anything, the cursor freezes up. I have no idea what has happened to cause the freeze, could somebody help me? My game isn't using love.physics nor am I making a lot of calculations at once... :cry:

Re: Game freezes fatally after only 20 seconds of gameplay

Posted: Thu May 09, 2024 8:22 pm
by Xugro
The problem is, that you are loading the images thegovernment.jpg and textures/normal.png every frame. Load them once in love.load() like you do with the videos and music. This fixes the freeze for me.

Re: Game freezes fatally after only 20 seconds of gameplay

Posted: Wed Jun 12, 2024 8:38 am
by Stepanchicko
Xugro wrote: Thu May 09, 2024 8:22 pm The problem is, that you are loading the images thegovernment.jpg and textures/normal.png every frame. Load them once in love.load() like you do with the videos and music. This fixes the freeze for me.
Thank you thank you and a million times thank you! Helped me out a lot.