Advent of Code Goes 8-bit


Creating the Universe

It turns out, building a universe MVP is surprisingly easy. I started with a small list of stars, each with predictable paths. PICO-8 uses a subset of Lua, and this snippet shows a list of maps, assigned to a global variable:


Controlling Time

Starting small, I thought two things would be most immediately useful: pausing time, and being able to set the start frame. Fortunately, both were easy.


Controlling Space Itself

After a lot of mulling and trying out terrible ideas, I realised I needed a camera, and the stars should be on a fixed plane. As it’s a single object with several attributes, I made a map to hold its state, and set a couple of constants:

It’s… beautiful
I can zoom! I can pan around the infinite ouroborous of starfields!
And I can speed up time or play it in reverse!
Wait… what happened? Did it implode? Lucky I built that time machine…
Enhance!
`z`                  : pause/play
`up/down/left/right` : pan
`x + up/down`        : zoom
`x + left/right`     : when paused, skip 1 second. 
                       when playing, skip 50 seconds.Just a hint: this uses the sample input from the AoC website, and winds back in time 5000 steps. The message is at step 3, so you'll need to zoom in, and get ready with the pause key to catch the message :)

carwow Product, Design & Engineering

What happens under the hood at carwow.co.uk

Dan Rees-Jones

Written by

carwow Product, Design & Engineering

What happens under the hood at carwow.co.uk