• Hal

PICO-8 GameDev #1: Getting Started

This article is from HERE


What is PICO-8?

For those unfamiliar with PICO-8 - it’s a fantasy console for making, sharing and playing tiny games and other computer programs. You could think of a “fantasy console” as an emulator for a games console that never actually had a physical hardware release.


PICO-8 is basically attempting to be recreate the spirit of an 8-bit games platform - with all its limitations (128x128 resolution, 16-cols, 32k, etc.) - but with a few exceptions that take advantage of newer/modern technology (such as Lua scripting, built-in code/sprite/map/sfx/music editors, powerful exports).


Just like old consoles, PICO-8 uses Cartridges (or Carts, for short) for storing and sharing games and programs. These single files can even be saved as .PNG (image) files, containing ALL the source code and resources! Making them VERY easy to share to other PICO-8 users.


What this essentially means, is that PICO-8 is pretty much a self-contained game engine, with all the tools necessary to create wonderful “retro”-style games (that also can be exported to Web, Windows, Mac and Linux).


PICO-8 is a commercial application ($14.99 5) and available for Windows, Linux, Mac, and Raspberry Pi builds.

The good news is that the Raspberry Pi build has been successfully used with the GameShell (with some set-up - please see this thread 30 for more information on the steps required). This means that, with the use of a Bluetooth keyboard - it should be possible to do PICO-8 development on the go!


First boot

Once you’ve installed PICO-8 and turn it on, the machine greets you with a boot-up sound and command line - just like an “old school” computer.



NOTE: If you see a menu screen, instead of the flashing cursor - it means you are in SPLORE mode, which is PICO-8’s cart menu system for browsing games. To exit, either press ESC on the keyboard (if you have one connected) or MENU on GameShell then “EXIT TO CONSOLE” to get to the console.

You can type commands directly into the console, just like the good old days. For example, if you type:

CLS


…and press ENTER, it will clear the screen.

(NOTE: No need to type in capitals, PICO-8 characters are capital by default)


Now type (and press ENTER):


CIRCFILL(64,64,30,12)


…to draw a big blue Circle in the middle of the screen.


PICO-8 has a whole list of commands (API) available for performing various game-related tasks, such as drawing, audio, input, etc. - which we will use progressively over the course of this tutorial series.


Now, typing individual commands is ok, but unlike those limited computers of yesteryear, this is the 21st Century - pressing ESC switches to the “Editor” mode… which gives you considerably more power!



Editors

The first editor window you’ll see is the Code editor. There are many editors in PICO-8 (Code, Sprite, Map, SFX, Music), but we’ll focus on just the Code editor for this tutorial.

The Code editor is where you will write all of the code for your game.

Here you can define functions and variables, and even organise your code up across multiple tab pages. PICO-8 uses the Lua syntax for development (although it does not use the full library). If you are not already familiar with the Lua scripting language, it’s quite similar to BASIC syntax, and is nice and easy to learn.


Let’s start writing our first PICO-8 cart!




Hello World!

Carts in PICO-8 need to have three main functions: _INIT(), _UPDATE() and _DRAW().

Everything else in your game code will be called from one of these three functions.


_INIT()

  • Called once, at the start of execution.

  • Allows you to ini