Game development is a complex process. Besides writing code, the developer must also find a way to incorporate sound, music, graphics, and logic in a cohesive way.
The PICO-8 game engine strips away the complexities and lets the developer focus on the most essential aspects of the idea they want to execute.
In this article, we’ll explore what’s unique about the PICO-8 game engine and how it allows developers to showcase their creativity in spite of the limited medium.
What is the PICO-8 Console?
When playing a PICO-8 game, you might dismiss it as an emulator for a retro console from the 1980s. The pixel art and 8-bit music and sound effects may even give you a bit of nostalgia.
You may be surprised to find out that the PICO-8 was released in 2015. In fact, the PICO-8 was never a console to begin with!
PICO-8 is a virtual game engine created by Lexaloffle Games.
The game engine is an emulator for a fictional video game console. Much like regular consoles, PICO-8 has its own set of machine specifications, display format, and development tools.
The only difference is that the PICO-8 does not actually exist in the real world.
Why would there be interest in a fantasy console?
Fantasy consoles such as the PICO-8 and the TIC-80 give developers a chance to create programs with some form of constraint.
Popular video game engines such as Unity give the developer the ability to create any game they want. While this is good in practice, it leaves the developer with dozens of decisions to make.
The constraints of a fantasy console like PICO-8 gives developers the environment to become more creative. For example, PICO-8 developers do not need to think about what resolution to render their game. Every game works with a resolution of 128×128.
Similarly, the limited palette of 16 colors gives game designers a constraint that forces consistent color schemes.
Programming in PICO-8
Programming in PICO-8 may also be familiar to users who have worked with the Lua programming language. However, the implementation of Lua included in PICO-8 is only a subset of the actual programming language.
PICO-8 also limits how much code you’re allowed to write for each program.
Each cart must contain at most 8192 tokens. Tokens could be a variable, string, operator, or keyword.
For example, the code
a=1 contains three tokens.
This constraint forces developers to find more efficient ways to code their games.
Every PICO-8 game can be shared through a game cartridge or “cart” for short.
These digital game cartridges are actually just images. Each cart contains all the game’s information.
How does an entire game get stored in a single image?
PICO-8 uses a steganographic process to store data into a PNG image. Each PICO-8 byte is stored in the two least significant bits of each of the four channels. Since each image has a dimension of 160×205 pixels, each image can hold up to 32,800 bytes of game data.
Each PICO-8 game file contains data about the program code, graphics, sound, and music. You can use software such as picotool to look through the data found in any PICO-8 cart.
PICO-8 has an active community of programmers and video game developers. Many of these developers were attracted to the idea of developing a video game under retro-console-like limitations.
You can browse thousands of different games on the official website. These games range from bare-bones proof of concepts to full-fledged games that might have been commercially released on an actual console.
The PICO-8 community also releases most of their work under an open-source license. Users can take a look at how other people program their games.
Game jams and collaborations are also highly-encouraged. In fact, a game jam in 2016 led to the development of the highly-popular platform game Celeste.
Here are some of the key features that the PICO-8 game engine provides.
- The game engine includes tools for editing code, music, and sprites built into the console
- PICO-8 is cross-platform compatible.
- Each PICO-8 cart can have up to 64 sounds. The sound editor lets you control the frequency, instrument, and volume of each note used for every sound effect
- PICO-8 allows you to have 256 8×8 sprites.
- The console allows for two 6-button controllers through a connected keyboard.
- PICO-8’s Lua programming language implementation gives developers basic programming functions such as variables, functions, loops, and tables.
- Users may also write code in an external editor if needed
Pros and Cons of Developing in PICO-8
- PICO-8 is tiny and easy to install.
- Limitations force the developer to write effectively.
- Programming language is simple to learn
- Most PICO-8 games are open-source, giving you an opportunity to learn from the PICO-8 community.
- Limited to 2D game development
- PICO-8 currently costs $15 to play
- Lack of libraries mean you might have to code basic functions from scratch
- Lack of code completion and automatic indentation
Creating a Sample Program
In this section, we’ll go over what the user will experience when they create their first game.
After installing the game in your OS of choice, opening the PICO-8 program is as simple as clicking on the PICO-8 shortcut icon.
The user will be greeted with a short animation followed by the PICO-8 console screen.
PRINT(“HELLOWORLD”) into the console and hit Enter. Congratulations, you’ve just executed your first PICO-8 program.
Let’s start creating a new project. In the console, enter the command
To open a project, type
Hit the Esc key to enter the PICO-8 code editor. On the bottom-right corner, you can keep track of how many tokens left to use in your code.
PICO-8 supports the use of variables.
Users can also define functions that they can call elsewhere in the program.
PICO-8 also supports the use of tables. Developers familiar with Lua may recall that tables are the only data containers available in the Lua programming language.
PICO-8 includes a built-in game loop that runs 30 times per second. Both the _update() and _draw() function is needed for the loop to execute.
PICO-8’s built-in sprite editor will help you design the look of your in-game sprites and background art. The editor also allows the user to set animation cycles to each of their assets.
In the console, we can type the command RUN after loading the game to start an instance of the program.
I also recommend looking through PICO-ATE, a hub of essential guides and resources compiled by developer Andrew Reist.
I can relate writing games in the PICO-8 console to writing a haiku. The haiku’s strict structure gives the poet the challenge to convey a concept in just three lines and seventeen syllables. Similarly, PICO-8 challenges the developer to create an experience given a limited number of code, graphics, and sounds.
PICO-8 may not be suitable for creating the latest triple-A titles, but it was never meant for that.
The engine shines in giving beginner developers a chance to explore the challenges of game design and development. PICO-8 is simple enough for people completely new to game development to start using.
But browsing through the games made by the community, I’ve seen that PICO-8 is also a way for experienced game developers to challenge themselves as well.
Are you interested in giving PICO-8 a try?