PewPew: Python games on Playdate (WIP)

Prompted by giving a conference lightning talk about it (a recording should eventually appear here), I have resumed work on this project for a bit. Here is a new release that has an up-to-date MicroPython, a launcher card with launch animation, and includes some example games that you may find fun to play even if you have no intention of writing your own games:

The example games are copied to the data area on the Playdate on the first launch, so you can edit them there in data disk mode and experiment with modifying them. Implementing the copying uncovered a weird bug in the Playdate OS. I think I have worked around it and the copying works on my HW Rev. A device now, but some testing would be appreciated especially on HW Rev. B devices.

Another thing I have noticed over the last year is that the games run slower than I would expect from similarly-specced hardware (bare-metal) PewPews. The speed feels comparable to a SAMD21-based PewPew, whose CPU is more than 3 times slower than the Playdate’s. Profiling with the Sampler didn’t show anything suspicious, it does seem to spend most of its time executing Python code. Recently after reading Dirty Optimization Secrets (C for Playdate) I started suspecting that at least part of the cause may be that due to the way the coroutine library sets things up, the stack for the Python coroutine lies in slow external RAM, unlike the stack of the main thread set up by the OS. I will have to do some experiments to find out if that can be improved.

1 Like