Ciro Durán A Live Archive

Cosmos Postmortem

Cosmos Postmortem

I participated in the recent Caracas Game Jam 2022 (online) making a videogame. In this occasion I decided to use PICO-8, a fantasy console (I’ve written about this in El Chigüire Literario, my gamedev blog written in Spanish). At the end of the event I presented Cosmos, a game for two players. The objective is to build a planet keeping several elements in the center of the screen, using attraction/repulsion forces from the sun and the moon. You can play it in the browser or downloading it from that website.

I write code with Lua and used PICO-8 internal tools for making art, music and sound. In PICO-8, all this goes into the same file. I used Visual Studio Code for writing code, along with an extension for syntax highlighting. This way, VSCode uses half of the screen, and PICO-8 uses the other half. Once I’ve made changes in VSCode, I switch to PICO-8, press CTRL-R and the program reads the file again and picks up the changes.

An issue I had constantly and that I blame on the lack of habit: when you make changes in PICO-8 (e.g. sound, music, sprites, maps), you have to save the file before making changes in code in VSCode. If you forget, and you also make changes in Code before saving, when you press CTRL-R PICO-8 detects that there are changes in the file that weren’t made in the program, and refuses to load the file. This is not a problem, it’s actually very good. Resolving this is not critical: when you save in PICO-8, VSCode picks up the changes immediately, so you can Undo that change, copy the things you had made, Redo and apply the changes where appropriate. It’s usually better to be aware and avoid making changes in both programs at the same time.

I think PICO-8’s plain text format makes it ideal for collaboration, e.g. a person can do sprites/maps, another one does music/sound, and then all can be merged in a git repo. I did not test this workflow as I worked alone, but a setup like this seems quite feasible.

Sprites have 16 colours, and 8x8 at its smallest. The default colour palette in PICO-8 is really pleasing, and you can change it if you want to. Lua as a programming language: I’ve used it before and I am aware of its weirdness (e.g. arrays that start from 1 and not 0, declaring arrays and tables, etc.). PICO-8 Lua has some slight differences from the standard implementation (e.g. trigonometric functions go from 0..1, and not radians nor degrees), but the official documentation is really good, and there’s a cheat sheet that is quite useful as well.

Official docs:
Cheat sheet:

Sounds was my weakest moment in the process, as it was my first time using it. That said, it was really simple to make music and understand how the system works. If I had more time I would have written the code to make the music change on tempo. The platform gives you enough to write that, but the function to call music is very simple, so you have to write all the code for that case.

I would like to keep using PICO-8 for other things. You can call Serial port and GPIO, so it can work with an Arduino or a Raspberry Pi really nicely. I’d love to explore that part a bit more.