So my playdate is coming next month and there's a small torque-based platformer that I'd like to try porting (because crank). The player character is a circle, and the levels are constructed out of a fair number of static rects and, at times up to five dynamic boxes. It scrolls continuously. There's some pretty fast movement and some very fast spinning, so a relatively quick physics update and ideally a quick screen refresh is ideal. (I would draw the player as a sprite with canned rotation frames, including smear frames for fast spinning.)
It looks like there are three physics engines already ported to some degree to Playdate, none of which exactly meets my needs:
-
Playbox2D: Tiny and readable. Only does boxes, so I'd have to extend it to handle circles. Thankfully circle/circle and circle/box collisions are easy and the library is small. In theory perf should be good since it's a small c lib, but I don't exactly have a way of testing. Still haven't built this one because I was using my Windows box and doing Playdate C on Windows looks pretty grody and involves pushing through a bit of Visual Studio PTSD. Getting this up on my mac laptop is on my task list for today.
-
Playdate-matter: Lua port of matter.js. It was extremely easy and gratifying to prototype the crank-to-torque mapping here, and Matter.js is pretty feature-rich, but either because circles are treated as polygons in Matter (whyy) or because of some quirk in the port, rolling physics are profoundly unstable, with a lot of unwanted bouncing and premature settling. Matter.js is pretty beefy and I'm not optimistic about my ability to extend it as the first thing I do with the Playdate.
-
Just using Chipmunk2D? A while back somebody posted a demo that claimed to fairly trivially pull in Chipmunk and get decent performance in C. I haven't looked at this yet, but if it's more stable than that Matter port it seems like a promising option.
Are there any other physics libs (or updates to them I've missed)? Anyone got advice on sane ways to broach this? Challenges I'm missing that might render my goals untenable? I know I should probably be starting with something simpler as my first Playdate build but this is the thing I actually want to put on the device...