Simulator: cap refresh rate to any number you choose

I use refreshRate 0 because it runs best on device, but on the Simulator (M2 Mac) it speeds out of control. So I have to edit my code to set a lower FPS for Simulator testing, and than edit again and rebuild for device testing. I do both kinds of testing often.

A way to detect the Simulator from Lua might allow workarounds—but better yet, if the Simulator had a "Cap Refresh Rate..." option, that would be great! You could enter any number you wanted:

  • A number the dev chooses to approximate what PD hardware delivers for her/his particular game.

  • Or to quickly prototype how different refreshRates might feel.

Alternatively, instead of an upper cap, it could be "Set Refresh Rate..." and allow you to go HIGHER than the game code has set. Might be convenient for some kinds of "fast forward" testing.

When I do this I use a simple if statement:

if playdate.isSimulator then
    playdate.display.setRefreshRate(50)
else
    playdate.display.setRefreshRate(0)
endif

etc

2 Likes

That does the job! :+1: