Simulator: step frame

I'd really like to be able to advance the simulator one frame/update at a time to catch particular moments so I can debug them.

3 Likes

Maybe you can put everything in one function and call it via Simulator?

function playdate.keyReleased(key)
    updateGame()
end

Not sure if that works, but might be worth a shot :sweat_smile:

2 Likes

The Simulator supports the Debugger Adapter Protocol, which means you should be able to breakpoint and step using the right companion tool.

I do it with Panic's own Nova editor. You may also be able to use VSCode Using breakpoints with LUA code - #13 by midouest

1 Like

On the macOS simulator, you can step the simulator forward one frame while it's paused by holding the option key down and clicking the play button. I don't see any code implementing that function in the Windows/Linux simulator, though. I'll file it!

10 Likes

Very nice! Maybe a dedicated step button would be more discoverable?

I see that Option-Spacebar works too. :+1:

(But holding Option in the Playdate menu doesn't reveal that. Might be a useful little Mac-ism for the 7 people worldwide who like to hold Option to look for advanced menu commands.)

2 Likes

Love it! I'll be sure to make use of this.