Random delays during gameplay

Hi,

full disclosure I don't have a Playdate yet, this is a problem other people have seen when testing my game on a device.

Has anyone else seen an issue where a Playdate will randomly pause on them during gameplay for about 2 or 3 seconds? It sounds almost like garbage collection is kicking in with catastrophic results. I've been told it has a tendency to happen when the Pulp tune I'm playing loops back to the start, but beyond that I have no idea what triggers the delay.

I'm developing in Lua. I cache most resources before the start of gameplay (e.g. sounds, images, etc) but there are still some sprites I load and destroy during gameplay. I have given the Garbage Collector more time than usual to do it's thing per frame using

playdate.setMinimumGCTime(10)

at the top of my main.lua file. As I'm just writing a puzzle game I'm not going to have a lot moving around at any given time so I think that's a good trade-off.

Anyone got any advice for anything else I could try? I'm in Group 3 so I've no idea when I'll get a device and am trying to decide whether or not to release the game before personally seeing it working on a Playdate.

thanks,
Stephen

Hard to give a useful answer without seeing code, or at least a build. Can you post one or the other?

It's in this thread: Addled, a classic puzzle with some new twists - #15 by dave

1 Like

I opened the last build from this thread (not sure if that’s newer or older than the one in the other thread) and it looks like the device gradually runs out of ram, after which something kicks in and collects the garbage (although there isn’t a corresponding GC spike on the performance graph). During this, it appears frozen, and afterwards the performance never recovers (“System” activity on the graph seems to begin to spike at this point), but it looks like the memory usage starts to gradually grow again, eventually leading to another hang. At least from the graph, it doesn’t look like the garbage collector ever has a chance to run at all until the ram is full. (Edit: or maybe it isn’t garbage and you have a memory leak, don’t think there’s a way to tell from seeing this)

(the varying FPS at the beginning is during menus/loading; the steady FPS is during gameplay, the low FPS at the end is during gameplay after the “freeze”)

1 Like