Creative Coding cover image

Creative Coding

I love creative coding. This is the way I got hooked into programming, with Processing and Arduino, and what got me was how short the loop is. You write a few lines, you look at the screen, something moved.

Small iterations and you see the result immediately. I think the shorter the loop between coding and seeing the result, the more satisfying it is. I did lots of creative coding projects over the years, and I even made a creative coding app for Android, Phonk, so this is not exactly a new love.

It started as a viewer

So a while ago I started something small. I made a viewer for p5.js sketches, and then a gallery of ten one-liner sketches to put inside it. Nothing ambitious, just a nice place to look at them.

Then, because I am a designer and I cannot help it, I spent a while trying different visual directions for that gallery (an MSX one, a ZX Spectrum one, a studio one, a minimal one) and I screenshotted all of them before picking one.

(image gallery themes)

At some point I was looking at the gallery and I thought, this is nice, but what if somebody else could type here too? So I built a shared arena where more than one person can edit the same sketch at the same time, synced with CRDTs, with live cursors so you see who is writing what.

And then it became a game

Because once two people can edit the same sketch, the obvious question is whose turn it is. So it became a game, SketchJam. Everybody starts from the same seed sketch and then you pass the pen: one player on the keyboard at a time, on a clock, with everybody else watching the code change live.

The part I enjoyed designing the most is the two budgets. A turn ends when either the time or the characters run out, and then the sketch locks as it is.

  • The time does not start when your turn opens, it starts on your first keystroke, so reading the code you were handed is free. I did not want people to panic while they were still understanding what they inherited.
  • The characters are counted as edit distance against the sketch you received, with the leading whitespace stripped before measuring, so reformatting and moving things around is not charged as new work.
  • There is no revert. Whatever you leave behind is what the next player has to work with.

I played it with people and it was great. Seeing a small sketch morphing into something else turn after turn is really really fun to watch, and the constraints add a lot. The time and the number of characters put you in a bit of a pressure mode, and that pressure is what makes it engaging.

(video a game session)

At the end you can scrub the replay from the seed to the final frame, with credits showing what each turn cost, and a finished game can seed a new one, so games end up having ancestry. It is not online yet, but it will live here: https://changeme.placeholder

I built almost all of it through the Forgejo agent workflow I wrote about in Forgejo with agents, opening issues from wherever I was and reviewing the PRs later. Around seventy commits in three weeks.