When a game crashes on the Playdate unit, if it is some sort of coding or maths error, would it usually show an error message on the screen, like what you would see on the simulator's console?
Or does it always crash to the screen that shows some building blocks, and just says something like "something went wrong, press A to restart"?
I'm working on a game that involves shooting what is basically a machine gun.
I have an array to contain my bullet sprites, which I cycle through, adding new bullets in the space where an expired bullet was previously stored. This means that I only ever have 8 bullets assigned to the array. When a bullet either reaches the end of it's path, or collides with a wall or enemy, It is :remove()ed, and a new bullet will be assigned to it's place in the array.
When I play the game on my actual Playdate, performance seems fine, but after a while, after going through a few rooms of the game, clearing enemies, I will start getting massive frame-rate drops, and eventually the game crashes.
It seems to me that it would be something to do with building up huge numbers of redundant sprites. but, even if I'm not properly removing the sprites, which I'm fairly sure that I am, the fact that all bullets are assigned to an array that never goes above 8 entries, should mean that the garbage collector should still be tidying up any bullet sprites that are no longer part of the array. right?
I've tried putting print(gfx.sprite.spriteCount()) in my main update loop, and seeing if the number of sprites increases as I transition between game rooms and firing my blaster.
But the number of sprites doesn't seem to increase.
Any ideas on what might be happening, or what steps I might take to try and find the cause?