Windows, SDK 3.0.3 (also occurs on 3.0.2)
I was wandering down a dungeon hallway in my mixed C and Lua project, testing how much getting impaled by spikes and roasted by fireballs hurts (as one does) when I got a nasty crash:
Hmm (says I), that stack trace is not very informative. In fact, it looks like my C chunk wasn’t involved at all.
After much binary-search-code-outcommenting, I arrived at the culprit - up in the Lua layer, my ‘shake screen’ effect when zapped by sharp/hot objects was bringing everything crashing down.
So I whomped up a quick and tiny Lua project example (attached: ShakeIt.zip (463.1 KB)) that pretty reliably crashes the Simulator:
The Lua code is pretty simple:
local gfx = playdate.graphics
local shakePending = false
local shakeX = 0
local shakeY = 0
local shakeCount = 0
local shakeTrigger = 6
function shakeCheck()
if shakePending == false then return end
shakeX = math.random(-2,2)
shakeY = math.random(-2,2)
shakeCount = shakeCount + 1
if shakeCount > shakeTrigger then
shakeCount = 0
shakeX = 0
shakeY = 0
shakePending = false
end
playdate.display.setOffset(shakeX, shakeY)
end
gfx.setColor(gfx.kColorWhite)
gfx.setImageDrawMode(gfx.kDrawModeCopy)
function playdate.update()
gfx.fillRect(0, 0, 400, 240)
playdate.drawFPS(0,0)
gfx.drawText("Hold 'A' to Shake it, and crash the Simulator!", 20, 20)
if playdate.buttonJustPressed(playdate.kButtonA) and (shakePending == false) then
shakePending = true
end
shakeCheck()
end
It may be that I’m Doing Something Quite Wrong ™ in the above (in my actual code, later on I’m re-setting the offset back to 0,0), and that’s fair - but IMO whatever the wrongness is that shouldn’t crash the Simulator.
(it may take tapping the A button a couple of times to crash things, though for me it pretty reliably crashes on the first tap)
edit: this is relatively new behavior, as far as I know - things used to shake fine… I just haven’t wandered down that hallway in a few (?) weeks and now things crash pretty reliably.
edit2: I tried this on actual hardware (RevA/3.0.3), no crash (so, some good news to go with the bad).
Enjoy! ![]()


