Rae Jam Completed
Well the rae jam completed yesterday and I've submitted what I've built to date. There's some great submissions up on the game jam too.
For me it has been an interesting experiment in running Chipmunk2d on the playdate, and learning about optimising the combination of a physics engine and on screen artwork. I'm happy Coin Chaos is reasonably stable at 50fps while the game is playing.
What did I learn?
Game jams are kinda fun. I should sign up for more. I think it helped a lot of folks including me that rae's jam was pretty low stress with a very flexible set of rules. I'd be interested in try and jam that's themed next, just to see if a fixed theme is helpful or not to the creative process.
Folks on the Playdate Squad discord server are super friendly and helpful and appear to be an eclectic mix of hobbyist and professional game developers coding on the playdate in their spare time. They provided some great advice during the game jam, that I'm still working into the game.
Chipmunk2D
- Physics driven artwork: This was reasonably straight forward to get going. The playdate can't support rotating pixel art in real time at 50fps so there's 36 frames for each piece of coin art at 10° intervals. Playdate 1-bit artwork compresses nicely so this doesn't take up much RAM. The SDK polygon fill and line draws are used for everything else and are fast enough it seems. The rotating artwork lags behind the rotating polygons, but not so much that your eye notices once things are in motion I think.
Each coin is also represented by a playdate sprite which includes a bitmap that is large enough to support drawing the coin on it. There's a reasonable amount of simple trigonometry going on to redraw each coin in that bitmap, but it's helped by the fact the physics engine provides the rotated polygon edges as it already knows them after each simulation call (see cpPolyShapeGetCount, cpPolyShapeGetVert and cpBodyLocalToWorld).
- cpSpaceDebugDraw: If you're using Chipmunk2d it is 100% worth implementing the cpDebugDrawOptions functions and using the cpSpaceDebugDraw call. This is because with a minimal amount of effort you can get an on-screen visualisation of where the physics simulation thinks the physics objects are, on-screen. This helps immensely with debugging physics issues.
It's also not hard to do, and the Chipmunk2d demos all use this method for rendering themselves - so there's plenty of guiding examples to use. Here's the game world according to the physics simulation (you'll notice it's slightly different from what's rendered on screen):
- cpSpace has useful methods: The game uses cpSpaceSetDamping for the global friction, and uses cpSpaceSetIdleSpeedThreshold and cpSpaceSetSleepTimeThreshold for encouraging Chipmunk2d to put the physics bodies to sleep more quickly when they're at rest. The cpBodyIsSleeping function is used to control when to redraw the coins, so the sooner they sleep in the simulation the better.
These functions combined with the playdate C SDK sprite system work nicely to reduce the screen area redrawn each frame, and the corresponding battery life of the device. In the simulator you can turn on the handy View > Highlight Screen Updates option to see it in action.

- KINEMATIC bodies never sleep in Chipmunk2d. This is because they're designed to be driven directly by your code. If you want a body that stays fixed in place in the simulation, set the mass and moment to some large value (but not INFINITY as some people suggest as that causes issues on the playdate). This is how the coins in the 'magazine' on the left are driven.
What's next?
Coin Chaos is more of a learning exercise and less of a game at this point, but I'd like to actually make it a game. There's lots of opportunities to explore coin effects using the physics engine. Things like repulsion (explosions), attraction (gravity) spring to mind as well as more Peggle like play with obstacles and pins, or pinball like play with targets and bumpers perhaps.
I'll iterate for a few more weeks and see how it goes and then inevitably move onto the next half complete project or find enough traction to build something worthy of a playdate submission attempt!
Files
Get Coin Chaos
Coin Chaos
A coin based 2d physics shuffleboard game for the playdate
More posts
- CoinChaos v009 Update20 days ago
- The Power of Pahole28 days ago
- Day 5: Saturday - Gameplay: Coin effects?48 days ago
- Day 4: Friday - Gloss: Noisy Things49 days ago
- Day 3: Thursday - Gameplay: Levels50 days ago
- Day 2: Wednesday - Gloss: Shiny Things51 days ago
- Day 1: Tuesday - Gameplay: Basic52 days ago
- The Seven Days of Rae Jam53 days ago
- Chipmunk 2D Physics on the playdate53 days ago
Leave a comment
Log in with itch.io to leave a comment.