Pico-8 and React

MDN
4 min readJan 25, 2021
an example of the Pico-8 sprite editor, command line, and Lua scripting editor

Introduction

Pico-8 is an agile game engine which allows users to build 8-bit style games on most computer platforms (Mac/Windows/Linux), which run in web browsers.

The engine itself includes a command line terminal, scripting in Lua, an easy to use sprite editor, and a sfx/music editor.

The popularity of pico-8 is due to the p8.png format which one can share the games. This allows the entire game file to be shared as a p8.png image.

itch.io and the pico-8 website also allow for games to be shared very easily as a web link. But is there a way to embed the game into a React component?

Fortunately, a developer in the software engineering community anticipated this need and created a node library for such a demand: react-pico-8

In this tutorial I will be showing how to load a Pico-8 file, export the Pico-8 project in javaScript, and add it to a React Component. Let’s get started.

Pico-8: Loading and Exporting the js file

First you will need to own Pico-8; get the latest build at the site: https://www.lexaloffle.com/pico-8.php

After owning Pico-8 you can download any project. The game shown above, The Adventures of Jelpi, is a working cartridge, so let’s use that.

--

--