One day in early 2022 I came across an article talking about Pico-8, a small game engine developed by Lexaloffle Games. The article described it as an interesting experiment and invaluable tool for designers; because the engine is so limited it forces you as the designer to narrow down your design and focus on making the important things work, it's harder to get distracted.
I decided to try using it with a concept I had come up with a few months earlier: A tower defense game where the player places down frogs which then try to catch flies, the main gimmick being the way the "towers" attacked by extending their tongues. The game features a small campaign designed to teach the player the basics of the game and an endless mode with randomly generated, increasingly difficult waves of flies.
Compared to some of the other projects on this Portfolio I had to return to this project quite a few times to get it to the current state: Pico-8 presented a lot of new challenges that I wasn't used to from using Unity and the simplicity really brought out the flaws in the design
Return to MAIN PAGE:
Or keep reading about this project!
Lua.
Making this game in Pico-8 presented several interesting challenges: Pico-8 uses a version of lua that has a few extra commands patched into it. However there are no unique objects or classes; everything is handled with tables which are used similarly to objects, i.e.: there is a table that contains all flies and each of those flies is another table that contains the same set of information. The code then iterates over the table and executes the same commands for each fly.
One of the biggest hurdles was vector based movement: To have something move toward something else you have to work out the direction vector which means getting the distance between the two points first. The first mistake that is easy to make here is an overflow: using pythagoras means you can easily end up with a number too large to store in one int at which point lua simply overflows the int and you wonder why things start to move randomly when far away. Also you want to make sure the two points aren't ontop of each other because then you get a divide by zero, except lua doesn't throw an error or anything, it just returns a max int and you will be left wondering why things just teleport off the edge of the map when they reach a certain point.
Another one of Pico-8s quirks is it's limitations in terms of what can be stored on the cart, the main ones being a hard limit on the number of symbols, as well as a limit on the number of tokens you can use to code. A token is generally one operator, so x=9 is one token. This presents an interesting challenge for storing and loading the data for different levels: Each level has many many variables, the different paths, the different points of each path, the different flies, what paths they belong to, what their stats are, when they should be spawned, the level name and description, how many lives the player should have and how many frogs the player can place just to name a few. You could simply store each level as a function and then set each of these variables before loading the next level but then we use one token for each variable for each level. So instead of this the game uses an unpack function; each level is stored as a single table and then the unpack function loads data from the table into the variables. This way each level is just one token and we only have to use the tokens to assign the variables once in the unpack function.
Why Prototype?
So what did I learn from making this prototype?
In the end developing this showed that the core idea is good, it is fun to watch the frogs attack the flies and there is a certain charm to the childlike nature of the game.
One of the more interesting discoveries happened when I left an early debug build running in the background while grabbing lunch. In this build flies spawned endlessly and so a frog I had placed kept eating flies and leveling up. When I returned, I upgraded the frog a ton for the fun of it and created this eldritch monstrosity. This was surprisingly fun, seeing the cute frog go this berserk had a bizarre appeal and is something I would focus on if I took this design back to a proper engine.
Back to Top